From ae5d59975b62c2b37c7f4f2f490e34de16681bff Mon Sep 17 00:00:00 2001 From: diviocity Date: Mon, 30 Nov 2026 14:30:11 +0100 Subject: [PATCH] Install the vpac-backed pkg command in desktop roots --- PROFILES.md | 4 +- tests/userland/pkg.sh | 45 +++++++++++++++ tools/desktop-root.py | 1 + vinix-pkg/PKGBUILD.vile | 17 ++++++ vinix-pkg/pkg | 85 +++++++++++++++++++++++++++++ vinix-release-desktop/PKGBUILD.vile | 4 +- 6 files changed, 153 insertions(+), 3 deletions(-) create mode 100644 tests/userland/pkg.sh create mode 100644 vinix-pkg/PKGBUILD.vile create mode 100644 vinix-pkg/pkg diff --git a/PROFILES.md b/PROFILES.md index 4df6c12..e79ef41 100644 --- a/PROFILES.md +++ b/PROFILES.md @@ -14,7 +14,7 @@ The launchers and policy files for optional desktop apps come from Vinix sources The upstream profile adds one input row per architecture. Alpine v3.21 selects btop 1.4.0-r0, whose musl, libgcc and libstdc++ requirements already have Vinix providers. The worker's source input checksums and 240-row closures are in `release-inputs/upstream-7f173671`, receipt SHA-256 `f26c013d651aec9ee957e7b6139ff75e96014a2fd0b58f2eb04d573eec7fd758`. The AArch64 desktop now uses a single compositor executable and starts a first-frame watchdog from init. Asahi Mesa remains an opt-in image layer. [AArch64 desktop builder](https://github.com/vlang/vinix/blob/7f173671b6d1f1a8ceda2c693eadbb0eb58c4aa4/scripts/build-desktop-aarch64.sh) ยท [AArch64 init](https://github.com/vlang/vinix/blob/7f173671b6d1f1a8ceda2c693eadbb0eb58c4aa4/build-support/init-aarch64/initcore/core.v) -The upstream source plan orders 157 packages in 14 stages on each architecture. The desktop metapackage requires btop and the new AArch64 init with its watchdog. The amd64 init script has the same bytes as in the published release, which lets the new profile use its existing archive. The plans are in `release-inputs/upstream-7f173671/order-01`, receipt SHA-256 `45e137834f354d6effab4d784d6198f2a2d05b207124ddd18d781d46ccc355fc`. +The upstream source plan orders 158 packages in 14 stages on each architecture. The desktop metapackage requires btop, the vpac-backed `vinix-pkg` command and the new AArch64 init with its watchdog. The amd64 init script has the same bytes as in the published release, which lets the new profile use its existing archive. The plans are in `release-inputs/upstream-7f173671/order-03`, receipt SHA-256 `67d5c82443c21997418823e18061fb9a30baeca3dba9aa4525d61dc1597bfca0`. Both btop 1.4.0-1 archives were built against the signed Vinix musl and GNU C++ runtime and checked for their target ELF layout. Each published Vinix kernel booted an eight-package signed root, ran btop's version and help commands, and found the installed theme and manual. See `release-inputs/upstream-7f173671/btop-build-01` and `btop-guests-05`, receipt SHA-256 `888b9bec6a542a464a7f22c5689e894188b1fb1bd22ef8704b91b4bf00aa77a9` and `7c67d8d52bd24eee7c800076b3f3a4407e6c4dc7215fdaa91583873ba906cdcc`. The upstream AArch64 init and watchdog were also built from source and passed static linkage and 16 KiB load-segment checks. See `init-arm16-01`, receipt SHA-256 `20ae3a3806e753b35483f30cb9444f2b9c5aaf11d1e0f00f01b9a0660b4a784d`. @@ -135,3 +135,5 @@ To survey the whole release initramfs, pass `--system-providers providers.tsv` t `tests/release-imports.py ARCHIVE SHA256 REPORT SYMBOL...` searches undefined dynamic symbols in the original binaries. Across 240 amd64 image files, 114 amd64 X11 files, 221 arm64 image files and 120 arm64 X11 files, no binary imported `_dlstart` or Zstd's deprecated experimental `ZSTD_copyCCtx` and `ZSTD_copyDCtx`, removed upstream in 1.6.0. The same scan found no direct imports of the five differing GMP helpers or the nine MPFR cache and default-state symbols. It found `ZSTD_decompress` in all four layers and `mpfr_init2` in both images. The scan measures link-time imports. MPFR's per-thread defaults need a runtime test independently. See `foundation/release-dynamic-imports-01`, receipt SHA-256 `2e5ff31cdbc7c255a15ba8b8da25749c1633e102245f89a95fe8dcdcdd9072a5`. With `--dependencies needed.tsv` the same command records each ELF's library dependencies. Across both images and their X11 bundles, only `/sbin/apk` links to `libapk.so.2.14.0`. The native desktop still uses apk through two other interfaces. The first-run selector invokes `/sbin/apk search --exact`, and System Information reads `/lib/apk/db/installed`. Both images also ship a 49,083-byte `/usr/bin/pkg` shell frontend that runs apk transactions. The cutover needs a vpac repository query for the selector, vpac records for System Information, and a working native backend for the published `pkg` commands. Test all three interfaces in the guest alongside first-boot registration. See `foundation/release-dependency-edges-01` and `foundation/release-pkg-callers-01`, receipt manifests `b003d96cba8b6d0a6ca4461865241b2815657b309f1fac8844cdd5f0806b67c2` and `6ec3399d9c79ceb33cd4099c9fad7d22d270f04595227fb1ba472bb80cbead49`. + +`vinix-pkg` owns `/usr/bin/pkg` in the vpac-installed desktop root. Its `search --exact` command returns the matching package name or empty output when the signed index has no exact match. It translates `x11` into the `vinix-release-x11` metapackage. The first-run selector and System Information still need to use the new package interfaces in the Vinix source tree. diff --git a/tests/userland/pkg.sh b/tests/userland/pkg.sh new file mode 100644 index 0000000..ad7b3ed --- /dev/null +++ b/tests/userland/pkg.sh @@ -0,0 +1,45 @@ +#!/bin/sh +set -eu +export PATH=/bin:/usr/bin:/sbin:/usr/sbin LC_ALL=C HOME=/root + +phase=identity +finish() { + status=$? + if [ "$status" -ne 0 ]; then echo "PKG FIXTURE FAIL at $phase with status $status"; fi + /sbin/poweroff -f +} +trap finish EXIT + +test "$(uname -o)" = Vinix +test ! -e /sbin/apk +test ! -e /lib/apk/db/installed +vpac o /usr/bin/pkg | grep -q vinix-pkg +pkg list > /tmp/pkg-list +grep -Fxq vinix-pkg /tmp/pkg-list +pkg info musl > /tmp/pkg-info +grep -Eq '^name[[:space:]]+musl$' /tmp/pkg-info + +phase=repository +pkg update +pkg search netbase > /tmp/pkg-search +grep -Fq netbase /tmp/pkg-search +test "$(pkg search --exact netbase)" = netbase +test -z "$(pkg search --exact net)" +if pkg search --eval '(exit 0)' > /tmp/pkg-invalid 2>&1; then exit 1; fi +grep -Fq 'pkg: invalid query --eval' /tmp/pkg-invalid + +phase=install +test ! -e /etc/services +pkg install netbase +pkg list > /tmp/pkg-list +grep -Fxq netbase /tmp/pkg-list +vpac q -F validation local/netbase > /tmp/pkg-validation +grep -Eq '^validation[[:space:]]+signature$' /tmp/pkg-validation +vpac o /etc/services | grep -q netbase + +phase=remove +pkg remove netbase +test ! -e /etc/services +pkg list > /tmp/pkg-list +if grep -Fxq netbase /tmp/pkg-list; then exit 1; fi +echo 'VPAC FIXTURE GUEST PASS' diff --git a/tools/desktop-root.py b/tools/desktop-root.py index 0ae1bb4..58d8e1a 100644 --- a/tools/desktop-root.py +++ b/tools/desktop-root.py @@ -25,6 +25,7 @@ def build(args): name, = [field.splitlines()[1] for field in desc if field.startswith("%NAME%\n")] records[name] = record.with_name("files") owners = {"busybox": "bin/sh", "vinix-desktop-init": "sbin/init", "vpac": "usr/bin/vpac", + "vinix-pkg": "usr/bin/pkg", "vinix-keyring": "usr/share/vpac/keyrings/vinix.gpg", "gcc": "usr/bin/gcc", "binutils": "usr/bin/ld", "make": "usr/bin/make", "zsh": "bin/zsh", "btop": "usr/bin/btop"} for name, path in owners.items(): diff --git a/vinix-pkg/PKGBUILD.vile b/vinix-pkg/PKGBUILD.vile new file mode 100644 index 0000000..4e51295 --- /dev/null +++ b/vinix-pkg/PKGBUILD.vile @@ -0,0 +1,17 @@ +defpkgbuild(vinix-pkg, + #:pkgname, "vinix-pkg", + #:pkgver, "1.0.0", + #:pkgrel, 1, + #:pkgdesc, "Vinix pkg command for the vpac package repository", + #:arch, [#:any], + #:url, "https://github.com/vlang/vinix", + #:license, "0BSD", + #:depends, ["busybox", "vpac>=1.0.0-2"], + #:source, ["pkg"], + #:sha256sums, ["35a291f69a5965bbbbcd4692eea6db4db746324760a46f8fcc8b78f5798858cf"], + #:check, fn() { + run("sh", "-n", "pkg") + }, + #:package, fn() { + run("install", "-Dm755", "pkg", string-append(pkgdir(), "/usr/bin/pkg")) + }) diff --git a/vinix-pkg/pkg b/vinix-pkg/pkg new file mode 100644 index 0000000..badcd50 --- /dev/null +++ b/vinix-pkg/pkg @@ -0,0 +1,85 @@ +#!/bin/sh +# SPDX-License-Identifier: 0BSD +set -eu + +usage() { + printf '%s\n' 'Usage: pkg install|remove|info PACKAGE ...' \ + ' pkg search QUERY ... | pkg search --exact PACKAGE' \ + ' pkg list|update|upgrade' +} + +require_root() { + if [ "$(id -u)" != 0 ]; then + printf '%s\n' 'pkg: package changes require root' >&2 + exit 1 + fi +} + +check_query() { + for query do + case "$query" in + ''|-*) printf 'pkg: invalid query %s\n' "$query" >&2; exit 1 ;; + esac + done +} + +check_package() { + case "$1" in + ''|-*|*[!a-zA-Z0-9._+-]*) + printf 'pkg: invalid package name %s\n' "$1" >&2 + exit 1 + ;; + esac +} + +case "${1:-}" in + help|-h|--help) usage; exit 0 ;; + '') usage >&2; exit 1 ;; +esac +command=$1 +shift + +case "$command" in + install|add|remove|delete|del|info) + if [ "$#" -eq 0 ]; then usage >&2; exit 1; fi + for package do + shift + check_package "$package" + if [ "$package" = x11 ]; then package=vinix-release-x11; fi + set -- "$@" "$package" + done + case "$command" in + install|add) require_root; exec /usr/bin/vpac i --needed --noconfirm "$@" ;; + remove|delete|del) require_root; exec /usr/bin/vpac r --recursive --noconfirm "$@" ;; + info) exec /usr/bin/vpac q --noconfirm "$@" ;; + esac + ;; + search) + if [ "$#" -eq 0 ]; then usage >&2; exit 1; fi + if [ "$1" = --exact ]; then + shift + if [ "$#" -ne 1 ]; then usage >&2; exit 1; fi + check_package "$1" + name=$1 + if [ "$name" = x11 ]; then name=vinix-release-x11; fi + matches=$(/usr/bin/vpac s --remote --quiet --noconfirm "$name") + if printf '%s\n' "$matches" | grep -Fxq "$name"; then printf '%s\n' "$1"; fi + exit 0 + fi + check_query "$@" + exec /usr/bin/vpac s --remote --noconfirm "$@" + ;; + list|update|upgrade) + if [ "$#" -ne 0 ]; then usage >&2; exit 1; fi + case "$command" in + list) exec /usr/bin/vpac s --local --quiet ;; + update) require_root; exec /usr/bin/vpac s --remote --sync --quiet --noconfirm >/dev/null ;; + upgrade) require_root; exec /usr/bin/vpac u --sync --noconfirm ;; + esac + ;; + *) + printf 'pkg: unknown command %s\n' "$command" >&2 + usage >&2 + exit 1 + ;; +esac diff --git a/vinix-release-desktop/PKGBUILD.vile b/vinix-release-desktop/PKGBUILD.vile index 64c6d59..0c425d5 100644 --- a/vinix-release-desktop/PKGBUILD.vile +++ b/vinix-release-desktop/PKGBUILD.vile @@ -5,14 +5,14 @@ arch := if string?(selected) { selected } else if memq(string->symbol("aarch64") musl := if string=?("aarch64", arch) { "musl>=1.2.6-4" } else { "musl>=1.2.6-2" } common := list(musl, "busybox>=1.38.0-5", "musl-utils", "ssl-client", "netbase", "vinix-release", "vinix-filesystem>=0.1.0-2", "vinix-accounts", "vinix-keyring", - "ca-certificates", "curl", "git", "openssh-client", "vpac", "xbps", + "ca-certificates", "curl", "git", "openssh-client", "vpac", "vinix-pkg", "xbps", "zsh", "vim", "btop", "build-base", if string=?(arch, "aarch64") { "vinix-desktop-init>=20261130-1" } else { "vinix-desktop-init" }) defpkgbuild(vinix-release-desktop, #:pkgname, "vinix-release-desktop", #:pkgver, "20261130", - #:pkgrel, 1, + #:pkgrel, 2, #:pkgdesc, "Base, network and toolchain packages for the Vinix desktop release", #:arch, [#:x86-64, #:aarch64], #:url, "https://github.com/vlang/vinix", -- 2.56.1