aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorMichael Camilleri <mike@inqk.net>2025-07-06 05:45:41 +0900
committerMichael Camilleri <mike@inqk.net>2025-07-06 05:45:41 +0900
commit8d2a9c1148eb838dd97c4ca5132dc70a79a4090a (patch)
treefb6331c372a5e93205118b278a28482a3e07f572 /src
parentUse :dependencies argument in bundle/install for dependency checking (diff)
Allow :dependencies value in info.jdn to contain dictionaries for complex dependency coordinates
Diffstat (limited to 'src')
-rw-r--r--src/boot/boot.janet28
1 files changed, 16 insertions, 12 deletions
diff --git a/src/boot/boot.janet b/src/boot/boot.janet
index b8f0bdb2..0e357eec 100644
--- a/src/boot/boot.janet
+++ b/src/boot/boot.janet
@@ -4302,12 +4302,10 @@
(fexists infofile-src2) infofile-src2))
(def info (-?> infofile-src slurp parse))
(def bundle-name (get config :name (get info :name)))
- (assertf bundle-name
- "unable to infer bundle name for %v, use :name argument" path)
+ (assertf bundle-name "unable to infer bundle name for %v, use :name argument" path)
(assertf (not (string/check-set "\\/" bundle-name))
"bundle name %v cannot contain path separators" bundle-name)
- (assert (next bundle-name)
- "cannot use empty bundle-name")
+ (assert (next bundle-name) "cannot use empty bundle-name")
(assertf (not (fexists (get-manifest-filename bundle-name)))
"bundle %v is already installed" bundle-name)
# Setup installed paths
@@ -4316,7 +4314,7 @@
# Copy infofile
(def infofile-dest (bundle-file bundle-name "info.jdn"))
(when infofile-src (copyfile infofile-src infofile-dest))
- # Copy initfile
+ # Copy aliased initfile
(def initfile-alias (string path s "bundle.janet"))
(def initfile-dest (bundle-file bundle-name "init.janet"))
(when (fexists initfile-alias) (copyfile initfile-alias initfile-dest))
@@ -4328,22 +4326,28 @@
(merge-into man config)
(sync-manifest man)
(edefer (do (print "installation error, uninstalling") (bundle/uninstall bundle-name))
- (put man :info info)
- (def deps (get config :dependencies @[]))
- (def missing (filter (complement bundle/installed?) deps))
- (when (next missing)
- (error (string "missing dependencies " (string/join missing ", "))))
+ (when (os/stat infofile-dest :mode)
+ (def info (-> infofile-dest slurp parse))
+ (def deps (seq [d :in (get info :dependencies @[])]
+ (string (if (dictionary? d) (get d :name) d))))
+ (def missing (filter (complement bundle/installed?) deps))
+ (when (next missing)
+ (error (string "missing dependencies " (string/join missing ", "))))
+ (put man :dependencies deps)
+ (put man :info info))
+ (def clean (get config :clean))
+ (def check (get config :check))
(def module (get-bundle-module bundle-name))
(def all-hooks (seq [[k v] :pairs module :when (symbol? k) :unless (get v :private)] (keyword k)))
(put man :hooks all-hooks)
(do-hook module bundle-name :dependencies man)
- (when (get config :clean)
+ (when clean
(do-hook module bundle-name :clean man))
(do-hook module bundle-name :build man)
(do-hook module bundle-name :install man)
(if (empty? (get man :files)) (print "no files installed, is this a valid bundle?"))
(sync-manifest man)
- (when (get config :check)
+ (when check
(do-hook module bundle-name :check man)))
(print "installed " bundle-name)
(when (get man :has-bin-script)