repomatic.tooling.checksums module

Recompute SHA-256 checksums for the binary tool registry.

Downloads the release artifact of each platform of the binary tools, and rewrites stale hashes in place in tooling/registry.py (alongside the VERSIONS stamps). repomatic update-checksums verifies every binary tool. sync-tool-versions passes the tools it bumped, with their new versions, so a version bump and its matching checksums land in one pass.

Before a digest is recorded, the download of a tool whose upstream attests its releases is verified against that attestation: see Attestation. A failed verification aborts the run like a failed download, and nothing is rewritten.

exception repomatic.tooling.checksums.AttestationError[source]

Bases: RuntimeError

A release asset whose upstream attestation did not verify.

repomatic.tooling.checksums.verify_attestation(resolved, path)[source]

Verify the upstream attestation of the download of resolved at path.

Runs the pinned gh, which checks the Sigstore signature of the attestation and that its subject is the digest of path.

Raises:

AttestationError – The attestation is missing, or does not cover the bytes at path.

Return type:

None

repomatic.tooling.checksums.checksum_targets(version_overrides=None)[source]

List the release artifacts whose checksums the registry records.

Parameters:

version_overrides (Mapping[str, str] | None) – Tool name to the version to download instead of the pinned one. When given, only these tools are listed: the other tools keep the checksums of their pinned version.

Return type:

list[tuple[ToolSpec, ResolvedBinary]]

Returns:

(spec, download) for each platform of each selected tool, where the download names the artifact URL and the checksum on record.

repomatic.tooling.checksums.update_registry_checksums(registry_path, version_overrides=None, *, jobs=1)[source]

Recompute binary checksums and version stamps in tooling/registry.py.

Downloads each artifact checksum_targets() lists, computes its SHA-256, and replaces stale hashes in-place. Also reconciles the VERSIONS stamp of each tool it verified with the version the checksums were computed for, the basis of the offline staleness test.

Parameters:
  • registry_path (Path) – Path to tooling/registry.py.

  • version_overrides (Mapping[str, str] | None) – Optional mapping of tool name to a version to download instead of the in-memory ToolSpec.version, which limits the run to these tools. sync-tool-versions passes this so it can bump the version in the source and refresh the checksums in a single process: the in-memory registry still holds the pre-bump version because the file was edited, not reimported.

  • jobs (int) – How many downloads run at once.

Return type:

list[tuple[str, str, str]]

Returns:

List of (url, old_hash, new_hash) for each updated checksum. Empty if all checksums are already correct.