commit 1f07cd635633cddc82042c586854b76f95e03e08
parent c2c0c3ac65bf1ff09f7405b9aa2bdfc048d5ea3f
Author: Bharatvaj Hemanth <bharatvaj@yahoo.com>
Date: Fri, 30 Oct 2026 02:00:37 +0530
parent c2c0c3ac65bf1ff09f7405b9aa2bdfc048d5ea3f
Author: Bharatvaj Hemanth <bharatvaj@yahoo.com>
Date: Fri, 30 Oct 2026 02:00:37 +0530
Build FxA Debian packages in unprivileged CI for APT distribution
15 files changed, 243 insertions(+), 47 deletions(-)
diff --git a/.config/Jobfile b/.config/Jobfile @@ -1,8 +1,8 @@ project=foundationpkgs triggers="refs/heads/main: checks plan packages" -# First APK rollout: only this recipe has been migrated and verified. -# Add reviewed package names here as other recipes/toolchains are migrated. -ci_packages=${FPKGS_PACKAGES:-minimal-fxa-server} +# Reviewed per-format allowlists; FxA is serviced through Debian's signed APT repo. +ci_apk_packages=${FPKGS_APK_PACKAGES:-} +ci_deb_packages=${FPKGS_DEB_PACKAGES:-minimal-fxa-server} checks() { for file in "$srcdir"/scripts/*.sh "$srcdir"/tests/*.sh; do @@ -14,20 +14,25 @@ checks() { } plan() { - FPKGS_PACKAGES=$ci_packages \ - FPKGS_ROOT=$srcdir \ - FPKGS_WORK_ROOT=$workdir/fpkgs \ - $srcdir/scripts/fpkgs-ci.sh plan "$FETCH_HEAD" + for format in apk deb; do + case "$format" in apk) selected=$ci_apk_packages ;; deb) selected=$ci_deb_packages ;; esac + [ -n "$selected" ] || continue + FPKGS_FORMAT=$format FPKGS_PACKAGES=$selected \ + FPKGS_ROOT=$srcdir FPKGS_WORK_ROOT=$workdir/fpkgs \ + $srcdir/scripts/fpkgs-ci.sh plan "$FETCH_HEAD" || return 1 + done } packages() { # /tmp is a small tmpfs on the CI host; Go build work belongs on disk. mkdir -p "$workdir/tmp" - TMPDIR=$workdir/tmp \ - FPKGS_PACKAGES=$ci_packages \ - FPKGS_ROOT=$srcdir \ - FPKGS_WORK_ROOT=$workdir/fpkgs \ - $srcdir/scripts/fpkgs-ci.sh run "$FETCH_HEAD" + for format in apk deb; do + case "$format" in apk) selected=$ci_apk_packages ;; deb) selected=$ci_deb_packages ;; esac + [ -n "$selected" ] || continue + TMPDIR=$workdir/tmp FPKGS_FORMAT=$format FPKGS_PACKAGES=$selected \ + FPKGS_ROOT=$srcdir FPKGS_WORK_ROOT=$workdir/fpkgs \ + $srcdir/scripts/fpkgs-ci.sh run "$FETCH_HEAD" || return 1 + done artifact_name=foundationpkgs artifact_url=https://nply.org/dl/foundationpkgs/ }
diff --git a/AGENTS.md b/AGENTS.md @@ -38,9 +38,10 @@ See [status and logs](docs/ci.md#check-a-binary) for pending/failed builds. - Dashboard: <https://ci.nply.org/cgi-bin/minci.cgi>. Public artifacts: <https://nply.org/dl/foundationpkgs/>. -- Deploy through [staged installation](docs/ci.md#install-a-ci-binary): verify, - extract into a temporary directory, then install selected files. Never extract - CI tarballs directly over `/`; their parent metadata belongs to the builder. +- **Debian deployment:** use [APT installation](docs/ci.md#install-or-upgrade-a-debian-application) + and the `foundationpkgs-binaries` archive publisher. For APK targets use + [APK installation](docs/ci.md#install-an-apk). Legacy staged copies are only + an explicit fallback, not the normal application upgrade path. For CI host provisioning, maintain `.config/ci-packages.list` and use [the administrator preparation workflow](docs/ci.md#prepare-the-debian-ci-host).
diff --git a/CONTEXT.md b/CONTEXT.md @@ -10,7 +10,7 @@ **Target**: The platform triplet a package is built for, such as `x86_64-alpine-linux-musl` or `x86_64-unknown-linux-gnu`. It identifies the intended ABI, not a guarantee that the recipe's toolchain produces compatible binaries. -**Package format**: The distribution container, independent of the target: genuine signed Alpine APKs or legacy tar.gz archives. +**Package format**: The distribution container, independent of the target: genuine signed Alpine APKs, opt-in Debian `.deb` packages, or legacy tar.gz archives. The Debian backend runs unprivileged; APT repository signing/publication belongs to `foundationpkgs-binaries`. **Build key**: The content hash used to decide whether a package/target needs rebuilding. It represents the APKBUILD, local source inputs, build scripts, target, git revision, build-affecting environment, and tool versions.
diff --git a/Unix/minimal-fxa-server/APKBUILD b/Unix/minimal-fxa-server/APKBUILD @@ -1,6 +1,9 @@ pkgname=minimal-fxa-server pkgver=0_git20260225 -pkgrel=3 +pkgrel=4 +# Explicit Debian output opt-in; upstream's underscore version is not Debian-valid. +deb_pkgver=0+git20260225 +deb_postinst=debian.postinst pkgdesc="Minimal Firefox Accounts server and local user management CLI" url="https://github.com/ahyattdev/minimal-fxa-server" arch="x86_64 aarch64" @@ -11,11 +14,13 @@ options="net !strip" _commit=8ec5f0d160269f5079431d2b75574337f0552940 source="$url/archive/$_commit.tar.gz enforce-pkce.patch - cli-rpc-timeout.patch" + cli-rpc-timeout.patch + debian.postinst" sha256sums=" d336c2d13f58b915dca33a3cd20a9d44239d800fa02b38a19b1ee7fd5efbc08a $_commit.tar.gz 12162d02df485ec02e668f6b9591458c44c5fd2a7823908f8f620956e0a60348 enforce-pkce.patch 2d4ea552beb7ba97fb78393e6deac70ac79066aa35ce998c6b7bb283132be052 cli-rpc-timeout.patch +2082b30dae3fdb4f7afa1b00b1623e94c264f80d1d22897ad6a3f1f7ad83adab debian.postinst " builddir="$srcdir/$pkgname-$_commit"
diff --git a/Unix/minimal-fxa-server/debian.postinst b/Unix/minimal-fxa-server/debian.postinst @@ -0,0 +1,9 @@ +#!/bin/sh +set -eu +# Existing deployments keep administrator-owned configuration, keys and unit. +# Do not enable a fresh, unconfigured server or change any account/database data. +if [ "${1:-}" = configure ] && [ -d /run/systemd/system ]; then + if [ "$(systemctl show minimal-fxa-server.service -p LoadState --value)" = loaded ]; then + systemctl try-restart minimal-fxa-server.service + fi +fi
diff --git a/docs/ci.md b/docs/ci.md @@ -16,11 +16,14 @@ signing configuration and target dependencies. Package jobs do not provision the live host or rewrite existing recipes; keep legacy CI explicitly on tar.gz until its packages and toolchain have been migrated. -**Initial APK rollout:** `.config/Jobfile` selects only `minimal-fxa-server` -through `ci_packages`/`FPKGS_PACKAGES`. Add reviewed recipe names to that list -as they are migrated. The helper without a filter still discovers all recipes; -this deliberate CI allowlist avoids switching unrelated legacy recipes blindly. +**Per-format allowlists:** `.config/Jobfile` selects `minimal-fxa-server` for +Debian output through `ci_deb_packages`/`FPKGS_DEB_PACKAGES`. The APK allowlist +`ci_apk_packages`/`FPKGS_APK_PACKAGES` is initially empty. An empty list skips +that format; it does not select every recipe. Direct helper invocations still +use `FPKGS_PACKAGES`, with unset meaning all discovered recipes. Go work uses disk-backed `$workdir/tmp`, not the small `/tmp` tmpfs. +Debian CI builds are rootless; the separate local publisher signs and activates +the APT repository only after archiving the verified CI artifacts locally. Package builds are sequential; your package may be queued behind others. One package can be published even if @@ -32,20 +35,20 @@ target, and revision rather than inferring availability from overall job state. The maintained host package list is [`.config/ci-packages.list`](../.config/ci-packages.list). It covers the **Debian 13 amd64 build host**, not the Alpine target filesystem. Ordinary packages come from the machine's configured signed Debian repositories; -custom packages come from a supplied `bootstrap-binaries` checkout or snapshot. +custom packages come from a supplied `foundationpkgs-binaries` checkout or snapshot. Each custom `.deb` is pinned by its versioned relative path and SHA-256 in this manifest. Its source repository revision is recorded in the manifest comments. Debian packages track the configured repositories rather than a frozen snapshot. ```sh # Portable, read-only validation: show the list and verify custom package bytes. -scripts/prepare-ci-host.sh --plan ../bootstrap-binaries +scripts/prepare-ci-host.sh --plan ../foundationpkgs-binaries # On Debian 13 amd64: ask APT to resolve the combined transaction, without changes. -scripts/prepare-ci-host.sh --simulate ../bootstrap-binaries +scripts/prepare-ci-host.sh --simulate ../foundationpkgs-binaries # Explicit administrator action, after reviewing the simulation: -sudo scripts/prepare-ci-host.sh --install /absolute/path/to/bootstrap-binaries +sudo scripts/prepare-ci-host.sh --install /absolute/path/to/foundationpkgs-binaries ``` The default action is `--plan`. Use a trusted foundationpkgs checkout: its script @@ -166,6 +169,20 @@ Corrupt or incomplete cached publications are rebuilt rather than skipped. The ` not a filename-bearing `sha256sum -c` record. Publication is atomic: artifacts, log, and manifest are staged together before the directory becomes visible. +## Install or upgrade a Debian application + +For packages selected for `.deb` output, use the signed APT repository maintained +in `~/Projects/foundationpkgs-binaries`; its `docs/apt.md` documents the public +key fingerprint, scoped `Signed-By` setup, local retention and publication. +After initial enrollment, `apt update` / `apt install minimal-fxa-server` / normal +APT upgrades own and update the live files. No staging-copy deployment is needed. +Unattended third-party-origin upgrades are a separate explicit administrator policy. + +Use `FPKGS_FORMAT=deb scripts/fpkgs-ci.sh status PACKAGE x86_64-unknown-linux-gnu REV` +to find exact CI output. The Debian backend uses `dpkg-deb` without sudo; it does +not change host package state or access the APT archive signing key. Keep APT +publication separate from CI builds so every published release exists locally. + ## Install an APK Use the verified `artifact_path` with the target system's normal APK manager,
diff --git a/docs/firefox-sync.md b/docs/firefox-sync.md @@ -3,7 +3,8 @@ ## Deployment `Unix/minimal-fxa-server/APKBUILD` packages upstream commit -`8ec5f0d160269f5079431d2b75574337f0552940` as `0_git20260225-r3`, with: +`8ec5f0d160269f5079431d2b75574337f0552940` as `0_git20260225-r4` +(Debian version `0+git20260225-4`), with: - `enforce-pkce.patch`: 27 production lines enforce S256 PKCE and client-ID binding in both authorization-code exchange endpoints, plus regression tests. @@ -20,6 +21,16 @@ It builds both `minimal-fxa-server` and `fxa-user` with CGO disabled, explicit Linux/Go architecture selection and static `-buildmode=exe` output. Go strips symbols itself; abuild's target-prefixed strip is disabled for these binaries. Use the repository's CI artifacts for deployment, not ad hoc server builds. +CI now selects Debian output for this package. Enroll the signed APT repository +using `~/Projects/foundationpkgs-binaries/docs/apt.md`, then install/upgrade with +`apt install minimal-fxa-server`. The `.deb` owns both live binaries and their +license; its postinst restarts an already-running Accounts service using the +existing administrator-owned unit. It does not create accounts, change secrets, +initialize databases or enable an unconfigured service. Fresh servers still need +the one-time configuration described below. + +Previous r2/r3 deployments used APK staging plus copied binaries, not package +ownership. The APT installation supersedes that manual-copy upgrade path. The original deployed **r0 tarball** (not replaced merely by publishing an APK) was published by CI for repository revision @@ -35,7 +46,7 @@ parent directory modes, which must not replace system directory metadata. ## APK publication -The first APK rollout selects this recipe in `.config/Jobfile`. The target is +The historical APK rollout selected this recipe in `.config/Jobfile`. The target was `x86_64-alpine-linux-musl`; build dependencies are provided by the Debian host, using upstream abuild and the CI user's persistent signing key. Query the pushed revision rather than assuming success from the push: @@ -46,8 +57,8 @@ scripts/fpkgs-ci.sh status minimal-fxa-server x86_64-alpine-linux-musl FULL_COMM Use the public key and installation procedure in [CI documentation](ci.md#install-an-apk). The APK contains both binaries and the MIT license. Static Go binaries avoid a -glibc/musl interpreter dependency; this is not a migration of the live Debian -service to APK management. Publishing an APK does not restart Accounts or Sync. +glibc/musl interpreter dependency. Debian service upgrades now use APT, not APK +management of Debian's root. Publishing a CI artifact alone never restarts a service. ## Services and configuration
diff --git a/docs/usage.md b/docs/usage.md @@ -74,7 +74,8 @@ scripts/build.sh -t x86_64-unknown-linux-musl Unix/kcgi/APKBUILD On Linux the default is **genuine APK output through upstream abuild**, targeting `<host-arch>-alpine-linux-musl`. Other hosts retain tar.gz output and their native -target. Choose independently with `-f`/`FPKGS_FORMAT` and `-t`/`FPKGS_TARGETS`: +target. Choose independently with `-f`/`FPKGS_FORMAT` and `-t`/`FPKGS_TARGETS`. +An opt-in `deb` backend is also available for Debian 13 amd64 recipes: ```sh scripts/build.sh -f apk -t x86_64-alpine-linux-musl Unix/kcgi/APKBUILD @@ -88,7 +89,7 @@ ABI compatibility claim. Recipes, compilers, sysroots and runtime dependencies remain the caller's responsibility. A target name does not convert libc. Install upstream `abuild`/`apk-tools` before APK builds. Debian 13 amd64 bootstrap -`.deb` packages and build instructions live in `~/Projects/bootstrap-binaries`. +`.deb` packages and build instructions live in `~/Projects/foundationpkgs-binaries`. Run builds as an unprivileged user, generate a signing key with `abuild-keygen -a -n`, and trust its **public** key for local index verification (the bootstrap README documents the key installation). No keys are generated or @@ -117,6 +118,30 @@ dist/<target-or-noarch>/<pkgname>-<pkgver>-r<pkgrel>.tar.gz dist/<target-or-noarch>/<pkgname>-<pkgver>-r<pkgrel>.tar.gz.sha256 ``` +### Debian output and APT servicing + +```sh +scripts/build.sh -f deb -t x86_64-unknown-linux-gnu Unix/minimal-fxa-server/APKBUILD +``` + +The recipe must set `deb_pkgver` to a Debian-valid version (e.g. +`0+git20260225`), optionally `deb_depends` and `deb_postinst`. The latter must be +a local source/checksummed script. `pkgrel` supplies the Debian revision. +The backend runs the existing recipe's tar builder/checks in private staging, +then uses native `dpkg-deb --root-owner-group` without sudo or live APT changes. +It currently supports Linux builds for Debian amd64; other recipes must explicitly +opt in and declare appropriate runtime dependencies. The output is +`<pkgname>_<deb_pkgver>-<pkgrel>_amd64.deb` plus its SHA-256 sidecar. +Pacstall is not used: the installed Pacstall's build-only mode still invokes +sudo, which the CI build identity deliberately lacks. + +CI selects Debian packages through `FPKGS_DEB_PACKAGES` in `.config/Jobfile`; +FxA is selected by default. `FPKGS_APK_PACKAGES` selects reviewed APK packages. +The helper's direct `FPKGS_FORMAT`/`FPKGS_PACKAGES` interface remains available. +Published `.deb` files are not themselves OpenPGP-signed: the separate +`foundationpkgs-binaries` publisher retains them locally and signs APT metadata +with a local-only archive key. See that repository's `docs/apt.md`. + ## CI/package planner Plan work for a revision:
diff --git a/scripts/build-deb.sh b/scripts/build-deb.sh @@ -0,0 +1,51 @@ +#!/bin/sh +# Opt-in Debian packaging using the existing recipe build and native dpkg-deb. +# No sudo, APT, signing key, or live installation is used during a build. +set -eu +self=$(CDPATH= cd -- "$(dirname "$0")" && pwd) +. "$self/functions.sh" +[ "$#" = 4 ] || die 'usage: build-deb.sh APKBUILD OUT TARGET KEEP' +recipe=$(CDPATH= cd -- "$(dirname "$1")" && pwd)/$(basename "$1") +output=$2 +target=$3 +keep=$4 +[ "$(canonical_os)" = Linux ] || die 'Debian packages must be built on Linux' +command -v dpkg-deb >/dev/null 2>&1 || die 'dpkg-deb is required' +case "$target" in x86_64-unknown-linux-gnu) debarch=amd64 ;; *) die 'Initial Debian backend supports only Debian amd64' ;; esac +work=$(mktemp -d "${TMPDIR:-/tmp}/fpkgs-deb.XXXXXX") +cleanup() { if [ "$keep" = 1 ]; then msg "keeping $work"; else rm -rf "$work"; fi; } +trap cleanup 0 +trap 'exit 1' HUP INT TERM +mkdir -p "$output/$target" "$work/stage" +output=$(CDPATH= cd -- "$output/$target" && pwd) +# Recipes explicitly opt in with their Debian version and dependencies. +srcdir=$work/src +pkgdir=$work/stage +CHOST=$target +. "$recipe" +[ -n "${deb_pkgver:-}" ] || die 'Recipe has not opted into Debian packaging (deb_pkgver)' +debversion=$deb_pkgver-${pkgrel:-0} +dpkg --validate-version "$debversion" +FPKGS_FORMAT=tar.gz "$self/build.sh" -f tar.gz -t "$target" -o "$work/tar" -s "$work/sysroot" -n "$work/native" "$recipe" +archive=$work/tar/$target/$pkgname-$pkgver-r${pkgrel:-0}.tar.gz +[ -f "$archive" ] || die 'Missing recipe output' +# Extraction is always into private staging, never the live filesystem. +tar --no-same-owner -xzf "$archive" -C "$work/stage" +[ ! -e "$work/stage/DEBIAN" ] || die 'Recipe payload must not supply Debian control metadata' +mkdir "$work/stage/DEBIAN" +{ + printf 'Package: %s\nVersion: %s\nArchitecture: %s\n' "$pkgname" "$debversion" "$debarch" + printf 'Maintainer: Foundation Packages <packages@nply.org>\n' + printf 'Section: utils\nPriority: optional\nHomepage: %s\n' "$url" + [ -z "${deb_depends:-}" ] || printf 'Depends: %s\n' "$deb_depends" + printf 'Description: %s\n' "$pkgdesc" +} > "$work/stage/DEBIAN/control" +if [ -n "${deb_postinst:-}" ]; then + case "$deb_postinst" in */* | .* | *[!a-zA-Z0-9_.-]*) die 'Unsafe deb_postinst filename' ;; esac + install -m755 "$(dirname "$recipe")/$deb_postinst" "$work/stage/DEBIAN/postinst" +fi +(cd "$work/stage" && find . -type f ! -path './DEBIAN/*' -exec md5sum {} +) > "$work/stage/DEBIAN/md5sums" +artifact=$output/${pkgname}_${debversion}_${debarch}.deb +dpkg-deb --root-owner-group --build "$work/stage" "$artifact" +sha256sum "$artifact" | awk '{print $1}' > "$artifact.sha256" +msg "wrote $artifact"
diff --git a/scripts/build.sh b/scripts/build.sh @@ -3,7 +3,7 @@ # folder. POSIX sh only. See functions.sh for the derivation notes (forked # from alpinelinux/abuild, generic parts only). # -# Usage: build.sh [-f apk|tar.gz] [-o DESTDIR] [-s SYSROOT] [-n NATIVE_ROOT] [-t CHOST] [-k] <pkgname-or-path> +# Usage: build.sh [-f apk|tar.gz|deb] [-o DESTDIR] [-s SYSROOT] [-n NATIVE_ROOT] [-t CHOST] [-k] <pkgname-or-path> # # <pkgname-or-path> is either a bare package name (resolved via # resolve_recipe against $FPKGS_ROOT) or a direct path to a recipe @@ -36,9 +36,9 @@ KEEP_WORKDIR=0 usage() { cat <<EOF -usage: $0 [-f apk|tar.gz] [-o DESTDIR] [-s SYSROOT] [-n NATIVE_ROOT] [-t CHOST] [-k] <pkgname-or-path> +usage: $0 [-f apk|tar.gz|deb] [-o DESTDIR] [-s SYSROOT] [-n NATIVE_ROOT] [-t CHOST] [-k] <pkgname-or-path> - -f FORMAT apk on Linux, tar.gz elsewhere; overrides FPKGS_FORMAT + -f FORMAT apk, tar.gz or opt-in deb; overrides FPKGS_FORMAT -o DESTDIR destination root for packages (default: ./dist) -s SYSROOT tar.gz only: target dependency staging root (default: ./sysroot) -n NATIVE_ROOT tar.gz only: root makedepends/makedepends_build get extracted into @@ -81,6 +81,18 @@ export FPKGS_FORMAT CBUILD=$(guess_triplet) CHOST="${CHOST:-$(default_target "$FORMAT")}" +if [ "$FORMAT" = deb ]; then + [ "${LEGACY_ROOT_REQUESTED:-0}" -eq 0 ] || die '-s/-n are tar.gz-only staging options' + if [ -f "$target" ]; then + apkbuild=$target + elif [ -f "$target/APKBUILD" ]; then + apkbuild=$target/APKBUILD + else + apkbuild=$(resolve_recipe "$target") || die "no recipe found for '$target'" + fi + exec "$SELF_DIR/build-deb.sh" "$apkbuild" "$DESTDIR" "$CHOST" "$KEEP_WORKDIR" +fi + if [ "$FORMAT" = apk ]; then # A vendor spelling alone must not turn a native musl build into a cross build. case "$CBUILD" in
diff --git a/scripts/fpkgs-ci.sh b/scripts/fpkgs-ci.sh @@ -140,6 +140,9 @@ build_env_fingerprint() { (command -v cc >/dev/null 2>&1 && cc --version 2>/dev/null | sed 1q) || true (command -v make >/dev/null 2>&1 && make --version 2>/dev/null | sed 1q) || true (command -v bmake >/dev/null 2>&1 && bmake -V MAKE_VERSION 2>/dev/null) || true + if [ "$(package_format)" = deb ]; then + (dpkg-deb --version 2>/dev/null | head -1) || printf 'dpkg-deb=unavailable\n' + fi if [ "$(package_format)" = apk ]; then ("${FPKGS_ABUILD:-abuild}" -V 2>/dev/null) || printf 'abuild=unavailable\n' (${APK:-apk} --version 2>/dev/null) || printf 'apk=unavailable\n' @@ -163,7 +166,7 @@ build_key() { printf 'target=%s\n' "$target" printf 'apkbuild=%s\n' "$apk" printf 'apkbuild-sha256=%s\n' "$(sha256_file "$apk")" - for f in "$root/scripts/build.sh" "$root/scripts/build-apk.sh" "$root/scripts/functions.sh" "$root/scripts/apkbuild-to-pacscript.sh"; do + for f in "$root/scripts/build.sh" "$root/scripts/build-apk.sh" "$root/scripts/build-deb.sh" "$root/scripts/functions.sh" "$root/scripts/apkbuild-to-pacscript.sh"; do [ -f "$f" ] && printf 'script %s %s\n' "$(basename "$f")" "$(sha256_file "$f")" done local_sources "$apk" | while IFS= read -r f; do @@ -235,13 +238,17 @@ publish_output() { if [ "$format" = apk ]; then cp -R "$dist/$target/." "$tmp/" || return 1 else - find "$dist" -type f \( -name '*.tar.gz' -o -name '*.sha256' \) \ + find "$dist" -type f \( -name '*.tar.gz' -o -name '*.deb' -o -name '*.sha256' \) \ -exec sh -c 'dest=$1; shift; cp "$@" "$dest/"' sh "$tmp" {} + || return 1 fi - artifact=$(cd "$tmp" && find . -type f -name "$pkg-$ver-r$rel.$format") + if [ "$format" = deb ]; then + artifact=$(cd "$tmp" && find . -type f -name "${pkg}_*.deb") + else + artifact=$(cd "$tmp" && find . -type f -name "$pkg-$ver-r$rel.$format") + fi [ -n "$artifact" ] && [ "$(printf '%s\n' "$artifact" | wc -l | tr -d ' ')" -eq 1 ] || { rm -rf "$tmp"; warning 'missing or ambiguous primary package'; return 1; } artifact=${artifact#./} - (cd "$tmp" && find . -type f \( -name '*.apk' -o -name '*.tar.gz' \) | sort) >"$tmp/files" + (cd "$tmp" && find . -type f \( -name '*.apk' -o -name '*.tar.gz' -o -name '*.deb' \) | sort) >"$tmp/files" while IFS= read -r file; do digest=$(sha256_file "$tmp/$file") [ "${#digest}" -eq 64 ] || return 1 @@ -365,7 +372,7 @@ artifact_status() { s_format=${s_format:-tar.gz} [ -z "${FPKGS_FORMAT:-}" ] || [ "$s_format" = "$(package_format)" ] || continue s_seen=1 - case "$s_format" in apk | tar.gz) ;; *) continue ;; esac + case "$s_format" in apk | tar.gz | deb) ;; *) continue ;; esac s_dir=${s_manifest%/manifest} s_ver=$(pkg_field "$s_manifest" pkgver) s_rel=$(pkg_field "$s_manifest" pkgrel)
diff --git a/scripts/functions.sh b/scripts/functions.sh @@ -127,8 +127,8 @@ package_format() { esac fi case "$_format" in - apk | tar.gz) printf '%s\n' "$_format" ;; - *) die "unsupported package format: $_format (use apk or tar.gz)" ;; + apk | tar.gz | deb) printf '%s\n' "$_format" ;; + *) die "unsupported package format: $_format (use apk, tar.gz or deb)" ;; esac }
diff --git a/scripts/prepare-ci-host.sh b/scripts/prepare-ci-host.sh @@ -8,9 +8,9 @@ case "$mode" in --plan | --simulate | --install) [ "$#" -eq 0 ] || shift ;; *) die 'usage: prepare-ci-host.sh [--plan|--simulate|--install] [BOOTSTRAP_DIR]' ;; esac -[ "$#" -le 1 ] || die 'expected at most one bootstrap-binaries directory' -bootstrap=${1:-$root/../bootstrap-binaries} -[ -d "$bootstrap" ] || die "bootstrap-binaries directory not found: $bootstrap" +[ "$#" -le 1 ] || die 'expected at most one foundationpkgs-binaries directory' +bootstrap=${1:-$root/../foundationpkgs-binaries} +[ -d "$bootstrap" ] || die "foundationpkgs-binaries directory not found: $bootstrap" bootstrap=$(CDPATH= cd -- "$bootstrap" && pwd) if [ "$mode" != --plan ]; then [ -r /etc/os-release ] || die 'Debian 13 amd64 is required'
diff --git a/stage0/abuild/README.md b/stage0/abuild/README.md @@ -1,7 +1,7 @@ # abuild bootstrap recipe Pinned upstream abuild with the same minimal shell patch used by -`~/Projects/bootstrap-binaries`: Debian's `/bin/busybox ash` replaces Alpine's +`~/Projects/foundationpkgs-binaries`: Debian's `/bin/busybox ash` replaces Alpine's `/bin/ash -e`, preserving `set -e`. There is no maintained abuild fork. Build on the Debian host after provisioning native `apk-tools`, BusyBox, @@ -14,7 +14,7 @@ scripts/build.sh -f tar.gz stage0/abuild/APKBUILD That explicit legacy-format invocation produces a tarball. Linux now defaults to real APK output through upstream abuild; use `-f apk` and an explicit target for that path. `stage0/` is not a default recipe-discovery bucket, so use the -explicit recipe path. Debian bootstrap `.deb` files live in `bootstrap-binaries`. +explicit recipe path. Debian bootstrap `.deb` files live in `foundationpkgs-binaries`. The recipe is also usable by real upstream abuild, with its normal package and index signing. When running on Debian, `abuild -d` leaves build dependencies to
diff --git a/tests/deb-backend.sh b/tests/deb-backend.sh @@ -0,0 +1,53 @@ +#!/bin/sh +set -eu +root=$(CDPATH= cd -- "$(dirname "$0")/.." && pwd) +if [ "$(uname -s)" != Linux ] || ! command -v dpkg-deb >/dev/null 2>&1; then + echo 'SKIP: real Debian backend checks require Linux and dpkg-deb'; exit 0 +fi +work=$(mktemp -d) +trap 'rm -rf "$work"' 0 +mkdir -p "$work/recipe" +cat > "$work/recipe/APKBUILD" <<'RECIPE' +pkgname=deb-fixture +pkgver=1.0 +pkgrel=2 +deb_pkgver=1.0 +pkgdesc="Debian backend fixture" +url="https://example.invalid" +source="" +build() { :; } +package() { + mkdir -p "$pkgdir/usr/bin" + printf '#!/bin/sh\necho fixture\n' > "$pkgdir/usr/bin/deb-fixture" + chmod 755 "$pkgdir/usr/bin/deb-fixture" +} +RECIPE +"$root/scripts/build.sh" -f deb -t x86_64-unknown-linux-gnu -o "$work/out" "$work/recipe/APKBUILD" > "$work/build.log" 2>&1 +file=$work/out/x86_64-unknown-linux-gnu/deb-fixture_1.0-2_amd64.deb +[ "$(dpkg-deb -f "$file" Package)" = deb-fixture ] +[ "$(dpkg-deb -f "$file" Version)" = 1.0-2 ] +[ "$(dpkg-deb -f "$file" Architecture)" = amd64 ] +dpkg-deb -c "$file" | grep -q 'root/root.*usr/bin/deb-fixture' +[ "$(sha256sum "$file" | awk '{print $1}')" = "$(awk 'NR==1{print $1}' "$file.sha256")" ] +if "$root/scripts/build.sh" -f deb -t aarch64-unknown-linux-gnu -o "$work/rejected" "$work/recipe/APKBUILD" >/dev/null 2>&1; then exit 1; fi +awk '!/^deb_pkgver=/' "$work/recipe/APKBUILD" > "$work/recipe/no-opt-in" +if "$root/scripts/build.sh" -f deb -t x86_64-unknown-linux-gnu -o "$work/rejected" "$work/recipe/no-opt-in" >/dev/null 2>&1; then exit 1; fi +# Exercise the same publication/status interface CI uses, not just dpkg-deb. +mkdir -p "$work/repo/Unix/deb-fixture" +cp -R "$root/scripts" "$work/repo/" +cp "$work/recipe/APKBUILD" "$work/repo/Unix/deb-fixture/APKBUILD" +(cd "$work/repo" && git init -q && git add . && git -c user.name=Test -c user.email=test@example.invalid commit -qm fixture) +rev=$(git -C "$work/repo" rev-parse HEAD) +export FPKGS_ROOT=$work/repo FPKGS_WORK_ROOT=$work/ci FPKGS_DL_ROOT=$work/published +export FPKGS_FORMAT=deb FPKGS_PACKAGES=deb-fixture FPKGS_TARGETS=x86_64-unknown-linux-gnu +"$root/scripts/fpkgs-ci.sh" run "$rev" > "$work/ci.log" 2>&1 +"$root/scripts/fpkgs-ci.sh" status deb-fixture x86_64-unknown-linux-gnu "$rev" > "$work/status" +grep -q '^format=deb$' "$work/status" +artifact=$(awk -F= '$1=="artifact_path" {print substr($0,index($0,"=")+1)}' "$work/status") +printf 'corrupt' >> "$artifact" +result=0 +"$root/scripts/fpkgs-ci.sh" status deb-fixture x86_64-unknown-linux-gnu "$rev" > "$work/corrupt" || result=$? +[ "$result" = 2 ] +"$root/scripts/fpkgs-ci.sh" run "$rev" > "$work/rebuild.log" 2>&1 +"$root/scripts/fpkgs-ci.sh" status deb-fixture x86_64-unknown-linux-gnu "$rev" > /dev/null +echo 'PASS: rootless Debian metadata/ownership, checksums, target/opt-in guards, publication, status and corrupt-cache rebuild'
: nply/foundationpkgs