Add fallback for Apple M1
This commit is contained in:
parent
842ff34739
commit
8e8a4f854b
1 changed files with 22 additions and 16 deletions
|
|
@ -23,22 +23,28 @@
|
|||
(binding [*out* *err*]
|
||||
(apply println strs)))
|
||||
|
||||
(defn match-artifacts [package]
|
||||
(let [artifacts (:pod/artifacts package)
|
||||
res (filter (fn [{os-name :os/name
|
||||
os-arch :os/arch}]
|
||||
(let [os-arch (normalize-arch os-arch)]
|
||||
(and (re-matches (re-pattern os-name) (:os/name os))
|
||||
(re-matches (re-pattern os-arch)
|
||||
(:os/arch os)))))
|
||||
artifacts)]
|
||||
(when (empty? res)
|
||||
(throw (IllegalArgumentException. (format "No executable found for pod %s (%s) and OS %s/%s"
|
||||
(:pod/name package)
|
||||
(:pod/version package)
|
||||
(:os/name os)
|
||||
(:os/arch os)))))
|
||||
res))
|
||||
(defn match-artifacts
|
||||
([package] (match-artifacts package (:os/arch os)))
|
||||
([package arch]
|
||||
(let [artifacts (:pod/artifacts package)
|
||||
res (filter (fn [{os-name :os/name
|
||||
os-arch :os/arch}]
|
||||
(let [os-arch (normalize-arch os-arch)]
|
||||
(and (re-matches (re-pattern os-name) (:os/name os))
|
||||
(re-matches (re-pattern os-arch)
|
||||
arch))))
|
||||
artifacts)]
|
||||
(if (empty? res)
|
||||
(if (and (= "Mac OS X" (:os/name os))
|
||||
(= "aarch64" (:os/arch os)))
|
||||
;; Rosetta2 fallback on Apple M1 machines
|
||||
(match-artifacts package "x86_64")
|
||||
(throw (IllegalArgumentException. (format "No executable found for pod %s (%s) and OS %s/%s"
|
||||
(:pod/name package)
|
||||
(:pod/version package)
|
||||
(:os/name os)
|
||||
(:os/arch os)))))
|
||||
res))))
|
||||
|
||||
(defn unzip [{:keys [^java.io.File zip-file
|
||||
^java.io.File destination-dir
|
||||
|
|
|
|||
Loading…
Reference in a new issue