From 19bcd2cb387b870f1c5c803c77155a4a6c1e8151 Mon Sep 17 00:00:00 2001 From: Luis <42945842+ldiaz94@users.noreply.github.com> Date: Tue, 13 Oct 2026 13:11:47 +0100 Subject: [PATCH] site: every release's tarball since 0.7.1, never made again download/ keeps each release at its own name, so a program's CI can pin raz by version and SHA-256. A tarball already there is kept as is: made again it would differ in its dates. The home page lists the earlier ones. --- diff --git a/README.md b/README.md index ababa8d..eb50451 100644 --- a/README.md +++ b/README.md @@ -205,9 +205,11 @@ GitHub then builds and checks the tag, and makes a release of it with a tarball of `raz`, its `lib/` and its manual pages, made by `make dist`. A tag pushed before the workflow existed is released from the -Actions tab: run "ci" with its name. Then `make site` puts the new -tag's tarball on the website (it builds it from the tag, apart from -the tree at hand); commit `site/public/` and push to publish it. +Actions tab: run "ci" with its name. Then `make site` adds the new +tag's tarball to the website's `download/` (it builds it from the tag, +apart from the tree at hand); commit `site/public/` and push to publish +it. Every release since 0.7.1 stays there, at its own name, and is +never made again, so that its SHA-256 holds: programs pin raz by it. A version of the report is named by its month and a count; the report's last section says what each version changed. diff --git a/site/build.py b/site/build.py index b08e679..af605bf 100644 --- a/site/build.py +++ b/site/build.py @@ -7,7 +7,7 @@ any web server. Nothing runs in the reader's browser; the code on the tour's pages is run here, by ./raz, and the output shown is what it printed, so a lesson that stops working fails the build. The home page -offers the latest release's tarball, made by make dist from the tag. +offers every release's tarball, made by make dist from its tag. Lessons are site/content//NN-name.txt, one folder to a tour (see TOURS below): @@ -315,33 +315,42 @@ body = '
%s
' % p.stdout write("spec.html", page("The raz report", body, 0, "spec")) +# The first release whose tarball the site offers: the first with the +# manual, which make dist packs +FIRST_RELEASE = "v0.7.1" + def build_download(): - """The latest release's tarball, in public/download/ with its SHA-256 - and /download/latest leading to it; (version, file name, SHA-256). - It is made of the tag's own checkout, not of the tree at hand, and - kept in build/ to be made once.""" + """Every release's tarball from FIRST_RELEASE on, in public/download/ + with its SHA-256, and /download/latest leading to the newest; a list + of (version, file name, SHA-256), oldest first. A program's CI can + fetch the version it was written for by its name, so none is ever + taken away. Each is made of its tag's own checkout, not of the tree + at hand. One already in public/download/ is kept as it is, never + made again: a new one would differ in its dates, and so its SHA-256, + which a program's CI may check.""" git = lambda *a: subprocess.run(("git", "-C", ROOT) + a, capture_output=True, text=True, check=True).stdout.strip() - tag = git("describe", "--tags", "--abbrev=0", "--match", "v*") - name = "raz-%s-linux-x86_64.tar.gz" % tag[1:] - made = os.path.join(ROOT, "build", name) - if not os.path.exists(made): - tree = tempfile.mkdtemp() - try: - git("worktree", "add", "--detach", tree, tag) - subprocess.run(["make", "-s", "-C", ROOT, "dist", "TREE=" + tree], - stdout=subprocess.DEVNULL, check=True) - finally: - git("worktree", "remove", "--force", tree) - digest = hashlib.sha256(open(made, "rb").read()).hexdigest() - os.makedirs(os.path.join(OUT, "download")) - shutil.copy(made, os.path.join(OUT, "download")) - write("download/%s.sha256" % name, "%s %s\n" % (digest, name)) + releases = [] + for tag in git("tag", "-l", "v*", "--sort=v:refname", "--contains", FIRST_RELEASE).split(): + name = "raz-%s-linux-x86_64.tar.gz" % tag[1:] + made = os.path.join(OUT, "download", name) + if not os.path.exists(made): + tree = tempfile.mkdtemp() + try: + git("worktree", "add", "--detach", tree, tag) + subprocess.run(["make", "-s", "-C", ROOT, "dist", "TREE=" + tree], + stdout=subprocess.DEVNULL, check=True) + finally: + git("worktree", "remove", "--force", tree) + shutil.copy(os.path.join(ROOT, "build", name), made) + digest = hashlib.sha256(open(made, "rb").read()).hexdigest() + write("download/%s.sha256" % name, "%s %s\n" % (digest, name)) + releases.append((tag[1:], name, digest)) # Cloudflare reads _redirects from the root of what it serves - write("_redirects", "/download/latest /download/%s 302\n" % name) - return tag[1:], name, digest + write("_redirects", "/download/latest /download/%s 302\n" % releases[-1][1]) + return releases -def build_home(release): +def build_home(releases): snippet = open(os.path.join(HERE, "content", "home.raz"), encoding="utf-8").read() tmp = tempfile.mkdtemp() try: @@ -355,7 +364,10 @@ text = open(os.path.join(HERE, "content", "home.html"), encoding="utf-8").read() text = text.replace("@SNIPPET@", highlight(snippet.rstrip("\n"))) text = text.replace("@OUTPUT@", html.escape(stdout.rstrip("\n"))) - version, name, digest = release + version, name, digest = releases[-1] + earlier = ", ".join('%s' % (n, v) + for v, n, _ in reversed(releases[:-1])) + text = text.replace("@EARLIER@", earlier) text = text.replace("@VERSION@", version).replace("@TARBALL@", name) text = text.replace("@DIR@", name[:-len(".tar.gz")]).replace("@SHA256@", digest) write("index.html", page("raz: a small systems language", text, 0, "home")) @@ -363,8 +375,16 @@ def main(): if not os.path.exists(RAZ): sys.exit("make raz first") - shutil.rmtree(OUT, ignore_errors=True) - os.makedirs(OUT) + # everything is made again but the tarballs (see build_download) + for f in os.listdir(OUT) if os.path.exists(OUT) else []: + path = os.path.join(OUT, f) + if f == "download": + continue + elif os.path.isdir(path): + shutil.rmtree(path) + else: + os.remove(path) + os.makedirs(os.path.join(OUT, "download"), exist_ok=True) shutil.copy(os.path.join(HERE, "style.css"), OUT) for f in os.listdir(os.path.join(HERE, "assets")): # the logo and icons if f not in ("social.html", "render.sh"): diff --git a/site/content/home.html b/site/content/home.html index 61492eb..033c37b 100644 --- a/site/content/home.html +++ b/site/content/home.html @@ -75,5 +75,8 @@ $ raz run Hello.raz

