Skip to content

Commit

Permalink
v1.11.1.1411
Browse files Browse the repository at this point in the history
  • Loading branch information
borkdude committed Sep 26, 2023
1 parent 441a538 commit f52034c
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 10 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ DEPS_CLJ_TOOLS_VERSION=1.11.1.1165 bb clojure

[deps.clj](https://github.com/borkdude/deps.clj): a faithful port of the clojure CLI bash script to Clojure

## 1.11.1.1411

- Catch up with CLI `1.11.1.1411`
- [#113](https://github.com/borkdude/deps.clj/issues/113): Fix bug in SHA comparison of downloaded tools jar with leading zeroes

## 1.11.1.1403

- Verify downloaded zip file with .sha256 file
Expand Down
12 changes: 9 additions & 3 deletions deps.bat
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
;; see https://github.com/clojure/brew-install/blob/1.11.1/CHANGELOG.md
(def ^:private version
(delay (or (System/getenv "DEPS_CLJ_TOOLS_VERSION")
"1.11.1.1403")))
"1.11.1.1413")))

(def ^:private cache-version "4")

Expand Down Expand Up @@ -537,6 +537,9 @@ public class ClojureToolsDownloader {
Should return `true` if the download was successful, or false if not."
nil)

(defn- left-pad-zeroes [s n]
(str (str/join (repeat (- n (count s)) 0)) s))

(defn clojure-tools-install!
"Installs clojure tools archive by downloading it in `:out-dir`, if not already there,
and extracting in-place.
Expand Down Expand Up @@ -582,12 +585,15 @@ public class ClojureToolsDownloader {
(*exit-fn* {:exit ct-error-exit-code
:message (str "Expected sha256 file to be downloaded to: " sha256-file)}))))
(when (.exists sha256-file)
(let [sha (str/trim (slurp sha256-file))
(let [sha (-> (slurp sha256-file)
str/trim
(left-pad-zeroes 64))
bytes (Files/readAllBytes (.toPath zip-file))
hash (-> (java.security.MessageDigest/getInstance "SHA-256")
(.digest bytes))
hash (-> (new BigInteger 1 hash)
(.toString 16))]
(.toString 16))
hash (left-pad-zeroes hash 64)]
(if-not (= sha hash)
(*exit-fn* {:exit ct-error-exit-code
:message (str "Error: sha256 of zip and expected sha256 do not match: "
Expand Down
12 changes: 9 additions & 3 deletions deps.clj
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
;; see https://github.com/clojure/brew-install/blob/1.11.1/CHANGELOG.md
(def ^:private version
(delay (or (System/getenv "DEPS_CLJ_TOOLS_VERSION")
"1.11.1.1403")))
"1.11.1.1413")))

(def ^:private cache-version "4")

Expand Down Expand Up @@ -532,6 +532,9 @@ public class ClojureToolsDownloader {
Should return `true` if the download was successful, or false if not."
nil)

(defn- left-pad-zeroes [s n]
(str (str/join (repeat (- n (count s)) 0)) s))

(defn clojure-tools-install!
"Installs clojure tools archive by downloading it in `:out-dir`, if not already there,
and extracting in-place.
Expand Down Expand Up @@ -577,12 +580,15 @@ public class ClojureToolsDownloader {
(*exit-fn* {:exit ct-error-exit-code
:message (str "Expected sha256 file to be downloaded to: " sha256-file)}))))
(when (.exists sha256-file)
(let [sha (str/trim (slurp sha256-file))
(let [sha (-> (slurp sha256-file)
str/trim
(left-pad-zeroes 64))
bytes (Files/readAllBytes (.toPath zip-file))
hash (-> (java.security.MessageDigest/getInstance "SHA-256")
(.digest bytes))
hash (-> (new BigInteger 1 hash)
(.toString 16))]
(.toString 16))
hash (left-pad-zeroes hash 64)]
(if-not (= sha hash)
(*exit-fn* {:exit ct-error-exit-code
:message (str "Error: sha256 of zip and expected sha256 do not match: "
Expand Down
2 changes: 1 addition & 1 deletion resources/DEPS_CLJ_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.11.1.1404-SNAPSHOT
1.11.1.1411
12 changes: 9 additions & 3 deletions src/borkdude/deps.clj
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
;; see https://github.com/clojure/brew-install/blob/1.11.1/CHANGELOG.md
(def ^:private version
(delay (or (System/getenv "DEPS_CLJ_TOOLS_VERSION")
"1.11.1.1403")))
"1.11.1.1413")))

(def ^:private cache-version "4")

Expand Down Expand Up @@ -529,6 +529,9 @@ public class ClojureToolsDownloader {
Should return `true` if the download was successful, or false if not."
nil)

(defn- left-pad-zeroes [s n]
(str (str/join (repeat (- n (count s)) 0)) s))

(defn clojure-tools-install!
"Installs clojure tools archive by downloading it in `:out-dir`, if not already there,
and extracting in-place.
Expand Down Expand Up @@ -574,12 +577,15 @@ public class ClojureToolsDownloader {
(*exit-fn* {:exit ct-error-exit-code
:message (str "Expected sha256 file to be downloaded to: " sha256-file)}))))
(when (.exists sha256-file)
(let [sha (str/trim (slurp sha256-file))
(let [sha (-> (slurp sha256-file)
str/trim
(left-pad-zeroes 64))
bytes (Files/readAllBytes (.toPath zip-file))
hash (-> (java.security.MessageDigest/getInstance "SHA-256")
(.digest bytes))
hash (-> (new BigInteger 1 hash)
(.toString 16))]
(.toString 16))
hash (left-pad-zeroes hash 64)]
(if-not (= sha hash)
(*exit-fn* {:exit ct-error-exit-code
:message (str "Error: sha256 of zip and expected sha256 do not match: "
Expand Down

0 comments on commit f52034c

Please sign in to comment.