diff --git a/src/babashka/impl/pods.clj b/src/babashka/impl/pods.clj index fb07c087..54e7cf22 100644 --- a/src/babashka/impl/pods.clj +++ b/src/babashka/impl/pods.clj @@ -9,20 +9,20 @@ (defn load-pod [& args] (apply pods/load-pod @ctx args)) -(defn load-pods-metadata [pods-map] +(defn load-pods-metadata [pods-map opts] (reduce-kv (fn [pod-namespaces pod-spec coord] (merge pod-namespaces (condp #(contains? %2 %1) coord :version (pods/load-pod-metadata pod-spec - (merge {:cache true} + (merge opts {:cache true} (select-keys coord [:version :cache]))) :path (pods/load-pod-metadata (-> @bb-edn :file io/file) pod-spec - (merge {:cache true} + (merge opts {:cache true} (select-keys coord [:path :cache]))) (throw (IllegalArgumentException. diff --git a/src/babashka/main.clj b/src/babashka/main.clj index 12298662..4353f1d4 100644 --- a/src/babashka/main.clj +++ b/src/babashka/main.clj @@ -741,6 +741,12 @@ Use bb run --help to show this help output. (def pod-namespaces (volatile! {})) +(defn download-only? + "If we're preparing pods for another OS / arch, don't try to run them." + [] + (or (not= (System/getenv "OS_NAME") (System/getProperty "os.name")) + (not= (System/getenv "OS_ARCH") (System/getProperty "os.arch")))) + (defn exec [cli-opts] (binding [*unrestricted* true] (sci/binding [core/warn-on-reflection @core/warn-on-reflection @@ -859,7 +865,8 @@ Use bb run --help to show this help output. sci-ctx (sci/init opts) _ (vreset! common/ctx sci-ctx) _ (when-let [pods (:pods @common/bb-edn)] - (let [pod-metadata (pods/load-pods-metadata pods)] + (when-let [pod-metadata (pods/load-pods-metadata + pods {:download-only (download-only?)})] (vreset! pod-namespaces pod-metadata))) preloads (some-> (System/getenv "BABASHKA_PRELOADS") (str/trim)) [expressions exit-code]