me

/

vinix-ports Public
382 commits 0 issues 0 pull requests 1 contributor Discussions Projects Snippets LOC history Platform CI

Publish exact signed release dependencies

diviocity committed 5 days ago · a802c802ec8af1958b21c7bd269ad19326ec2020 View patch
Unverified signature 2 files changed +80 -0
tests/FEED.md +7 -0

@@ -149,6 +149,13 @@ python3 tools/stage-image.py "$arch" "$client" "$repo" "$output" "$work/audit" "

149149

150150The tool audits the package-owned root, makes a separate copy, and seeds the verification keyring using the distributor's fingerprint. It copies the local package records into `/var/lib/vpac/local`, checks their versions against the signed database, and installs the repository under `/var/lib/vinix/repository/$arch`. It verifies the database, file index and each included package signature, and compares the payload hashes with the signed database. The sync cache receives independent copies of the database and signature. Assembly exposes the final root only after these checks pass.

151151

152+To publish only the runtime closure selected by the release plan, use `tools/release-feed.py` with the matching `coverage.tsv`. It follows runtime dependency edges and rechecks every planned archive's version and SHA-256 before signing. The worker cold-installed `busybox-init` by name from this feed and audited six packages, 832 owned paths and 15 ELFs. The same test refused an incomplete X11 closure and a changed archive digest before creating either repository. See `foundation/exact-release-feed-proof-01`, receipt SHA-256 `e50d2c759f1e0045a9ef6e42522e02e6de4cfd03d9f51d6b5d6045d23d5cbdc3`.

153+

154+```sh

155+python3 tools/release-feed.py "$arch" "$worker" "$plan" "$coverage" \

156+ "$key_state" "$repo" vinix-release-desktop

157+```

158+

152159On both targets, the worker installed musl and the public key package, then assembled a three-package offline repository. Using the build-box vpac with its paths directed into each resulting image, it installed the third package, `netbase`, from the embedded repository and recorded its ownership in that image. The logs are in `foundation/offline-stage-01` with receipt manifest SHA-256 `98bfcbdaed3aa81690bcdac5a8b0edbdfd91f5ab6ae8a7cc9f3fdd50e6252fb1`.

153160

154161Changing the netbase archive after signing caused assembly to fail its signed index checksum check before exposing the output root. The rejection log in `foundation/offline-stage-rejection-01` has receipt manifest SHA-256 `e15be9b8ba76c5c115a622e7fa57997c1bcb9ca99a3319e18b3daf489ecc3c8d`.

tools/release-feed.py new file +73 -0

@@ -0,0 +1,73 @@

1+"""Publish a signed runtime closure from a verified release archive inventory."""

2+

3+import argparse

4+from collections import defaultdict

5+import csv

6+import hashlib

7+from pathlib import Path

8+import subprocess

9+

10+

11+def records(file):

12+ with file.open() as stream:

13+ return list(csv.DictReader(stream, delimiter="\t"))

14+

15+

16+def runtime_packages(plan, coverage, roots):

17+ packages = {row["package"]: row for row in records(coverage)}

18+ edges = defaultdict(set)

19+ for row in records(plan / "edges.tsv"):

20+ if row["kind"] == "depend":

21+ edges[row["package"]].add(row["selected_provider"])

22+ selected = set()

23+ pending = list(roots)

24+ while pending:

25+ name = pending.pop()

26+ if name in selected:

27+ continue

28+ if name not in packages:

29+ raise ValueError(f"unknown package or unresolved runtime provider: {name}")

30+ selected.add(name)

31+ pending.extend(edges[name] - selected)

32+ return {name: packages[name] for name in sorted(selected)}

33+

34+

35+def publish(args):

36+ selected = runtime_packages(args.plan, args.coverage, args.roots)

37+ if args.dependencies_only:

38+ for name in set(args.roots):

39+ del selected[name]

40+ blocked = [f"{name} ({row['status']})" for name, row in selected.items()

41+ if row["status"] != "verified"]

42+ if blocked:

43+ raise ValueError(f"runtime closure has unverified archives: {', '.join(blocked)}")

44+ archives = []

45+ ordered = {row["package"]: row["version"] for row in records(args.plan / "order.tsv")}

46+ for name, row in selected.items():

47+ version = ordered[name]

48+ path = (args.workspace / row["archive"]).resolve(strict=True)

49+ if row["version"] != version or path.name not in (

50+ f"{name}-{version}-{args.arch}.pkg.tar.zst", f"{name}-{version}-any.pkg.tar.zst"):

51+ raise ValueError(f"{name}: archive differs from the release plan")

52+ with path.open("rb") as stream:

53+ actual = hashlib.file_digest(stream, "sha256").hexdigest()

54+ if actual != row["archive_sha256"]:

55+ raise ValueError(f"{name}: archive bytes changed after verification")

56+ archives.append(path)

57+ if not archives:

58+ raise ValueError("empty runtime closure")

59+ subprocess.run(["feed", "publish", args.keys, args.repo, args.arch, *archives], check=True)

60+

61+

62+if __name__ == "__main__":

63+ parser = argparse.ArgumentParser(description=__doc__)

64+ parser.add_argument("arch", choices=("x86_64", "aarch64"))

65+ parser.add_argument("workspace", type=Path, help="base directory for paths in the archive inventory")

66+ parser.add_argument("plan", type=Path, help="directory containing order.tsv and edges.tsv")

67+ parser.add_argument("coverage", type=Path, help="verified inventory produced by release-archives.py")

68+ parser.add_argument("keys", type=Path, help="feed signing state")

69+ parser.add_argument("repo", type=Path, help="new repository directory")

70+ parser.add_argument("roots", nargs="+", help="packages to install by name")

71+ parser.add_argument("--dependencies-only", action="store_true",

72+ help="omit the named roots while preparing their signed build dependencies")

73+ publish(parser.parse_args())