feat(packages): add package updaters#249
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces Python-based update scripts for several packages, including azd, brave-origin, gitlawb, malimite, and opendirectorydownloader, replacing older shell scripts or adding new automation. The corresponding Nix expressions are updated to link these scripts via passthru.updateScript. Feedback across all new update scripts highlights a maintainability issue where URL strings are hardcoded in rendering functions, duplicating the structure of existing URL templates; reviewers suggest deriving these strings directly from the templates to ensure consistency.
Expose packages/azd/update.py through passthru.updateScript so azd can refresh azure-dev-cli_<version> releases and the Linux asset hashes from GitHub. The updater rewrites the downloads attrset for azd-linux-amd64.tar.gz and azd-linux-arm64.tar.gz. Validation: not run. User confirmed validation and testing were already completed before this commit flow.
Replace the shell updater with packages/brave-origin/update.py so the generated expression and passthru.updateScript use the same Python updater pattern as the other package updaters. The updater keeps x86_64-linux as the required brave-origin-nightly asset and rewrites available Linux and Darwin archives. Validation: not run. User confirmed validation and testing were already completed before this commit flow.
Expose packages/gitlawb/update.py through passthru.updateScript and make the release archive metadata an updater-owned attrset. The updater follows the v<version> Gitlawb release tags and rewrites the x86_64-linux musl archive hash. Validation: not run. User confirmed validation and testing were already completed before this commit flow.
Expose packages/malimite/update.py through passthru.updateScript and make the Malimite archive name and JAR name derive from version. The updater follows the numeric release tag, rewrites archives.linux, and refreshes the fetchzip hash. Validation: not run. User confirmed validation and testing were already completed before this commit flow.
Expose packages/opendirectorydownloader/update.py through passthru.updateScript so the package can refresh v<version> release archives. The updater checks both Linux self-contained ZIP assets and rewrites the downloads attrset hashes. Validation: not run. User confirmed validation and testing were already completed before this commit flow.
9c4a348 to
b696053
Compare
Generated Nix URLs now come from each updater URL template, so the prefetch path and rendered default.nix path cannot drift when an upstream download URL changes. This also removes the unused azd required_assets version argument, which made call sites look version-sensitive even though ASSET_NAMES is static. Validation: uv run python -m py_compile packages/azd/update.py packages/brave-origin/update.py packages/gitlawb/update.py packages/malimite/update.py packages/opendirectorydownloader/update.py Validation: uv run python - <<PY render checks passed PY Validation: nix fmt -- packages/azd/update.py packages/brave-origin/update.py packages/gitlawb/update.py packages/malimite/update.py packages/opendirectorydownloader/update.py
brave-origin now matches the other Python updaters in this PR. It skips archive hash prefetches when the packaged version already matches upstream, while --force keeps the explicit path for recomputing unchanged release assets. Dry runs now print the unified diff that would be written to default.nix instead of a summary line, so review does not require mutating the file. Validation: nix fmt -- packages/brave-origin/update.py Validation: uv run python -m py_compile packages/brave-origin/update.py Validation: uv run python - <<PY brave behavior checks passed PY
Fetchzip-style package updaters now use calculate_platform_hashes with unpack=True, so Malimite and OpenDirectoryDownloader share the same parallel prefetch path as the other platform updaters. The helper forwards unpack to calculate_url_hash, preserving the existing default for archive fetches while adding the explicit unpacked mode needed by fetchzip sources. Validation: nix fmt -- scripts/updater/platforms.py packages/malimite/update.py packages/opendirectorydownloader/update.py Validation: uv run python -m py_compile scripts/updater/platforms.py packages/malimite/update.py packages/opendirectorydownloader/update.py Validation: PYTHONPATH=scripts uv run python - <<PY platform unpack checks passed PY Validation: rg -n "calculate_fetchzip|calculate_url_hash" packages/malimite/update.py packages/opendirectorydownloader/update.py scripts/updater/platforms.py
|
Addressed the review feedback locally in three commits. Approved and implemented:
Rejected: none. Reliability impact: the accepted changes keep prefetch and render paths tied to the same templates, avoid unnecessary network and Nix prefetch work on unchanged brave-origin releases, preserve an explicit force path for upstream asset re-uploads, and centralize unpacked hash calculation in the shared updater helper. Validation performed:
|
The packaged 3.5.0.6 archive set should only expose the linux-x64 self-contained zip. Removing downloads.aarch64-linux keeps meta.platforms derived from the remaining archive and makes non-x86 hosts fail through the existing unsupported-system lookup. Validation: - nix-instantiate --parse packages/opendirectorydownloader/default.nix - git diff --cached --check -- packages/opendirectorydownloader/default.nix - nix eval --accept-flake-config --json \ .#nixosConfigurations.system76.pkgs.opendirectorydownloader.meta.platforms - aarch64-linux src eval failed with "opendirectorydownloader: unsupported system aarch64-linux"
azd moves to 1.25.1 and brave-origin moves to 1.92.67 with refreshed source hashes. tweakcc moves to upstream commit 7a72cb14d253, dated unstable-2026-05-16. Piebald-AI/tweakcc now ships a pnpm-workspace.yaml without a packages entry, which makes fetchPnpmDeps fail with "packages field missing or empty". Removing that stale workspace file in postPatch lets the root lockfile importer drive dependency hash generation again. Validation: - nix-instantiate --parse packages/azd/default.nix packages/brave-origin/default.nix packages/brave-origin/make-brave.nix packages/tweakcc/package.nix - jq empty packages/tweakcc/hashes.json - uv run python -m py_compile packages/brave-origin/update.py - git diff --check
The automated review flagged that check_assets still accepted version after
required_assets stopped using it. Dropping the parameter keeps both call sites
honest and removes the dead argument from release validation.
Validation:
- nix fmt -- packages/azd/update.py
- uv run python -m py_compile packages/azd/update.py
- rg -n "check_assets\(|def check_assets|required_assets\(" packages/azd/update.py
This comment has been minimized.
This comment has been minimized.
|
Addressed the new automated review finding in commit e547c3d. Approved and implemented:
Rejected: none. Reliability impact: release asset validation now has a single accurate function contract, so future updater changes do not carry misleading dead arguments through the release-selection path. Validation performed:
|
Summary
Test plan