From 88dd58b51bf1666da9d1e426b55c734d109dbc9c Mon Sep 17 00:00:00 2001 From: Luis <42945842+ldiaz94@users.noreply.github.com> Date: Mon, 19 Oct 2026 07:35:08 +0000 Subject: [PATCH] Build and publish the source browser and release archives under /source/ --- diff --git a/.gitignore b/.gitignore index 0408080..db3cd1b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,7 @@ build/ +.wrangler/ +/site/public/source/ +/site/__pycache__/ /raz # Programs make check builds next to their sources /examples/* diff --git a/CLAUDE.md b/CLAUDE.md index 3be2efa..71c8724 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -80,6 +80,14 @@ ## Where things stand +The website's `/source/` browser and releases are built by ladle, +pinned with its checksum under `site/tools/`. `make site` builds the +main pages and then the source site. Wrangler runs `make site-source` +before uploading, so the generated Git store stays out of this +repository. `site/README.md` gives the build, release records and +checks. `site/releases` preserves the existing untagged website +distributions; it does not create their tags. + v0.20.0, report 2026-10.34, is made and not yet tagged: v0.19.0 builds `src/` (`BOOT`) and the Pascal seed is gone; `Buf.bytes`, `Sys.entryKind` and `src/`'s `Item`s only read take `const`; and the diff --git a/HANDOVER.md b/HANDOVER.md index 5390fa9..0d70c8a 100644 --- a/HANDOVER.md +++ b/HANDOVER.md @@ -1,4 +1,37 @@ -# Handover, 2026-10-17 +# Handover + +## Website source integration, 2026-10-19 + +`make site` now adds ladle's source browser, history, release pages +and a dumb-HTTP clone store under `/source/`. The existing Cloudflare +deploy command stays `npx wrangler deploy`; its custom build hook runs +`make site-source` before uploading. The source output is ignored, +avoiding a Git store that contains copies of its own earlier builds. +The compressed static ladle executable is pinned at 509b9d3 with its +checksum and build instructions in `site/tools/`. + +`site/releases` records the existing v0.18.1, v0.19.0 and v0.20.0 +website distributions at the commits below. Both site builders read +it, so a plain build keeps v0.20.0 as the latest download. All +original compiler archives and their published checksums keep their +bytes. Each supported version also has a source archive; the three +untagged versions have notes under `site/release-notes/` explaining +their status. No compiler release or tag was created here. + +The root `_headers` carries scoped `/source/` rules, including the +canonical release-page URLs Cloudflare serves. Other pages keep their +existing policy; `/download/latest` keeps its redirect. `site/README.md` +gives the full build and verification procedure. The bundled builder +needs only Python 3 and git on x86-64 Linux. A shallow deployment +checkout fetches the full history and tags from its own origin. + +Checks before pushing: `make check` (1,012 checks), `make site`, six +Git and checksum checks in `site/check.py`, and Wrangler's actual +custom build in a deploy dry run. The existing report PDFs were +reused; Pandoc 3.8 rebuilds the HTML report as before. Live deployment +and HTTP download/clone verification follow the push to main. + +## Compiler handover, 2026-10-17 v0.20.0 is done on `main`; nothing is tagged. This says what to tag where, how, and what to check. Delete this file once the three tags diff --git a/Makefile b/Makefile index 04de106..b380516 100644 --- a/Makefile +++ b/Makefile @@ -175,8 +175,19 @@ # "Raz, Set, Go" (whose programs are run here, so the output shown is # real), the report and the latest release's tarball. site/build.py # says how; it needs ./raz and pandoc. RELEASES, "vX.Y.Z=COMMIT ...", -# names releases whose tags aren't pushed yet. +# adds release records to those kept in site/releases. site-source runs +# ladle after the pages: its Git store and releases live under /source/, +# with their headers merged at the upload's root. The pinned ladle is +# bundled for Cloudflare; LADLE may name a locally built one instead. +LADLE ?= site: raz pdf python3 site/build.py $(RELEASES) + $(MAKE) site-source -.PHONY: prev-bench fixpoint check gdb bench kernels stress alpine fmt loc man pdf dist site clean install uninstall +# Wrangler runs this before deploying the committed pages. The generated +# Git store must never be committed: otherwise later stores contain copies +# of earlier ones. See site/README.md for the release and upload procedure. +site-source: + python3 site/source.py $(if $(LADLE),--ladle $(LADLE)) $(RELEASES) + +.PHONY: prev-bench fixpoint check gdb bench kernels stress alpine fmt loc man pdf dist site site-source clean install uninstall diff --git a/README.md b/README.md index 94bb70f..c1acfea 100644 --- a/README.md +++ b/README.md @@ -86,6 +86,7 @@ make pdf # build/raz.pdf and build/raz-lib.pdf, the two volumes, by pandoc and Chromium make dist # build/raz-V-linux-x86_64.tar.gz, the release's tarball make site # site/public/, the website, by pandoc and python3 + make site-source # /source/, its releases and HTTP clone store, by git and Python 3 ## Using it @@ -237,6 +238,24 @@ wherever it runs, so GitHub's and the website's agree. Once a release is out, `BOOT` may name it, and the next one is built by it: then `src/` may use what it brought. + +The website's [source browser](https://raz.lucelad.workers.dev/source/) +has the files, history and [release pages](https://raz.lucelad.workers.dev/source/releases/). +Each supported version has its compiler archive, a separate source +archive and SHA-256s. The same address is a git remote: + + git clone https://raz.lucelad.workers.dev/source/ + +`site/releases` records existing website distributions whose tags +are not pushed yet, so a plain `make site` keeps offering them. Both +the home page and ladle's release pages use this list. Existing +`download/` URLs and compiler archives keep their exact bytes. +[Building the site](site/README.md) gives the complete procedure. +`make site` runs ladle after building the normal pages and merges its +headers under `/source/`. The source output stays ignored; Wrangler's +build hook regenerates it before `npx wrangler deploy` uploads the +site. Commit the main pages, scripts and pinned builder, then push +`main` for the existing Cloudflare deployment. 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/README.md b/site/README.md new file mode 100644 index 0000000..b3ab1ba --- /dev/null +++ b/site/README.md @@ -0,0 +1,109 @@ +# Building raz's website + +`make site` builds the pages, tours, reports and downloads with +`build.py`, then the source browser and release pages with `source.py`. +The latter needs git and Python 3 on x86-64 Linux. Its pinned static +ladle executable is kept compressed under `tools/`, with a checksum +and build instructions. The helper verifies the compressed bytes, +unpacks it into `build/site/ladle` and runs it. No compiler or network +connection is needed with a full checkout. If a deployment service +clones shallowly, the helper first fetches the full history and tags +from that checkout's origin, using its existing repository access. + +The existing `/download/` URLs and archives stay as they are. Before +attaching an archive to a release, `source.py` checks its bytes against +the published checksum beside it. It fails if either is missing or +the sum differs; it never replaces that checksum to fit new bytes. + +## The source browser + +`source.py` makes a fresh bare clone of `main`, with its reachable +tags, using `--single-branch --no-local`. Other branches, reflogs and +unreachable tags are not published. The store is repacked with a +20 MiB target, and `git update-server-info` prepares it for cloning +over plain HTTP. The exported files are only `HEAD`, `info/refs`, +`objects/info/packs` and `objects/pack/`: no git configuration, hooks +or local paths. ladle writes the pages beside these files. + +The clone's committed tree is the source of every page. A detached +deployment checkout is supported too: the publishing service chooses +main, and the helper names its commit `main` only in the temporary +store. Uncommitted +files and the generated source site do not enter it. In particular, +`public/source/` must stay ignored: committing a source browser's own +output would publish a copy of the previous output on the next build. + +The result lives at `public/source/`, browsed and cloned at +. To build just this part, +after the normal downloads exist: + +```sh +make site-source +``` + +Or run `python3 site/source.py` directly. `--ladle /path/to/ladle` +overrides the bundled executable for development. `--url` may give +another absolute address ending in `/source/`, for +previewing the feeds and clone line. `source.theme` starts from +ladle's paper theme, with raz's page and link colours; ladle checks +its light and dark contrast when it runs. + +## Releases and downloads + +Each supported tag from `v0.7.1` onward gets its existing Linux +x86-64 compiler archive and a separate source archive of the tagged +commit. Source archives use `git archive` and gzip without a timestamp; +their names include the version, and they do not include submodules. +ladle writes each artifact's size and SHA-256 on its release page, +with a downloadable `.sha256` beside it. + +`releases` lists distributions whose tags have not yet been pushed: +one `vX.Y.Z FULL_COMMIT_HASH` per line, with `#` comments. The commit +must be on `main`'s first-parent line. A tag added later must name the +same commit; otherwise the build fails. Remove a manifest row only +after that tag exists. This records existing distributions; the site +build never creates tags or compiler releases. + +`release-notes/vX.Y.Z.md`, when present, supplies that version's notes. +Otherwise an annotated tag supplies them. The three untagged website +distributions have notes here that identify their pending tags. + +Both builders read this list through `releases.py`, so the home page +and source browser offer the same versions. An existing distribution +can also be given as `vX.Y.Z=COMMIT` on either helper's command line; +`make site RELEASES='vX.Y.Z=COMMIT'` passes it to both. Permanent +distributions belong in the manifest rather than a remembered command. + +## Headers and hosting + +ladle's header rules are prefixed with `/source` and merged into the +root `public/_headers` between marked comments. Rebuilding replaces +that block, preserving other root rules. Its general security policy +therefore applies only to `/source/*`, including raw files and git +objects. `source.py` never changes `_redirects`, so `/download/latest` +continues to work. Cloudflare reads the root header file; the nested +one is not enough. + +The new source tree is built in a temporary directory before replacing +the old one. The complete output is counted before it is installed: +at most 20,000 files, each at most 25 MiB. A 20 MiB pack target is not +a guarantee, since git may place a larger object in its own pack. +The final file check catches that too. No total-byte limit is assumed; +the build prints total bytes for review against the hosting plan. + +Before deploying, serve `public/` locally, clone `/source/` and run +`git fsck` in the clone. Download a compiler and its checksum from a +release page, check it, then unpack it and compile Hello. Repeat the +clone and download checks against the live address after deployment; +a local file server does not test Cloudflare's headers. + +`python3 site/check.py` checks release identity and ordering against +small real Git repositories, including shallow deployment checkouts, +and rejects a damaged bundled builder. `make check` remains the +compiler's required check before committing. + +The Wrangler configuration runs `make site-source` before deployment. +The usual `npx wrangler deploy` therefore generates the ignored source +browser from the committed repository before uploading the assets. +It uses the already generated main pages and distributions; it does +not run the compiler, pandoc or the tours on the deployment machine. diff --git a/site/build.py b/site/build.py index 785f691..15663ae 100644 --- a/site/build.py +++ b/site/build.py @@ -3,7 +3,8 @@ python3 site/build.py [vX.Y.Z=COMMIT ...] -Each vX.Y.Z=COMMIT is a release whose tag isn't pushed yet: it is +site/releases records website distributions whose tags are not pushed +yet. Each additional vX.Y.Z=COMMIT is another such distribution: it is offered as if the tag were at COMMIT, its tarball made by make dist with VERSION, the same tarball the tag will give. @@ -37,6 +38,7 @@ with raz on the path, and shown with what it printed. """ import hashlib, html, os, re, shutil, subprocess, sys, tempfile +from releases import refs HERE = os.path.dirname(os.path.abspath(__file__)) ROOT = os.path.dirname(HERE) @@ -237,6 +239,7 @@ ("tour", "tour/index.html", "Raz, Set, Go"), ("advanced", "advanced/index.html", "More Raz"), ("spec", "spec.html", "Report"), + ("source", "source/index.html", "Source"), ("get", "index.html#download", "Download")]) return """ @@ -260,10 +263,10 @@
%s
- + -""" % (html.escape(title), html.escape(title), SITE, up, up, up, up, up, up, nav, body) +""" % (html.escape(title), html.escape(title), SITE, up, up, up, up, up, up, nav, body, up) def write(path, text): path = os.path.join(OUT, path) @@ -335,12 +338,8 @@ 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(untagged): - """Every release's tarball from FIRST_RELEASE on, in public/download/ + """Every release's tarball from v0.7.1 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 @@ -349,20 +348,20 @@ made again: those before 0.14.0 were made before make dist made the same tarball each time, so a new one would differ, 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() releases = [] - tags = git("tag", "-l", "v*", "--sort=v:refname", "--contains", FIRST_RELEASE).split() - revs = [(tag, tag, []) for tag in tags] - revs += [(tag, rev, ["VERSION=" + tag[1:]]) for tag, rev in untagged if tag not in tags] - for tag, rev, version in revs: + for tag, rev in refs(ROOT, untagged): name = "raz-%s-linux-x86_64.tar.gz" % tag[1:] made = os.path.join(OUT, "download", name) if not os.path.exists(made): - subprocess.run(["make", "-s", "-C", ROOT, "dist", "REV=" + rev] + version, + subprocess.run(["make", "-s", "-C", ROOT, "dist", "REV=" + rev, "VERSION=" + tag[1:]], stdout=subprocess.DEVNULL, check=True) shutil.copy(os.path.join(ROOT, "build", name), made) digest = hashlib.sha256(open(made, "rb").read()).hexdigest() + checksum = made + ".sha256" + if os.path.exists(checksum): + expected = open(checksum, encoding="utf-8").read().split() + if not expected or expected[0] != digest: + sys.exit("release archive does not match its published checksum: " + made) 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 @@ -397,6 +396,10 @@ def main(): if not os.path.exists(RAZ): sys.exit("make raz first") + untagged = [a.split("=", 1) for a in sys.argv[1:]] + if not all(len(u) == 2 and re.fullmatch(r"v\d+\.\d+\.\d+", u[0]) for u in untagged): + sys.exit("usage: build.py [vX.Y.Z=COMMIT ...]") + refs(ROOT, untagged) # validate the release records before removing old pages # 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) @@ -427,9 +430,6 @@ build_spec() for pdf in ("raz.pdf", "raz-lib.pdf"): # made by make pdf shutil.copy(os.path.join(ROOT, "build", pdf), OUT) - untagged = [a.split("=", 1) for a in sys.argv[1:]] - if not all(len(u) == 2 and re.match(r"v\d+\.\d+\.\d+$", u[0]) for u in untagged): - sys.exit("usage: build.py [vX.Y.Z=COMMIT ...]") build_home(build_download(untagged)) print("site/public: %s lessons" % " + ".join(map(str, counts))) diff --git a/site/check.py b/site/check.py new file mode 100644 index 0000000..c536eb5 --- /dev/null +++ b/site/check.py @@ -0,0 +1,108 @@ +#!/usr/bin/env python3 +"""Check release selection with real git histories: python3 site/check.py. + +Uses Python's standard library and git. All repositories and downloads +are temporary; no release, working checkout or published file is changed. +""" + +from pathlib import Path +import subprocess +import tempfile +import unittest + +from releases import refs +import source + + +class Releases(unittest.TestCase): + def setUp(self): + self.temporary = tempfile.TemporaryDirectory() + self.addCleanup(self.temporary.cleanup) + self.directory = Path(self.temporary.name) + self.repo = self.directory / "repo" + self.repo.mkdir() + self.git("init", "--quiet", "--initial-branch=main") + (self.repo / "site").mkdir() + self.manifest = self.repo / "site/releases" + self.manifest.write_text("# distributions\n") + self.commits = [] + for number, version in enumerate(("v0.7.1", "v0.9.0", "v0.10.0")): + (self.repo / "file").write_text(str(number)) + self.git("add", ".") + self.git("commit", "--quiet", "-m", version) + self.commits.append(self.git("rev-parse", "HEAD")) + self.git("tag", version) + self.manifest.write_text(f"# not tagged yet\nv0.20.0 {self.commits[-1]}\n") + self.git("add", "site/releases") + self.git("commit", "--quiet", "-m", "record distribution") + + def git(self, *args, repo=None): + return subprocess.check_output([ + "git", "-C", str(repo or self.repo), "-c", "user.name=Test", + "-c", "user.email=test@example.org", "-c", "commit.gpgSign=false", *args, + ], text=True).strip() + + def test_numeric_tags_and_manifest(self): + self.assertEqual(refs(self.repo), list(zip( + ("v0.7.1", "v0.9.0", "v0.10.0", "v0.20.0"), + self.commits + [self.commits[-1]], + ))) + + def test_manifest_cannot_move_a_tag(self): + self.manifest.write_text(f"v0.9.0 {self.commits[0]}\n") + with self.assertRaisesRegex(ValueError, "disagree"): + refs(self.repo) + + def test_manifest_cannot_publish_another_line(self): + self.git("checkout", "--quiet", "-b", "side", self.commits[0]) + (self.repo / "side").write_text("a development branch\n") + self.git("add", "side") + self.git("commit", "--quiet", "-m", "side") + side = self.git("rev-parse", "HEAD") + self.git("checkout", "--quiet", "main") + self.manifest.write_text(f"v0.20.0 {side}\n") + with self.assertRaisesRegex(ValueError, "first-parent"): + refs(self.repo) + # A new tag must not override the recorded distribution, even + # when that tag would otherwise be skipped as off the main line. + self.manifest.write_text(f"v0.20.0 {self.commits[-1]}\n") + self.git("tag", "v0.20.0", side) + with self.assertRaisesRegex(ValueError, "disagree"): + refs(self.repo) + + def test_shallow_deploy_recovers_history_and_tags(self): + # A file URL uses git's transport, so --depth really is shallow. + clone = self.directory / "deploy" + self.git("clone", "--quiet", "--depth=1", "--branch=main", self.repo.as_uri(), str(clone)) + self.assertEqual(self.git("rev-parse", "--is-shallow-repository", repo=clone), "true") + self.assertEqual(refs(clone), refs(self.repo)) + self.assertEqual(self.git("rev-parse", "--is-shallow-repository", repo=clone), "false") + + def test_detached_shallow_deploy_needs_no_local_main(self): + clone = self.directory / "deploy" + self.git("clone", "--quiet", "--depth=1", "--branch=main", self.repo.as_uri(), str(clone)) + self.git("checkout", "--quiet", "--detach", repo=clone) + self.git("branch", "-D", "main", repo=clone) + self.assertEqual(refs(clone), refs(self.repo)) + original = source.ROOT + self.addCleanup(setattr, source, "ROOT", original) + source.ROOT = clone + store = source.prepare_store(self.directory) + self.assertEqual(self.git("rev-parse", "HEAD", repo=store), self.git("rev-parse", "HEAD", repo=clone)) + self.assertEqual(self.git("symbolic-ref", "HEAD", repo=store), "refs/heads/main") + self.git("fsck", "--strict", repo=store) + self.assertEqual(self.git("rev-parse", "--abbrev-ref", "HEAD", repo=clone), "HEAD") + + def test_modified_builder_is_rejected_before_unpacking(self): + packed = self.directory / "ladle.gz" + packed.write_bytes(b"not the published executable") + packed.with_name("ladle.gz.sha256").write_text("0" * 64 + " ladle.gz\n") + original = source.LADLE + self.addCleanup(setattr, source, "LADLE", original) + source.LADLE = packed + with self.assertRaisesRegex(ValueError, "recorded SHA-256"): + source.pinned_ladle() + + +if __name__ == "__main__": + unittest.main() diff --git a/site/content/home.html b/site/content/home.html index 6df71b6..dacd21e 100644 --- a/site/content/home.html +++ b/site/content/home.html @@ -7,6 +7,7 @@ More Raz Download Read the report + Browse the source @@ -85,3 +86,7 @@ good. Earlier releases: @EARLIER@; each has its SHA-256 beside it, with .sha256 added to its name.

SHA-256 @SHA256@

+

Release pages give each +version's commit, notes, compiler and source archives, with checksums. +Browse the source and history, or clone: +git clone https://raz.lucelad.workers.dev/source/.

diff --git a/site/public/_headers b/site/public/_headers new file mode 100644 index 0000000..deb5444 --- /dev/null +++ b/site/public/_headers @@ -0,0 +1,78 @@ + + +# BEGIN ladle source +/source/* + X-Content-Type-Options: nosniff + Content-Security-Policy: default-src 'none'; style-src 'self'; img-src 'self' https:; base-uri 'none'; form-action 'none'; frame-ancestors 'none' +/source/raw/* + Content-Type: text/plain; charset=utf-8 +/source/commit/*.patch + Content-Type: text/plain; charset=utf-8 +/source/feed.xml + Content-Type: application/atom+xml; charset=utf-8 +/source/releases.xml + Content-Type: application/atom+xml; charset=utf-8 +/source/objects/* + Content-Type: application/octet-stream + Cache-Control: public, max-age=31536000, immutable +/source/HEAD + Content-Type: text/plain; charset=utf-8 + Cache-Control: no-cache +/source/line + Content-Type: text/plain; charset=utf-8 + Cache-Control: no-cache +/source/info/refs + Content-Type: text/plain; charset=utf-8 + Cache-Control: no-cache +/source/objects/info/packs + ! Content-Type + ! Cache-Control + Content-Type: text/plain; charset=utf-8 + Cache-Control: no-cache +/source/releases/* + Content-Type: application/octet-stream +/source/releases/*.sha256 + ! Content-Type + Content-Type: text/plain; charset=utf-8 +/source/releases/index.html + ! Content-Type + Content-Type: text/html; charset=utf-8 +/source/releases/:version/index.html + ! Content-Type + Content-Type: text/html; charset=utf-8 +/source/releases/ + ! Content-Type + Content-Type: text/html; charset=utf-8 +/source/releases/:version/ + ! Content-Type + Content-Type: text/html; charset=utf-8 +/source/raw/*.png + ! Content-Type + Content-Type: image/png +/source/raw/*.jpg + ! Content-Type + Content-Type: image/jpeg +/source/raw/*.jpeg + ! Content-Type + Content-Type: image/jpeg +/source/raw/*.gif + ! Content-Type + Content-Type: image/gif +/source/raw/*.webp + ! Content-Type + Content-Type: image/webp +/source/raw/*.avif + ! Content-Type + Content-Type: image/avif +/source/raw/*.ico + ! Content-Type + Content-Type: image/x-icon +/source/raw/*.bmp + ! Content-Type + Content-Type: image/bmp +/source/raw/*.svg + ! Content-Type + Content-Type: image/svg+xml + ! Content-Security-Policy + Content-Security-Policy: default-src 'none'; style-src 'unsafe-inline'; img-src data:; font-src data:; sandbox; frame-ancestors 'none' +# END ladle source diff --git a/site/public/advanced/allocators.html b/site/public/advanced/allocators.html index 041c53e..42a1d92 100644 --- a/site/public/advanced/allocators.html +++ b/site/public/advanced/allocators.html @@ -16,7 +16,7 @@ -
+
- + diff --git a/site/public/advanced/asm.html b/site/public/advanced/asm.html index c1a8933..04432aa 100644 --- a/site/public/advanced/asm.html +++ b/site/public/advanced/asm.html @@ -16,7 +16,7 @@ -
+
- + diff --git a/site/public/advanced/atomics.html b/site/public/advanced/atomics.html index 73c0130..4268768 100644 --- a/site/public/advanced/atomics.html +++ b/site/public/advanced/atomics.html @@ -16,7 +16,7 @@ -
+
- + diff --git a/site/public/advanced/bytes.html b/site/public/advanced/bytes.html index dc0dd8a..ec23646 100644 --- a/site/public/advanced/bytes.html +++ b/site/public/advanced/bytes.html @@ -16,7 +16,7 @@ -
+
- + diff --git a/site/public/advanced/collections.html b/site/public/advanced/collections.html index 5bf9cd0..c7c3d47 100644 --- a/site/public/advanced/collections.html +++ b/site/public/advanced/collections.html @@ -16,7 +16,7 @@ -
+
- + diff --git a/site/public/advanced/files.html b/site/public/advanced/files.html index c7fbeeb..30d7ee3 100644 --- a/site/public/advanced/files.html +++ b/site/public/advanced/files.html @@ -16,7 +16,7 @@ -
+
- + diff --git a/site/public/advanced/fmt.html b/site/public/advanced/fmt.html index ecc677c..fbe8d1b 100644 --- a/site/public/advanced/fmt.html +++ b/site/public/advanced/fmt.html @@ -16,7 +16,7 @@ -
+
- + diff --git a/site/public/advanced/index.html b/site/public/advanced/index.html index c72d83c..956f9e8 100644 --- a/site/public/advanced/index.html +++ b/site/public/advanced/index.html @@ -16,7 +16,7 @@ -
+

More Raz

The second tour, for the part of raz that sits close to the machine. It @@ -55,6 +55,6 @@

  • A ring buffer between threads A single-producer, single-consumer queue, put together from what the tour has covered.
  • - + diff --git a/site/public/advanced/lifecycle.html b/site/public/advanced/lifecycle.html index aec5230..1521f54 100644 --- a/site/public/advanced/lifecycle.html +++ b/site/public/advanced/lifecycle.html @@ -16,7 +16,7 @@ -
    +
    - + diff --git a/site/public/advanced/linkstatic.html b/site/public/advanced/linkstatic.html index 78baefc..f2095c4 100644 --- a/site/public/advanced/linkstatic.html +++ b/site/public/advanced/linkstatic.html @@ -16,7 +16,7 @@ -
    +
    - + diff --git a/site/public/advanced/listing.html b/site/public/advanced/listing.html index 0e883ad..b7ec410 100644 --- a/site/public/advanced/listing.html +++ b/site/public/advanced/listing.html @@ -16,7 +16,7 @@ -
    +
    - + diff --git a/site/public/advanced/lockfree.html b/site/public/advanced/lockfree.html index 5ea1451..6ffff59 100644 --- a/site/public/advanced/lockfree.html +++ b/site/public/advanced/lockfree.html @@ -16,7 +16,7 @@ -
    +
    - + diff --git a/site/public/advanced/ordering.html b/site/public/advanced/ordering.html index 3e33b59..f0738cd 100644 --- a/site/public/advanced/ordering.html +++ b/site/public/advanced/ordering.html @@ -16,7 +16,7 @@ -
    +
    - + diff --git a/site/public/advanced/processes.html b/site/public/advanced/processes.html index 7dcebb7..aa84c78 100644 --- a/site/public/advanced/processes.html +++ b/site/public/advanced/processes.html @@ -16,7 +16,7 @@ -
    +
    - + diff --git a/site/public/advanced/ring.html b/site/public/advanced/ring.html index 1beaf09..dcef777 100644 --- a/site/public/advanced/ring.html +++ b/site/public/advanced/ring.html @@ -16,7 +16,7 @@ -
    +
    - + diff --git a/site/public/advanced/static.html b/site/public/advanced/static.html index 88d3162..3f8a8ad 100644 --- a/site/public/advanced/static.html +++ b/site/public/advanced/static.html @@ -16,7 +16,7 @@ -
    +
    - + diff --git a/site/public/advanced/syscalls.html b/site/public/advanced/syscalls.html index 8990a57..c4474b7 100644 --- a/site/public/advanced/syscalls.html +++ b/site/public/advanced/syscalls.html @@ -16,7 +16,7 @@ -
    +
    - + diff --git a/site/public/advanced/targets.html b/site/public/advanced/targets.html index 25adc32..202f7e0 100644 --- a/site/public/advanced/targets.html +++ b/site/public/advanced/targets.html @@ -16,7 +16,7 @@ -
    +
    - + diff --git a/site/public/advanced/volatile.html b/site/public/advanced/volatile.html index b661d20..9d9debf 100644 --- a/site/public/advanced/volatile.html +++ b/site/public/advanced/volatile.html @@ -16,7 +16,7 @@ -
    +
    - + diff --git a/site/public/index.html b/site/public/index.html index 97f3cbd..4fb339d 100644 --- a/site/public/index.html +++ b/site/public/index.html @@ -16,7 +16,7 @@ -
    +

    raz

    @@ -27,6 +27,7 @@ More Raz Download Read the report + Browse the source
    @@ -131,8 +132,12 @@ good. Earlier releases: 0.19.0, 0.18.1, 0.18.0, 0.17.2, 0.17.1, 0.17.0, 0.16.0, 0.15.0, 0.14.0, 0.13.0, 0.12.0, 0.11.1, 0.11.0, 0.10.1, 0.10.0, 0.9.1, 0.9.0, 0.8.0, 0.7.1; each has its SHA-256 beside it, with .sha256 added to its name.

    SHA-256 bfa954d27d759e4ca7f7f33debb4705f25d5c05a097d86aa28b3260048b5d9cc

    +

    Release pages give each +version's commit, notes, compiler and source archives, with checksums. +Browse the source and history, or clone: +git clone https://raz.lucelad.workers.dev/source/.

    - + diff --git a/site/public/spec.html b/site/public/spec.html index cb0cc39..223518e 100644 --- a/site/public/spec.html +++ b/site/public/spec.html @@ -16,7 +16,7 @@ -
    +

    Volume 1 as a PDF · Volume 2 as a PDF

      @@ -1465,6 +1465,6 @@

      A combining mark, a format character, a control and Hangul’s medial and final jamo take 0 columns; an ideograph, a kana, most emoji and the rest that Unicode calls East Asian Wide or Fullwidth take 2; every other character takes 1, the ambiguous ones among them, as most terminals draw them. These are the C library’s wcwidth’s answers, but for a control, which is -1 there. Width knows characters, not clusters: an emoji joined to another by a zero width joiner, or a flag, counts as its parts. Its tables, about 4 KB, come from Unicode’s data, made again by tools/Widths.raz for a new version of Unicode; a program that imports Width and calls neither procedure carries none of them.

    - + diff --git a/site/public/tour/c.html b/site/public/tour/c.html index ee3d498..e175cb4 100644 --- a/site/public/tour/c.html +++ b/site/public/tour/c.html @@ -16,7 +16,7 @@ -
    +
    - + diff --git a/site/public/tour/checks.html b/site/public/tour/checks.html index 7fe208e..bce3716 100644 --- a/site/public/tour/checks.html +++ b/site/public/tour/checks.html @@ -16,7 +16,7 @@ -
    +
    - + diff --git a/site/public/tour/defer.html b/site/public/tour/defer.html index 88a74a5..2bcd642 100644 --- a/site/public/tour/defer.html +++ b/site/public/tour/defer.html @@ -16,7 +16,7 @@ -
    +
    - + diff --git a/site/public/tour/errors.html b/site/public/tour/errors.html index 5d5209a..6727a45 100644 --- a/site/public/tour/errors.html +++ b/site/public/tour/errors.html @@ -16,7 +16,7 @@ -
    +
    - + diff --git a/site/public/tour/generics.html b/site/public/tour/generics.html index 26e8d83..67dd9e1 100644 --- a/site/public/tour/generics.html +++ b/site/public/tour/generics.html @@ -16,7 +16,7 @@ -
    +
    - + diff --git a/site/public/tour/hello.html b/site/public/tour/hello.html index 868e03d..2fe7db3 100644 --- a/site/public/tour/hello.html +++ b/site/public/tour/hello.html @@ -16,7 +16,7 @@ -
    +
    - + diff --git a/site/public/tour/index.html b/site/public/tour/index.html index cc2e3ec..2985c6b 100644 --- a/site/public/tour/index.html +++ b/site/public/tour/index.html @@ -16,7 +16,7 @@ -
    +

    Raz, Set, Go

    A tour of raz, in the spirit of A Tour of Go. Each lesson is one @@ -49,6 +49,6 @@

  • Threads Native threads without C, atomics, a mutex, and why the counter needs both.
  • - + diff --git a/site/public/tour/integers.html b/site/public/tour/integers.html index 91e36d1..b5157ba 100644 --- a/site/public/tour/integers.html +++ b/site/public/tour/integers.html @@ -16,7 +16,7 @@ -
    +
    - + diff --git a/site/public/tour/memory.html b/site/public/tour/memory.html index 9a7af67..ef809f0 100644 --- a/site/public/tour/memory.html +++ b/site/public/tour/memory.html @@ -16,7 +16,7 @@ -
    +
    - + diff --git a/site/public/tour/modules.html b/site/public/tour/modules.html index fc91246..551fe06 100644 --- a/site/public/tour/modules.html +++ b/site/public/tour/modules.html @@ -16,7 +16,7 @@ -
    +
    - + diff --git a/site/public/tour/procedures.html b/site/public/tour/procedures.html index aaa707f..953d471 100644 --- a/site/public/tour/procedures.html +++ b/site/public/tour/procedures.html @@ -16,7 +16,7 @@ -
    +
    - + diff --git a/site/public/tour/records.html b/site/public/tour/records.html index c067482..a580507 100644 --- a/site/public/tour/records.html +++ b/site/public/tour/records.html @@ -16,7 +16,7 @@ -
    +
    - + diff --git a/site/public/tour/slices.html b/site/public/tour/slices.html index 8d17bd6..cedbd14 100644 --- a/site/public/tour/slices.html +++ b/site/public/tour/slices.html @@ -16,7 +16,7 @@ -
    +
    - + diff --git a/site/public/tour/threads.html b/site/public/tour/threads.html index 9077fb0..f0daf89 100644 --- a/site/public/tour/threads.html +++ b/site/public/tour/threads.html @@ -16,7 +16,7 @@ -
    +
    - + diff --git a/site/public/tour/values.html b/site/public/tour/values.html index 9c81e35..4b40f62 100644 --- a/site/public/tour/values.html +++ b/site/public/tour/values.html @@ -16,7 +16,7 @@ -
    +
    - + diff --git a/site/public/tour/variants.html b/site/public/tour/variants.html index 5b722a3..83daac1 100644 --- a/site/public/tour/variants.html +++ b/site/public/tour/variants.html @@ -16,7 +16,7 @@ -
    +
    - + diff --git a/site/release-notes/v0.18.1.md b/site/release-notes/v0.18.1.md new file mode 100644 index 0000000..0533ca6 --- /dev/null +++ b/site/release-notes/v0.18.1.md @@ -0,0 +1,8 @@ +# raz 0.18.1 + +Report 2026-10.32. A constant's slice part may name another module's +array constant. The library adds `Buf.cut`, `Out.lines`, `Vec.pop`, +`Sys.Info.links`, `Thread.signal` and more command-line option helpers. + +This is the existing website distribution. Its annotated Git tag is +pending; the commit and compiler archive are unchanged. diff --git a/site/release-notes/v0.19.0.md b/site/release-notes/v0.19.0.md new file mode 100644 index 0000000..363d59a --- /dev/null +++ b/site/release-notes/v0.19.0.md @@ -0,0 +1,9 @@ +# raz 0.19.0 + +Report 2026-10.33. Adds `const` parameters and variants in constants. +The library takes `var`, `const` or a value where it previously took +a pointer; calls written with `ADR` need updating. The compiler's +message points to the required change. + +This is the existing website distribution. Its annotated Git tag is +pending; the commit and compiler archive are unchanged. diff --git a/site/release-notes/v0.20.0.md b/site/release-notes/v0.20.0.md new file mode 100644 index 0000000..b3ce543 --- /dev/null +++ b/site/release-notes/v0.20.0.md @@ -0,0 +1,9 @@ +# raz 0.20.0 + +Report 2026-10.34. Adds `PTR(s)`, the unchecked address of a slice's +first element, including an empty slice. The compiler is built by raz +0.19.0, and the Pascal seed leaves the current tree. `Buf.bytes` and +`Sys.entryKind` take `const` parameters. + +This is the existing website distribution. Its annotated Git tag is +pending; the commit and compiler archive are unchanged. diff --git a/site/releases b/site/releases new file mode 100644 index 0000000..daac064 --- /dev/null +++ b/site/releases @@ -0,0 +1,5 @@ +# Existing distributions whose tags have not yet been pushed. +# Keep these identities when their tags are added. +v0.18.1 88b18ba640f341da2f4d7c6a6941b2e13cb29190 +v0.19.0 51a90a630cbd3b2e3b4634d72b3568edcc476dc4 +v0.20.0 086e55c439e4b2e38e8b3f062da8f9d5703054ce diff --git a/site/releases.py b/site/releases.py new file mode 100644 index 0000000..ab03f77 --- /dev/null +++ b/site/releases.py @@ -0,0 +1,80 @@ +"""Release commits shared by the home page and ladle's download pages. + +Tags supply released versions. site/releases records existing website +distributions whose tags have not been pushed. Both must name commits +on main's first-parent line, and a later tag must agree with the record. +No tags or archives are created here. +""" +from pathlib import Path +import re +import subprocess + + +def main_ref(root): + """Use main locally, or the detached commit supplied to a deployment. + + A build never silently publishes a different local working branch. + The publishing service selects main before checking out its commit. + """ + command = ['git', '-C', str(root)] + if subprocess.run(command + ['show-ref', '--verify', '--quiet', 'refs/heads/main']).returncode == 0: + return 'refs/heads/main' + if subprocess.run(command + ['symbolic-ref', '--quiet', 'HEAD'], stdout=subprocess.DEVNULL).returncode: + return 'HEAD' + raise ValueError('site build needs main or a detached deployment checkout') + + +def refs(root, extra=()): + """Return (version tag, full commit) pairs, oldest first. + + extra holds the optional vX.Y.Z=COMMIT arguments to make site, + already split into pairs. Conflicting records are errors, so a + build cannot quietly move an existing version to another commit. + """ + root = Path(root) + + def git(*args): + return subprocess.check_output(['git', '-C', str(root), *args], text=True).strip() + + # Deployment services may give the build only one commit. The source + # browser needs the history, and the same origin supplies its tags. + if git('rev-parse', '--is-shallow-repository') == 'true': + print('site: fetching full history and tags from origin') + subprocess.run(['git', '-C', str(root), 'fetch', '--unshallow', '--tags', 'origin'], check=True) + line = set(git('rev-list', '--first-parent', main_ref(root)).splitlines()) + selected = {} + tagged = {} + + def add(tag, rev): + if not re.fullmatch(r'v\d+\.\d+\.\d+', tag): + raise ValueError('release version must be vX.Y.Z: ' + tag) + if tuple(map(int, tag[1:].split('.'))) < (0, 7, 1): + return + commit = git('rev-parse', '--verify', '--end-of-options', rev + '^{commit}') + if commit not in line: + raise ValueError(f'release {tag}: {commit} is not on main\'s first-parent line') + if tag in tagged and tagged[tag] != commit: + raise ValueError(f'release {tag}: tag and recorded commits disagree') + if tag in selected and selected[tag] != commit: + raise ValueError(f'release {tag}: tag and recorded commits disagree') + selected[tag] = commit + + for tag in git('tag', '-l', 'v*').splitlines(): + if re.fullmatch(r'v\d+\.\d+\.\d+', tag): + # Tags on another development line are not this site's releases. + commit = git('rev-parse', '--verify', tag + '^{commit}') + tagged[tag] = commit + if commit in line: + add(tag, commit) + manifest = root / 'site' / 'releases' + for number, text in enumerate(manifest.read_text().splitlines(), 1): + text = text.partition('#')[0].strip() + if not text: + continue + words = text.split() + if len(words) != 2 or not re.fullmatch(r'[0-9a-f]{40}', words[1]): + raise ValueError(f'{manifest}:{number}: expected vX.Y.Z and full commit hash') + add(*words) + for tag, rev in extra: + add(tag, rev) + return sorted(selected.items(), key=lambda item: tuple(map(int, item[0][1:].split('.')))) diff --git a/site/source.py b/site/source.py new file mode 100644 index 0000000..6b34b2e --- /dev/null +++ b/site/source.py @@ -0,0 +1,238 @@ +#!/usr/bin/env python3 +"""Build the static source browser and releases after site/build.py. + +Uses git, ladle and Python's standard library. Reads committed main and +the existing, checksummed compiler distributions; writes only the website. +It does not build compilers, create tags, upload files or deploy the site. +The layout and publishing rules are in site/README.md. +""" + +import argparse +import gzip +import hashlib +from pathlib import Path +import re +import shutil +import subprocess +import tempfile +from urllib.parse import urlsplit + +from releases import main_ref, refs + + +ROOT = Path(__file__).resolve().parent.parent +PUBLIC = ROOT / "site/public" +URL = "https://raz.lucelad.workers.dev/source/" +LADLE = ROOT / "site/tools/ladle.gz" +BEGIN_HEADERS = "# BEGIN ladle source\n" +END_HEADERS = "# END ladle source\n" +MAX_FILES = 20000 +MAX_FILE_BYTES = 25 * 1024 * 1024 + + +def git(repo, *args): + """Read git's text output, failing at the command that went wrong.""" + return subprocess.check_output( + ["git", "-C", str(repo), *args], text=True + ).strip() + + +def prepare_store(directory): + """Clone main independently, keeping only tags whose commits it reaches.""" + store = directory / "raz.git" + branch = ["--branch", "main"] if main_ref(ROOT) != "HEAD" else [] + subprocess.run([ + "git", "clone", "--quiet", "--bare", "--single-branch", + "--no-local", *branch, str(ROOT), str(store), + ], check=True) + # Deployment checkouts can be detached and have no local branch. + # Name their commit only inside this temporary published store. + if not branch: + git(store, "update-ref", "refs/heads/main", git(store, "rev-parse", "HEAD")) + git(store, "symbolic-ref", "HEAD", "refs/heads/main") + reachable = set(git(store, "rev-list", "main").splitlines()) + for tag in git(store, "tag", "--list").splitlines(): + # Tags of trees or blobs are not cloneable releases. Ask quietly: + # such a tag is valid git, simply outside the published history. + result = subprocess.run( + ["git", "-C", str(store), "rev-parse", "--verify", f"refs/tags/{tag}^{{commit}}"], + capture_output=True, text=True, + ) + if result.returncode or result.stdout.strip() not in reachable: + git(store, "update-ref", "-d", f"refs/tags/{tag}") + git(store, "repack", "-a", "-d", "--max-pack-size=20m") + git(store, "update-server-info") + return store + + +def digest(path): + checksum = hashlib.sha256() + with path.open("rb") as stream: + for chunk in iter(lambda: stream.read(1024 * 1024), b""): + checksum.update(chunk) + return checksum.hexdigest() + + +def published_sum(path): + """Read the original checksum; never replace it to fit different bytes.""" + checksum = path.with_name(path.name + ".sha256") + words = checksum.read_text().split() + if len(words) != 2 or not re.fullmatch(r"[0-9a-f]{64}", words[0]) or words[1] != path.name: + raise ValueError(f"{checksum}: expected SHA-256 and {path.name}") + return words[0] + + +def pinned_ladle(): + """Unpack the checked-in static builder, needing no compiler or network.""" + packed = LADLE.read_bytes() + if hashlib.sha256(packed).hexdigest() != published_sum(LADLE): + raise ValueError(f"{LADLE}: differs from its recorded SHA-256") + executable = ROOT / "build/site/ladle" + executable.parent.mkdir(parents=True, exist_ok=True) + # Rename a new inode into place: another build may still be running + # the previous executable, which cannot be overwritten on Linux. + with tempfile.NamedTemporaryFile(dir=executable.parent, delete=False) as output: + temporary = Path(output.name) + output.write(gzip.decompress(packed)) + temporary.chmod(0o755) + temporary.replace(executable) + return executable + + +def compiler_archive(version, directory): + """Copy the distribution, checking its existing published checksum.""" + name = f"raz-{version[1:]}-linux-x86_64.tar.gz" + original = PUBLIC / "download" / name + expected = published_sum(original) + copied = directory / name + shutil.copyfile(original, copied) + if digest(copied) != expected: + raise ValueError(f"{original}: differs from its published SHA-256") + + +def source_archive(store, version, commit, directory): + """Archive the exact commit, with no wall-clock time or filename in gzip.""" + name = f"raz-{version[1:]}-source.tar.gz" + with (directory / name).open("wb") as output: + with gzip.GzipFile(filename="", mode="wb", fileobj=output, mtime=0) as compressed: + with subprocess.Popen([ + "git", "-C", str(store), "archive", "--format=tar", + f"--prefix=raz-{version[1:]}/", commit, + ], stdout=subprocess.PIPE) as process: + shutil.copyfileobj(process.stdout, compressed) + if process.wait(): + raise ValueError(f"release {version}: git archive failed") + + +def stage_releases(store, directory, selected): + line = set(git(store, "rev-list", "--first-parent", "main").splitlines()) + for version, commit in selected: + # Ref resolution is shared with build.py. Check against our snapshot + # too, so a commit made during the build cannot split their histories. + if commit not in line: + raise ValueError(f"release {version}: {commit} is not in the cloned main history") + release = directory / version + release.mkdir(parents=True) + (release / "commit").write_text(commit + "\n") + notes = ROOT / "site/release-notes" / (version + ".md") + if notes.exists(): + shutil.copyfile(notes, release / "notes.md") + compiler_archive(version, release) + source_archive(store, version, commit, release) + + +def export_store(store, output): + """Export only the dumb-HTTP store, never configuration or local paths.""" + for name in ("HEAD", "info/refs", "objects/info/packs"): + destination = output / name + destination.parent.mkdir(parents=True, exist_ok=True) + shutil.copyfile(store / name, destination) + shutil.copytree(store / "objects/pack", output / "objects/pack") + + +def merged_headers(generated): + """Replace our scoped block while keeping the host's other header rules.""" + path = PUBLIC / "_headers" + existing = path.read_text() if path.exists() else "" + if BEGIN_HEADERS in existing: + before, _, rest = existing.partition(BEGIN_HEADERS) + _, found, after = rest.partition(END_HEADERS) + if not found: + raise ValueError(f"{path}: source header block has no closing marker") + existing = before + after + scoped = "\n".join( + "/source" + line if line.startswith("/") else line + for line in generated.splitlines() + ) + "\n" + return existing.rstrip() + "\n\n" + BEGIN_HEADERS + scoped + END_HEADERS + + +def check_limits(source, headers): + """Measure the proposed complete output, counting the new source tree once.""" + paths = [path for path in PUBLIC.rglob("*") + if path.is_file() and "source" != path.relative_to(PUBLIC).parts[0] + and path != PUBLIC / "_headers"] + paths.extend(path for path in source.rglob("*") if path.is_file()) + sizes = [(str(path), path.stat().st_size) for path in paths] + sizes.append((str(PUBLIC / "_headers"), len(headers.encode()))) + for name, size in sizes: + if size > MAX_FILE_BYTES: + raise ValueError(f"{name}: {size} bytes exceeds the 25 MiB file limit") + if len(sizes) > MAX_FILES: + raise ValueError(f"site: {len(sizes)} files exceeds the {MAX_FILES} file limit") + print(f"site/public: {len(sizes)} files, {sum(size for _, size in sizes)} bytes; " + f"largest file {max(size for _, size in sizes)} bytes") + + +def build(ladle=None, url=URL, extra=()): + address = urlsplit(url) + if address.scheme not in ("http", "https") or not address.netloc or address.path != "/source/" or address.query or address.fragment: + raise ValueError("--url must be an HTTP(S) address ending in /source/") + if not PUBLIC.is_dir(): + raise ValueError("site/public is missing; run site/build.py first") + selected = refs(ROOT, extra) # complete a shallow deployment checkout before cloning + if ladle is None: + ladle = pinned_ladle() + # Build separately: a failed checksum, ladle run or host-limit check + # leaves the previous source browser in place. Nothing reads that output. + with tempfile.TemporaryDirectory(prefix="raz-source-") as temporary: + directory = Path(temporary) + store = prepare_store(directory) + releases = directory / "releases" + stage_releases(store, releases, selected) + output = directory / "source" + output.mkdir() + export_store(store, output) + subprocess.run([ + str(ladle), "-u", url, "-r", str(releases), + "-t", str(ROOT / "site/source.theme"), "-o", str(output), str(store), + ], check=True) + headers = merged_headers((output / "_headers").read_text()) + check_limits(output, headers) + destination = PUBLIC / "source" + if destination.exists(): + shutil.rmtree(destination) + shutil.move(str(output), destination) + (PUBLIC / "_headers").write_text(headers) + + +def main(): + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument("--ladle", type=Path, help="override the checked-in static ladle executable") + parser.add_argument("--url", default=URL, help="the site's absolute /source/ address") + parser.add_argument("releases", nargs="*", metavar="vX.Y.Z=COMMIT", help="additional existing distributions") + args = parser.parse_args() + try: + extra = [] + for release in args.releases: + version, separator, commit = release.partition("=") + if not separator or not commit: + raise ValueError(f"{release}: expected vX.Y.Z=COMMIT") + extra.append((version, commit)) + build(args.ladle.resolve() if args.ladle else None, args.url, extra) + except (OSError, ValueError, subprocess.CalledProcessError) as error: + parser.exit(1, f"source: {error}\n") + + +if __name__ == "__main__": + main() diff --git a/site/source.theme b/site/source.theme new file mode 100644 index 0000000..663c798 --- /dev/null +++ b/site/source.theme @@ -0,0 +1,13 @@ +base paper +light +bg #fbfaf7 +fg #1b1b1a +muted #6b6a66 +accent #b4401f +link #b4401f +dark +bg #17181a +fg #e6e4de +muted #9a988f +accent #ee8a63 +link #ee8a63 diff --git a/site/tools/README.md b/site/tools/README.md new file mode 100644 index 0000000..5e5e64a --- /dev/null +++ b/site/tools/README.md @@ -0,0 +1,34 @@ +# The website's ladle + +`ladle.gz` is the static x86-64 Linux executable built from +`ldiaz94/ladle` at `509b9d314f6161a7430b8dc1354ba4ebe203ddb8`. +Its pinned dependencies are sauce `35e0c186db6b8861745c25925ca5b2489219e48d` +and rflate `c55b37888b071e98f57dcf18b97ab31f85595e76`. +`ladle.gz.sha256` checks the compressed file; `source.py` verifies it +before unpacking the executable into `build/site/`. + +Keeping this small build tool with the site lets Cloudflare run the +existing `npx wrangler deploy` without a compiler or access to another +private repository. It is a deployment dependency, not a raz release. +Its source and tests remain in ladle's repository. + +To replace it, clone ladle with its submodules and check out the +chosen commit. Unpack raz's checked v0.20.0 distribution, keeping its +`lib/` and `tools/` beside `raz`. From ladle's checkout: + +```sh +make RAZ=/absolute/path/to/raz test fmt +``` + +From raz's checkout, pack that tested executable: + +```sh +gzip -9n -c ../ladle/build/ladle > site/tools/ladle.gz +(cd site/tools && sha256sum ladle.gz > ladle.gz.sha256) +make site-source +``` + +Record the new commit and dependency pins here in the same change. +The executable includes debugging paths from its build directory; +another build may have a different checksum. The checksum pins this +tested artifact. Gzip adds neither a filename nor a wall-clock time. diff --git a/site/tools/ladle.gz b/site/tools/ladle.gz new file mode 100644 index 0000000..2cebe5d Binary files /dev/null and b/site/tools/ladle.gz differ diff --git a/site/tools/ladle.gz.sha256 b/site/tools/ladle.gz.sha256 new file mode 100644 index 0000000..ff8316b --- /dev/null +++ b/site/tools/ladle.gz.sha256 @@ -0,0 +1 @@ +c7827e119e82bcc2facb8bcef555556351a84b43b4cc9c466df09ebfa8af92ef ladle.gz diff --git a/wrangler.jsonc b/wrangler.jsonc index a085356..bb647d2 100644 --- a/wrangler.jsonc +++ b/wrangler.jsonc @@ -1,7 +1,9 @@ { // Cloudflare: serves site/public/ (made by make site) as static files. - // The dashboard's deploy command is "npx wrangler deploy"; no build. + // The dashboard's deploy command stays "npx wrangler deploy". This + // hook generates /source/ from main before assets are uploaded. "name": "raz", "compatibility_date": "2026-10-01", + "build": { "command": "make site-source" }, "assets": { "directory": "./site/public" } }