The link works since raz finds lib/ beside its real path. The manual pages are in man/: man ./man/raz-tutorial.7. -The address download/latest always leads to the newest release.

+The address download/latest always leads to the newest release, +and download/raz-@VERSION@-linux-x86_64.tar.gz to this one, for +good. Earlier releases: @EARLIER@; each has its SHA-256 beside it, with +.sha256 added to its name.

SHA-256 @SHA256@

diff --git a/site/public/download/raz-0.7.1-linux-x86_64.tar.gz b/site/public/download/raz-0.7.1-linux-x86_64.tar.gz new file mode 100644 index 0000000..c4c5081 Binary files /dev/null and b/site/public/download/raz-0.7.1-linux-x86_64.tar.gz differ diff --git a/site/public/download/raz-0.7.1-linux-x86_64.tar.gz.sha256 b/site/public/download/raz-0.7.1-linux-x86_64.tar.gz.sha256 new file mode 100644 index 0000000..2055e79 --- /dev/null +++ b/site/public/download/raz-0.7.1-linux-x86_64.tar.gz.sha256 @@ -0,0 +1 @@ +e3900f480fb559587e16e741d604f3b1b04db0f890c33aa79402574172c44ced raz-0.7.1-linux-x86_64.tar.gz diff --git a/site/public/download/raz-0.8.0-linux-x86_64.tar.gz b/site/public/download/raz-0.8.0-linux-x86_64.tar.gz new file mode 100644 index 0000000..3908eb4 Binary files /dev/null and b/site/public/download/raz-0.8.0-linux-x86_64.tar.gz differ diff --git a/site/public/download/raz-0.8.0-linux-x86_64.tar.gz.sha256 b/site/public/download/raz-0.8.0-linux-x86_64.tar.gz.sha256 new file mode 100644 index 0000000..9605870 --- /dev/null +++ b/site/public/download/raz-0.8.0-linux-x86_64.tar.gz.sha256 @@ -0,0 +1 @@ +fa1e62fb39cbbcab340b86ac2630687475ad150a4d53bde5bfc4f5fc10149276 raz-0.8.0-linux-x86_64.tar.gz diff --git a/site/public/index.html b/site/public/index.html index 3efaeac..2821bb9 100644 --- a/site/public/index.html +++ b/site/public/index.html @@ -121,7 +121,10 @@ $ raz run Hello.raz

The link works since raz finds lib/ beside its real path. The manual pages are in man/: man ./man/raz-tutorial.7. -The address download/latest always leads to the newest release.

+The address download/latest always leads to the newest release, +and download/raz-0.9.0-linux-x86_64.tar.gz to this one, for +good. Earlier releases: 0.8.0, 0.7.1; each has its SHA-256 beside it, with +.sha256 added to its name.

SHA-256 c1387747ef3350efb19b35edf2769612fe323ecb08cff34906065b530fc71a09