Repository navigation
ci: Port the zccache installer to Python (#962) - #2606
Conversation
9865f0d to
849e15c
Compare
849e15c to
070817d
Compare
|
Rebased onto Conflicts: Adapted to #2605 (
Verified after the rebase (
Re-queued. PR CI runs fresh against |
zackees
left a comment
There was a problem hiding this comment.
Review of the rebased head 070817dbd.
Verdict: correct, and it now survives the rebase's neighbours.
- The port itself is a straight translation of
install-zccache.sh: pinned version + SHA-256 check,--versionverification, install into the given bin dir.ci/test_zccache.pypins the SHA mismatch, the missing-binary and the success paths, which is the RED→GREEN pair the policy asks for. - Every call site is updated in the same PR:
.github/workflows/build-project.yaml(both sites),.github/scripts/utils.zsh/setup_zccache,build-aux/appimage/manylinux/Dockerfile,rust/tools/linux-validate/Dockerfile,.dockerignoreanddocs/ci-tooling.md.git grep install-zccache.shreturns only test assertions that its absence is the point. - The
GEN-005exception is removed, so this burns down a unit rather than adding a second exception. - No
docs/features.mdline: CI tooling, not user-visible. - The one thing the author could not have seen when writing this — #2605 ported
sanitize.shtosanitize.pyand itsprepare_toolchain()still raninstall-zccache.sh— is fixed in the rebase (see my comment above):sanitize.pynow runsinstall_zccache.pythroughuv run --no-project, and the wiring test asserts that instead of reading a file that no longer exists.
Verified on the rebased head: uv run python -m unittest ci.test_zccache ci.test_dockerignore_copies ci.test_ported_sources ci.test_ci_toml ci.test_uv_run ci.test_sanitize_harness → 62 tests OK; ruff check clean on both touched Python files; git diff origin/master --stat holds only this PR's files.
Queued. PR CI is the gate for the container/AppImage lanes I cannot run here.
The zccache installer is being ported from install-zccache.sh to install_zccache.py. This changes ci/test_zccache.py to read the Python module, to assert the Python port's shapes (a pinned ZCCACHE_VERSION, two SHA-256 digests, hashlib.sha256) and to pin the wiring: the shell script is gone, ci.toml keeps no GEN-005 exception for it, and every caller (Dockerfiles, .dockerignore, setup_zccache, build-project.yaml, sanitize.sh) runs the Python through uv run. A new PortTest exercises the port offline: the arch map (and the unsupported-arch failure), the archive digest, and the already-installed early return. RED: uv run python -m unittest ci/test_zccache.py -> 9 failures, 8 errors (install_zccache.py does not exist yet; the Dockerfile and the other callers still name install-zccache.sh).
install-zccache.sh (38 lines) installs the pinned zccache 1.15.5 static-musl release into a destination dir, mapping uname -m x86_64/amd64 and aarch64/arm64 to their pinned SHA-256, returning early when the installed binary already reports the version, and failing on any other arch. install_zccache.py is a faithful port: same version, same two digests, same messages and exit codes. The download keeps curl's retry, the digest is checked before install, the binary lands at mode 0755, and the final step prints --version. The arch map, digest and installed-check are exercised offline by ci/test_zccache.py. Every caller now runs the Python through uv (TOOL-003): - rust/tools/linux-validate/Dockerfile (uv run --no-project --python /usr/bin/python3, uv is already in the image) - build-aux/appimage/manylinux/Dockerfile (uv arrives later in that Dockerfile, so the manylinux interpreter runs it) - .github/scripts/utils.zsh/setup_zccache and both build-project.yaml steps (uv run --no-project) - rust/tools/sanitize/sanitize.sh (uv run --no-project) - .dockerignore lists the .py; the GEN-005 exception for the .sh is gone from ci.toml, and docs/ci-tooling.md names install_zccache.py. No docs/features.md line: a pure tooling port with no user-visible change. GREEN: uv run python -m unittest ci/test_zccache.py -> 22 tests, OK; ci.test_uv_run, ci.test_dockerignore_copies and ci.test_tool_guard -> OK; ./lint -> ok (its ci/test_local_gate_probe and test_gate_dylint failures were this shell's empty CARGO_TARGET_DIR, gone with it unset).
070817d to
bf8777f
Compare
Part of the #962 GEN-005 burn-down: port one shell script per PR to Python and delete its
ci.tomlexception.Refs #962 (one unit of a burn-down; no user-visible change, so no
docs/features.mdline).Unit
rust/tools/linux-validate/install-zccache.sh(38 lines) ->rust/tools/linux-validate/install_zccache.py.The installer downloads the pinned zccache 1.15.5 static-musl release into a destination dir (default
~/.local/bin), mappinguname -mx86_64/amd64andaarch64/arm64to their pinned SHA-256, returns early when$dest/zccachealready reportszccache 1.15.5, and fails on any other arch. The Python port keeps the same pinned version, the same two digests, the same messages and exit codes (unsupported arch -> stderr + exit 1; a bad digest -> stderr + exit 1), keepscurl --retry 3's retry, checks the digest before installing, installs at mode 0755 and prints--versionlast.RED
test: Point the zccache installer test at the Python port (#962)—5cdc40d85083cde79b99923fcacf5ca852aa9e48.ci/test_zccache.pyis repointed at the Python module and its wiring, and a newPortTestexercises the port offline (arch map, unsupported arch, digest, the already-installed early return). At that commit:The errors are
FileNotFoundError/load_module(install_zccache.pydoes not exist yet); the failures are the DockerfileCOPY install_zccache.pyassertion and the wiring checks, because the Tier 2 Dockerfile, the manylinux Dockerfile,.dockerignore,setup_zccache,build-project.yaml,sanitize.shandci.tomlstill nameinstall-zccache.sh.GREEN
ci: Port the zccache installer to Python (#962)—849e15c4ec3f3834a15b77e71bbdee96d55c684c.Callers now run the Python through uv (TOOL-003):
rust/tools/linux-validate/Dockerfile(uv run --no-project --python /usr/bin/python3) and.github/scripts/utils.zsh/setup_zccache, bothbuild-project.yamlsteps andrust/tools/sanitize/sanitize.sh(uv run --no-project). The manylinux Dockerfile installs uv after that step, so it runs the script with the image's own/opt/python/cp312-cp312/bin/python3..dockerignorelists the.py; the GEN-005 exception for the.shis deleted fromci.toml;docs/ci-tooling.mdnamesinstall_zccache.py. The.shis deleted, not left as a shim.Runner note: the first
./lintin my shell failed only onci/test_local_gate_probeandci/test_gate_dylint, both from aCARGO_TARGET_DIR=''this environment exports; with it unset./lintis fully green.Rebased onto origin/master (
c2a9d135e, after #2596-#2598 landed) so the PR is conflict-free; theci.tomlconflict was resolved by keeping master's exception list minus theinstall-zccache.shblock. The RED/GREEN SHAs above are the rebased ones.