nandi/frqpublic Fork 0
4f38d68
Commits
Clone
git clone https://git.rickub.com/nandi/frq.git
git clone ssh://git@rickub.com/nandi/frq.git

Host key fingerprint (ed25519): SHA256:iycHnxEyq0Q7uyVpB7JlznP0G7JrTPXLYRcAU5CSLhc — verify it before your first connect.

Retire the release-bumping script

bump-jolt-native.bb existed to rewrite a release url and its digest in
nix/android.nix and to pin the matching commit in deps.edn. The first
half has nothing left to rewrite -- the archive is a flake input now --
and the second was driven by a GitLab release, which the CI-artifact
model does not produce. What it wrote by hand is now flake.lock's job.

deps.edn moves to the same rev the flake input names, and picks up the
glimmer-backends/ rename with it. paths/dep-sha went with the script; it
had no other caller.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
nandi committed 2026-09-07T22:27:56-07:00 Browse files
4f38d68 parent: 472e179
modified deps.edn +3 -3
@@ -13,8 +13,8 @@
1313 :deps {jolt-lang/glimmer {:git/url "https://gitlab.com/nandithebull/glimmer"
1414 :git/sha "399df371c790d690fb6e4560c3d4d7f838502857"}
1515 nandi/glimmer-vidya {:git/url "https://gitlab.com/nandithebull/jolt-native"
16- :git/sha "fd0e21a6c5d745ff9d134f92f909665454a7a1c9"
17- :deps/root "jolt/glimmer-vidya"}}
16+ :git/sha "d970307ccf1fe67e2e971f2837d2282d8ba79a62"
17+ :deps/root "glimmer-backends/glimmer-vidya"}}
1818
1919 ;; Both objects come from gitlab.com/nandithebull/jolt-native, one crate each,
2020 ;; out of one target directory:
@@ -48,7 +48,7 @@
4848 ;;
4949 ;; just tui
5050 :tui {:extra-deps {nandi/glimmer-tui
51- {:local/root "../jolt-native/jolt/glimmer-tui"}}
51+ {:local/root "../jolt-native/glimmer-backends/glimmer-tui"}}
5252 :main-opts ["-m" "frq.tui"]}}
5353
5454 :tasks {frq "jolt -M:frq"
@@ -13,8 +13,8 @@
13 :deps {jolt-lang/glimmer {:git/url "https://gitlab.com/nandithebull/glimmer"13 :deps {jolt-lang/glimmer {:git/url "https://gitlab.com/nandithebull/glimmer"
14 :git/sha "399df371c790d690fb6e4560c3d4d7f838502857"}14 :git/sha "399df371c790d690fb6e4560c3d4d7f838502857"}
15 nandi/glimmer-vidya {:git/url "https://gitlab.com/nandithebull/jolt-native"15 nandi/glimmer-vidya {:git/url "https://gitlab.com/nandithebull/jolt-native"
16- :git/sha "fd0e21a6c5d745ff9d134f92f909665454a7a1c9"16+ :git/sha "d970307ccf1fe67e2e971f2837d2282d8ba79a62"
17- :deps/root "jolt/glimmer-vidya"}}17+ :deps/root "glimmer-backends/glimmer-vidya"}}
18 18
19 ;; Both objects come from gitlab.com/nandithebull/jolt-native, one crate each,19 ;; Both objects come from gitlab.com/nandithebull/jolt-native, one crate each,
20 ;; out of one target directory:20 ;; out of one target directory:
@@ -48,7 +48,7 @@
48 ;;48 ;;
49 ;; just tui49 ;; just tui
50 :tui {:extra-deps {nandi/glimmer-tui50 :tui {:extra-deps {nandi/glimmer-tui
51- {:local/root "../jolt-native/jolt/glimmer-tui"}}51+ {:local/root "../jolt-native/glimmer-backends/glimmer-tui"}}
52 :main-opts ["-m" "frq.tui"]}}52 :main-opts ["-m" "frq.tui"]}}
53 53
54 :tasks {frq "jolt -M:frq"54 :tasks {frq "jolt -M:frq"
modified justfile +0 -6
@@ -12,12 +12,6 @@ default:
1212 apk action="build":
1313 scripts/apk.bb {{action}}
1414
15-# The jolt-native source pin — deps.edn and the flake input — at a release. The
16-# Android objects are not pinned here any more; `just apk` takes the latest CI
17-# build of those on every run.
18-bump tag="":
19- scripts/bump-jolt-native.bb {{tag}}
20-
2115 # The app: this tree's source on the flake's everything-else, in the dev shell.
2216 run *args:
2317 scripts/run.bb {{args}}
@@ -12,12 +12,6 @@ default:
12 apk action="build":12 apk action="build":
13 scripts/apk.bb {{action}}13 scripts/apk.bb {{action}}
14 14
15-# The jolt-native source pin — deps.edn and the flake input — at a release. The
16-# Android objects are not pinned here any more; `just apk` takes the latest CI
17-# build of those on every run.
18-bump tag="":
19- scripts/bump-jolt-native.bb {{tag}}
20-
21 # The app: this tree's source on the flake's everything-else, in the dev shell.15 # The app: this tree's source on the flake's everything-else, in the dev shell.
22 run *args:16 run *args:
23 scripts/run.bb {{args}}17 scripts/run.bb {{args}}
deleted scripts/bump-jolt-native.bb +0 -130
deleted file mode 100755
@@ -1,130 +0,0 @@
1-#!/bin/sh
2-#_(
3-exec "$(dirname "$0")/bb" "$0" "$@"
4-)
5-
6-;; Move every jolt-native pin in this tree to a release of it.
7-;;
8-;; scripts/bump-jolt-native.bb # the latest release
9-;; scripts/bump-jolt-native.bb v0.1.3 # a named one
10-;;
11-;; A jolt-native bump is three facts in two places: the URL and the digest of
12-;; each Android archive in nix/android.nix, and the release's commit in
13-;; deps.edn. Done by hand it is a lot of copying between a browser and a
14-;; sha256sum, and the failure mode is a pin that still says v0.1.2 while its
15-;; digest is v0.1.3's — which fetchurl catches at build time and no sooner.
16-;;
17-;; Only the APK fetches a release now; a desktop run builds jolt-native out of
18-;; the flake input, whose rev is flake.lock's. So the two halves this moves are
19-;; the phone's bytes and the Jolt source that binds them, and the thing to
20-;; remember is that flake.lock is a third pin nothing here touches — see the
21-;; jolt-native input's comment in flake.nix for why it runs ahead.
22-;;
23-;; So: ask GitLab what the release holds, fetch each archive once, weigh it,
24-;; write nix/android.nix back, and put the release's commit in deps.edn — which
25-;; is what jolt resolves glimmer-vidya from, and so what the boot image
26-;; compiles against.
27-;;
28-;; Nothing here decides whether the new release is a good idea. It only makes
29-;; the tree say one version instead of two.
30-(require '[babashka.classpath :as cp])
31-(cp/add-classpath (str (babashka.fs/parent *file*)))
32-(require '[frq.paths :as paths]
33- '[babashka.fs :as fs]
34- '[babashka.process :as p]
35- '[cheshire.core :as json]
36- '[clojure.string :as str])
37-
38-(def root (str (fs/parent (fs/parent (fs/canonicalize *file*)))))
39-(def project "nandithebull%2Fjolt-native")
40-(def repo "https://gitlab.com/nandithebull/jolt-native")
41-
42-;; The release, as GitLab has it. `?per_page=1` when no tag is asked for: the
43-;; list is newest first, and the newest is what "latest" means here — the
44-;; /releases/permalink/latest endpoint sorts by release date, which is not the
45-;; same thing once a release is edited.
46-(defn release [tag]
47- (let [url (if tag
48- (str "https://gitlab.com/api/v4/projects/" project "/releases/" tag)
49- (str "https://gitlab.com/api/v4/projects/" project "/releases?per_page=1"))
50- body (json/parse-string (paths/out "curl" "-fsSL" url))]
51- (if tag
52- body
53- (or (first body) (paths/die (str "no releases at all under " repo))))))
54-
55-;; The archive an entry names, at the new tag. The URL a pin carries is the
56-;; release permalink — /-/releases/<tag>/downloads/<asset> — so the asset's name
57-;; is its last segment, and the name carries the version too. Both move.
58-(defn retag [url old new]
59- (-> url
60- (str/replace (str "/releases/" old "/") (str "/releases/" new "/"))
61- (str/replace (str "-" old ".") (str "-" new "."))))
62-
63-(defn tag-of [url]
64- (second (re-find #"/-/releases/([^/]+)/downloads/" url)))
65-
66-;; Fetch once per distinct URL, then weigh it: the digest is over the archive as
67-;; downloaded, which is what fetchurl hashes too — not of anything inside it.
68-(def weigh
69- (memoize
70- (fn [dir url]
71- (let [file (fs/path dir (last (str/split url #"/")))]
72- (println (str " fetching " (fs/file-name file)))
73- (p/shell "curl" "-fsSL" "-o" (str file) url)
74- (first (str/split (paths/out "sha256sum" (str file)) #"\s+"))))))
75-
76-;; nix/android.nix fetches the release archives as `pkgs.fetchurl`, which is the
77-;; only fetch of a release left in this tree. Rewritten as text for the same
78-;; reason deps.edn is — the file is mostly the comments explaining each step,
79-;; and there is no round-tripping Nix as data here anyway.
80-;;
81-;; Every fetchurl whose url points at the repo, whatever it is called: a third
82-;; archive appearing in android.nix should move with the other two rather than
83-;; be remembered about.
84-(defn bump-nix! [tmp tag]
85- (let [file (fs/path root "nix" "android.nix")
86- text (slurp (str file))
87- ;; url and sha256 as one match, so the pair moves together. Anything
88- ;; between them — a comment, another attribute — would not match, and
89- ;; not matching is the safe direction: it leaves the pin alone and says
90- ;; nothing was written.
91- pattern (re-pattern (str "(url\\s*=\\s*\")(" (java.util.regex.Pattern/quote repo)
92- "[^\"]*)(\";\\s*\n\\s*sha256\\s*=\\s*\")([^\"]*)(\")"))
93- seen (atom [])
94- updated (str/replace text pattern
95- (fn [[_ head url mid _ tail]]
96- (let [new-url (retag url (tag-of url) tag)
97- digest (weigh tmp new-url)]
98- (swap! seen conj (last (str/split new-url #"/")))
99- (str head new-url mid digest tail))))]
100- (when (empty? @seen)
101- (paths/die (str "no fetchurl in " file " points at " repo)))
102- (spit (str file) updated)
103- (doseq [name @seen] (println (str " nix/android.nix " name)))))
104-
105-;; deps.edn takes glimmer-vidya as a git dependency, and the boot image is
106-;; compiled from the source root jolt resolves that to. Replaced as text rather
107-;; than round-tripped as EDN: the file is mostly comments explaining why each
108-;; pin is where it is, and rewriting it as data would throw all of them away.
109-(defn bump-deps! [commit]
110- (let [file (fs/path root "deps.edn")
111- text (slurp (str file))
112- old (paths/dep-sha root repo)]
113- (cond
114- (nil? old) (paths/die (str "no dependency on " repo " in deps.edn"))
115- (= old commit) (println " deps.edn already at this commit")
116- :else (do (spit (str file) (str/replace text old commit))
117- (println (str " deps.edn " (subs old 0 8) " -> " (subs commit 0 8)))))))
118-
119-(let [tag (first *command-line-args*)
120- rel (release tag)
121- tag (get rel "tag_name")
122- commit (get-in rel ["commit" "id"])
123- tmp (fs/create-temp-dir {:prefix "jolt-native-"})]
124- (println (str "jolt-native " tag " (" (subs commit 0 8) ")"))
125- (try
126- (bump-nix! tmp tag)
127- (finally (fs/delete-tree tmp)))
128- (bump-deps! commit)
129- (println (str "\nNow: git diff, then `just apk` — the pins are "
130- "written, nothing is built.")))
deleted file mode 100755
@@ -1,130 +0,0 @@
1-#!/bin/sh
2-#_(
3-exec "$(dirname "$0")/bb" "$0" "$@"
4-)
5-
6-;; Move every jolt-native pin in this tree to a release of it.
7-;;
8-;; scripts/bump-jolt-native.bb # the latest release
9-;; scripts/bump-jolt-native.bb v0.1.3 # a named one
10-;;
11-;; A jolt-native bump is three facts in two places: the URL and the digest of
12-;; each Android archive in nix/android.nix, and the release's commit in
13-;; deps.edn. Done by hand it is a lot of copying between a browser and a
14-;; sha256sum, and the failure mode is a pin that still says v0.1.2 while its
15-;; digest is v0.1.3's — which fetchurl catches at build time and no sooner.
16-;;
17-;; Only the APK fetches a release now; a desktop run builds jolt-native out of
18-;; the flake input, whose rev is flake.lock's. So the two halves this moves are
19-;; the phone's bytes and the Jolt source that binds them, and the thing to
20-;; remember is that flake.lock is a third pin nothing here touches — see the
21-;; jolt-native input's comment in flake.nix for why it runs ahead.
22-;;
23-;; So: ask GitLab what the release holds, fetch each archive once, weigh it,
24-;; write nix/android.nix back, and put the release's commit in deps.edn — which
25-;; is what jolt resolves glimmer-vidya from, and so what the boot image
26-;; compiles against.
27-;;
28-;; Nothing here decides whether the new release is a good idea. It only makes
29-;; the tree say one version instead of two.
30-(require '[babashka.classpath :as cp])
31-(cp/add-classpath (str (babashka.fs/parent *file*)))
32-(require '[frq.paths :as paths]
33- '[babashka.fs :as fs]
34- '[babashka.process :as p]
35- '[cheshire.core :as json]
36- '[clojure.string :as str])
37-
38-(def root (str (fs/parent (fs/parent (fs/canonicalize *file*)))))
39-(def project "nandithebull%2Fjolt-native")
40-(def repo "https://gitlab.com/nandithebull/jolt-native")
41-
42-;; The release, as GitLab has it. `?per_page=1` when no tag is asked for: the
43-;; list is newest first, and the newest is what "latest" means here — the
44-;; /releases/permalink/latest endpoint sorts by release date, which is not the
45-;; same thing once a release is edited.
46-(defn release [tag]
47- (let [url (if tag
48- (str "https://gitlab.com/api/v4/projects/" project "/releases/" tag)
49- (str "https://gitlab.com/api/v4/projects/" project "/releases?per_page=1"))
50- body (json/parse-string (paths/out "curl" "-fsSL" url))]
51- (if tag
52- body
53- (or (first body) (paths/die (str "no releases at all under " repo))))))
54-
55-;; The archive an entry names, at the new tag. The URL a pin carries is the
56-;; release permalink — /-/releases/<tag>/downloads/<asset> — so the asset's name
57-;; is its last segment, and the name carries the version too. Both move.
58-(defn retag [url old new]
59- (-> url
60- (str/replace (str "/releases/" old "/") (str "/releases/" new "/"))
61- (str/replace (str "-" old ".") (str "-" new "."))))
62-
63-(defn tag-of [url]
64- (second (re-find #"/-/releases/([^/]+)/downloads/" url)))
65-
66-;; Fetch once per distinct URL, then weigh it: the digest is over the archive as
67-;; downloaded, which is what fetchurl hashes too — not of anything inside it.
68-(def weigh
69- (memoize
70- (fn [dir url]
71- (let [file (fs/path dir (last (str/split url #"/")))]
72- (println (str " fetching " (fs/file-name file)))
73- (p/shell "curl" "-fsSL" "-o" (str file) url)
74- (first (str/split (paths/out "sha256sum" (str file)) #"\s+"))))))
75-
76-;; nix/android.nix fetches the release archives as `pkgs.fetchurl`, which is the
77-;; only fetch of a release left in this tree. Rewritten as text for the same
78-;; reason deps.edn is — the file is mostly the comments explaining each step,
79-;; and there is no round-tripping Nix as data here anyway.
80-;;
81-;; Every fetchurl whose url points at the repo, whatever it is called: a third
82-;; archive appearing in android.nix should move with the other two rather than
83-;; be remembered about.
84-(defn bump-nix! [tmp tag]
85- (let [file (fs/path root "nix" "android.nix")
86- text (slurp (str file))
87- ;; url and sha256 as one match, so the pair moves together. Anything
88- ;; between them — a comment, another attribute — would not match, and
89- ;; not matching is the safe direction: it leaves the pin alone and says
90- ;; nothing was written.
91- pattern (re-pattern (str "(url\\s*=\\s*\")(" (java.util.regex.Pattern/quote repo)
92- "[^\"]*)(\";\\s*\n\\s*sha256\\s*=\\s*\")([^\"]*)(\")"))
93- seen (atom [])
94- updated (str/replace text pattern
95- (fn [[_ head url mid _ tail]]
96- (let [new-url (retag url (tag-of url) tag)
97- digest (weigh tmp new-url)]
98- (swap! seen conj (last (str/split new-url #"/")))
99- (str head new-url mid digest tail))))]
100- (when (empty? @seen)
101- (paths/die (str "no fetchurl in " file " points at " repo)))
102- (spit (str file) updated)
103- (doseq [name @seen] (println (str " nix/android.nix " name)))))
104-
105-;; deps.edn takes glimmer-vidya as a git dependency, and the boot image is
106-;; compiled from the source root jolt resolves that to. Replaced as text rather
107-;; than round-tripped as EDN: the file is mostly comments explaining why each
108-;; pin is where it is, and rewriting it as data would throw all of them away.
109-(defn bump-deps! [commit]
110- (let [file (fs/path root "deps.edn")
111- text (slurp (str file))
112- old (paths/dep-sha root repo)]
113- (cond
114- (nil? old) (paths/die (str "no dependency on " repo " in deps.edn"))
115- (= old commit) (println " deps.edn already at this commit")
116- :else (do (spit (str file) (str/replace text old commit))
117- (println (str " deps.edn " (subs old 0 8) " -> " (subs commit 0 8)))))))
118-
119-(let [tag (first *command-line-args*)
120- rel (release tag)
121- tag (get rel "tag_name")
122- commit (get-in rel ["commit" "id"])
123- tmp (fs/create-temp-dir {:prefix "jolt-native-"})]
124- (println (str "jolt-native " tag " (" (subs commit 0 8) ")"))
125- (try
126- (bump-nix! tmp tag)
127- (finally (fs/delete-tree tmp)))
128- (bump-deps! commit)
129- (println (str "\nNow: git diff, then `just apk` — the pins are "
130- "written, nothing is built.")))
modified scripts/frq/paths.clj +0 -8
@@ -5,7 +5,6 @@
55 (ns frq.paths
66 (:require [babashka.fs :as fs]
77 [babashka.process :as p]
8- [clojure.edn :as edn]
98 [clojure.string :as str]))
109
1110 (defn die [& lines]
@@ -19,13 +18,6 @@
1918
2019 (defn env [k default] (or (not-empty (System/getenv k)) default))
2120
22-;; The sha deps.edn pins for a git url, so a bump there reaches the boot image.
23-;; Read as data rather than grepped: it is Clojure, and so is this.
24-(defn dep-sha [root url]
25- (->> (:deps (edn/read-string (slurp (str (fs/path root "deps.edn")))))
26- vals
27- (some #(when (= url (:git/url %)) (:git/sha %)))))
28-
2921 (defn require-paths!
3022 "Every path must exist, or say which one did not and stop."
3123 [label paths & hint]
@@ -5,7 +5,6 @@
5 (ns frq.paths5 (ns frq.paths
6 (:require [babashka.fs :as fs]6 (:require [babashka.fs :as fs]
7 [babashka.process :as p]7 [babashka.process :as p]
8- [clojure.edn :as edn]
9 [clojure.string :as str]))8 [clojure.string :as str]))
10 9
11 (defn die [& lines]10 (defn die [& lines]
@@ -19,13 +18,6 @@
19 18
20 (defn env [k default] (or (not-empty (System/getenv k)) default))19 (defn env [k default] (or (not-empty (System/getenv k)) default))
21 20
22-;; The sha deps.edn pins for a git url, so a bump there reaches the boot image.
23-;; Read as data rather than grepped: it is Clojure, and so is this.
24-(defn dep-sha [root url]
25- (->> (:deps (edn/read-string (slurp (str (fs/path root "deps.edn")))))
26- vals
27- (some #(when (= url (:git/url %)) (:git/sha %)))))
28-
29 (defn require-paths!21 (defn require-paths!
30 "Every path must exist, or say which one did not and stop."22 "Every path must exist, or say which one did not and stop."
31 [label paths & hint]23 [label paths & hint]