vinix-ports / tests / FEED.md
65 lines · 51 sloc · 3.93 KB · ad19464d4da3e5119cbd589e5250075f13de4011
Raw

Signed package integration test

Run the fixture on a Linux build machine with V, vpac, GnuPG, bsdtar, repo-add, sha256sum and unprivileged user/network namespaces. Set archives to the directory containing the source-built package archives.

work=$(mktemp -d)
v -o "$work/feed" tests/feed.v
"$work/feed" keys "$work/keys"
"$work/feed" publish "$work/keys" "$work/repo" x86_64 \
    "$archives"/musl-*.pkg.tar.zst "$archives"/busybox-*.pkg.tar.zst
"$work/feed" install "$work/keys" "$work/repo" x86_64 "$work/sdk" musl busybox

Each destination must be new. The publisher verifies each package signature, embeds signatures in the signed repository database, verifies both index signatures and records archive SHA-256 values in repo/packages.tsv. The installer checks the database and package signatures through vpac while syncing and resolving package names. Its isolated client keeps the root, database, cache, configuration and log under sdk/.

A builder with its own unprivileged service account and private state directory can use feed install KEY_STATE REPO ARCH NEW_CLIENT --fakeroot PACKAGE_NAME... when user namespaces are unavailable. This runs vpac under fakeroot and keeps the same signed file repository and new client directory.

For a separate consumer, transfer the repository directory and obtain the expected fingerprint independently from the test owner. Import the public key into a client-only keyring.

"$work/feed" trust "$work/client-keys" "$work/repo/test-signer.asc" "$fingerprint"
"$work/feed" install "$work/client-keys" "$work/repo" x86_64 "$work/client" musl busybox

Upgrade an installed root

The worker tested BusyBox 1.38.0-3 upgrading to 1.38.0-4, followed by the first install of vinix-release. The earlier recipe is at cab3ed4:busybox/PKGBUILD.vile. With these archives in archives and test keys from the first step, publish two snapshots and keep the same client directory for both transactions.

old="$work/upgrade-old"
new="$work/upgrade-new"
client="$work/upgrade-client"
"$work/feed" publish "$work/keys" "$old" x86_64 \
    "$archives"/musl-*.pkg.tar.zst "$archives"/busybox-1.38.0-3-x86_64.pkg.tar.zst
"$work/feed" install "$work/keys" "$old" x86_64 "$client" --fakeroot musl busybox
test -d "$client/db/local/busybox-1.38.0-3"
"$work/feed" publish "$work/keys" "$new" x86_64 \
    "$archives"/musl-*.pkg.tar.zst "$archives"/busybox-1.38.0-4-x86_64.pkg.tar.zst \
    "$archives"/vinix-release-0.1.0-1-any.pkg.tar.zst
sed 's|/upgrade-old/|/upgrade-new/|' "$client/config.vile" > "$client/upgrade.vile"
fakeroot -- vpac --config "$client/upgrade.vile" u --sync --noconfirm
fakeroot -- vpac --config "$client/upgrade.vile" i --noconfirm vinix-release
test -d "$client/db/local/busybox-1.38.0-4"
test ! -d "$client/db/local/busybox-1.38.0-3"
grep -Fx bin/uname "$client/db/local/busybox-1.38.0-4/files"
grep -Fx usr/bin/uname "$client/db/local/vinix-release-0.1.0-1/files"
test "$(readlink "$client/root/usr/bin/uname")" = ../../bin/uname
grep -Fx ID=vinix "$client/root/etc/os-release"

Reuse a signed SDK

For a later SDK, publish the cumulative archive set to a new repository directory and install the desired package names into a new SDK. A remote builder can unpack a relative snapshot and set VPAC_MAKEPKG_ROOT and VPAC_MAKEPKG_DB to its extracted root and db directories.

tar --format=ustar --owner=0 --group=0 --zstd -cf "$work/sdk.tar.zst" -C "$work/sdk" root db
sha256sum "$work/sdk.tar.zst"

To boot the packages, pass an existing Vinix amd64 BIOS ISO to the diskless test. The runner uses the ISO's kernel and Limine boot files. Its --musl mode links a V probe with the installed musl SDK, checks its loader checksum in Vinix and exercises the Vinix malloc_trim implementation. BusyBox supplies PID 1, ash and the applets. The serial transcript is written to guest/serial.log.

v -o "$work/boot" tests/busybox/boot.v
"$work/boot" "$work/sdk/root" "$vinix_iso" "$work/guest" --musl