commit 0f8fe05fb38c18d81fcecea28e14c7f9d6852779
parent 6cb3a14f2ced7da5db75b1bf9dc7b1948d0dcd31
Author: Bharatvaj Hemanth <bharatvaj@yahoo.com>
Date: Sat, 14 Nov 2026 23:51:56 +0530
parent 6cb3a14f2ced7da5db75b1bf9dc7b1948d0dcd31
Author: Bharatvaj Hemanth <bharatvaj@yahoo.com>
Date: Sat, 14 Nov 2026 23:51:56 +0530
Deliver verified Debian CI artifacts to the cdg-1 APT publisher
15 files changed, 166 insertions(+), 20 deletions(-)
diff --git a/.config/Jobfile b/.config/Jobfile @@ -1,5 +1,5 @@ project=foundationpkgs -triggers="refs/heads/main: checks plan packages" +triggers="refs/heads/main: checks plan packages transfer deploy" # Reviewed per-format allowlists; Debian artifacts use the signed APT publisher. ci_apk_packages=${FPKGS_APK_PACKAGES:-} # initify is a required CI tool artifact, even when application selection changes. @@ -41,3 +41,13 @@ packages() { artifact_name=foundationpkgs artifact_url=https://nply.org/dl/foundationpkgs/ } + +transfer() { + FPKGS_ROOT=$srcdir sh "$srcdir/scripts/apt-delivery.sh" transfer "$FETCH_HEAD" $ci_deb_packages +} + +deploy() { + sh "$srcdir/scripts/apt-delivery.sh" deploy "$FETCH_HEAD" || return 1 + artifact_name=foundationpkgs-apt + artifact_url=https://nply.org/dl/foundationpkgs-binaries/apt/ +}
diff --git a/AGENTS.md b/AGENTS.md @@ -1,5 +1,26 @@ # Agent instructions +## Mandatory scripting policy: POSIX sh only + +- Write all project automation, CI jobs, deployment/publisher scripts, tests, + and agent-created helpers in POSIX `sh`. Use `#!/bin/sh` for executable scripts. +- This rule applies locally and on servers, including temporary files, inline + commands, heredocs, generated scripts, and diagnostic or migration helpers. + Do not use Python, Perl, Ruby, JavaScript/TypeScript, Lua, or another scripting + language as an implementation or assistance shortcut. +- Use POSIX shell syntax and standard utilities, or existing native build, + packaging, signing, and transfer tools. Do not require Bash or Zsh, change the + interpreter to evade this rule, or use their extensions (such as `[[ ... ]]`, + arrays, process substitution, or `source`; use POSIX `.` instead). +- Existing non-shell scripts or documentation examples are not permission to + add, restore, invoke, or deploy such helpers. Ask before any exception; if a + task cannot be completed within this policy, report the blocker instead. +- This governs repository tooling and agent assistance, not the implementation + language of upstream software being packaged or its required build tools. +- Before completion, run `sh -n` on every added or modified shell script and + execute the relevant checks with `sh`. A syntax check alone is not proof of + POSIX portability; inspect commands and syntax for non-POSIX extensions. + ## Add or update a package 1. Read [recipe conventions](docs/usage.md#adding-a-new-recipe) and one comparable @@ -15,9 +36,10 @@ Explain if the host cannot build it. Run `sh -n <recipe-path>` and `git diff --check`. 4. For an authorized CI deployment, commit and push the recipe to `main`, then wait for the requested package artifact. A local commit does not start CI; - a successful push does not mean the binary is ready. During the initial APK - rollout, add migrated packages to `ci_packages` in `.config/Jobfile` before - expecting their CI artifact. + a successful push does not mean the binary is ready. Add packages to the + applicable `ci_deb_packages` or `ci_apk_packages` allowlist in `.config/Jobfile`. + For Debian delivery, verify `deploy` passes and the signed APT index includes + the package; a downloadable CI artifact alone is not APT availability. ## CI and binary availability @@ -25,7 +47,8 @@ selects jobs. Minci prefers an explicit/external Jobfile, then `origin/integ:.config/Jobfile`, then the checked-out `.config/Jobfile`. - **Current foundationpkgs configuration (2026-10-29):** only `main` exists; - its `.config/Jobfile` supplies `checks`, `plan`, and `packages`. There is no `integ` branch. + its `.config/Jobfile` supplies `checks`, `plan`, `packages`, `transfer`, and `deploy`. + There is no `integ` branch. See [CI configuration](docs/ci.md#jobfile-selection) when this changes. - Check an exact pushed revision on the publication host (full commit SHA):
diff --git a/Unix/minimal-fxa-server/APKBUILD b/Unix/minimal-fxa-server/APKBUILD @@ -1,6 +1,6 @@ pkgname=minimal-fxa-server pkgver=0_git20260225 -pkgrel=4 +pkgrel=5 # Explicit Debian output opt-in; upstream's underscore version is not Debian-valid. deb_pkgver=0+git20260225 deb_postinst=debian.postinst
diff --git a/Unix/saait/APKBUILD b/Unix/saait/APKBUILD @@ -1,6 +1,6 @@ pkgname=saait pkgver=0.8 -pkgrel=0 +pkgrel=1 deb_pkgver=$pkgver deb_depends="libc6" pkgdesc="The most boring static HTML page generator"
diff --git a/Unix/sqlite-memory/APKBUILD b/Unix/sqlite-memory/APKBUILD @@ -1,6 +1,6 @@ pkgname=sqlite-memory pkgver=1.3.6 -pkgrel=0 +pkgrel=1 deb_pkgver=$pkgver deb_depends="libc6, libstdc++6, libcurl4t64, sqlite-vector" pkgdesc="Persistent searchable memory for AI agents as a SQLite extension (local and remote embeddings)"
diff --git a/Unix/sqlite-vector/APKBUILD b/Unix/sqlite-vector/APKBUILD @@ -1,6 +1,6 @@ pkgname=sqlite-vector pkgver=1.2.0 -pkgrel=0 +pkgrel=1 deb_pkgver=$pkgver deb_depends="libc6" pkgdesc="SQLite extension for vector search"
diff --git a/docs/ci.md b/docs/ci.md @@ -7,7 +7,8 @@ CI deployment is authorized. On `cdg-1`, the Gitolite post-receive hook starts `/usr/local/bin/minci.sh -f foundationpkgs` for pushes to `main`. Minci runs jobs selected by the effective Jobfile. Committing locally does not trigger CI. -The Jobfile runs `checks`, `plan`, and `packages`. `checks` runs shell syntax +The Jobfile runs `checks`, `plan`, `packages`, `transfer`, and `deploy` in order. +Minci stops at the first failed job. `checks` runs shell syntax checks and offline backend/publication/staged-install regressions. Linux builds default to APK and an Alpine-musl target; `FPKGS_FORMAT=tar.gz` explicitly retains legacy output. `FPKGS_TARGETS` selects targets independently. Before deploying @@ -26,8 +27,11 @@ The APK allowlist 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. +Debian CI builds are rootless. The separate `fpkgs-publisher` identity on `cdg-1` +retains verified CI artifacts before signing/activating the APT repository. +The Mac no longer needs to be online for publication. `scripts/apt-delivery.sh` +provides the transfer/deploy handoff; see the binaries repository's `docs/apt.md` +for publisher custody, native-tool checks, and failure handling. Package builds are sequential; your package may be queued behind others. One package can be published even if @@ -119,7 +123,7 @@ The deployed runner selects the first applicable source: **Verified 2026-10-29:** foundationpkgs has only `main`; there is no `integ` branch and no explicit/external override. It therefore uses `main:.config/Jobfile`, -whose trigger is `refs/heads/main: checks plan packages` in this revision. If an `integ` branch is added, +whose trigger is `refs/heads/main: checks plan packages transfer deploy` in this revision. If an `integ` branch is added, its Jobfile takes precedence; the branch being built remains selected by the hook/runner and the jobs' triggers, not by the Jobfile's location. @@ -210,8 +214,12 @@ Unattended third-party-origin upgrades are a separate explicit administrator pol 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. +not change host package state or access the APT archive signing key. The later +`transfer` and `deploy` jobs invoke a fixed, root-owned receiver under the separate +publisher identity using narrowly scoped sudo, not sudo inside package builds. +The receiver independently verifies the copied artifacts for the exact commit. +Publication retains provenance and signed snapshots before HTTPS activation; +`deploy` success, not just `packages` success, means APT delivery completed. ## Install an APK
diff --git a/docs/usage.md b/docs/usage.md @@ -132,6 +132,10 @@ 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. +The Debian backend normalizes payload/archive timestamps using `SOURCE_DATE_EPOCH` +(default: latest recipe-directory commit time, or zero outside Git) and maps +randomized native compiler build paths. Increment `pkgrel` whenever package bytes +change: the APT archive refuses to replace an existing version with different bytes. Recipes declaring `arch="noarch"` (or legacy `any`) produce `_all.deb` with `Architecture: all`, still under the requested Debian target directory. Pacstall is not used: the installed Pacstall's build-only mode still invokes @@ -141,8 +145,8 @@ 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`. +`foundationpkgs-binaries` publisher on `cdg-1` retains them and signs APT metadata +with its private archive key, unavailable to the build identity. See that repository's `docs/apt.md`. ## Service packaging
diff --git a/noarch/initify/APKBUILD b/noarch/initify/APKBUILD @@ -1,6 +1,6 @@ pkgname=initify pkgver=0_git20220129 -pkgrel=1 +pkgrel=2 deb_pkgver=0+git20220129 deb_depends="perl" pkgdesc="Convert simple systemd services to OpenRC init scripts"
diff --git a/scripts/apt-delivery.sh b/scripts/apt-delivery.sh @@ -0,0 +1,37 @@ +#!/bin/sh +# CI data handoff only; signing runs under the separately provisioned publisher. +set -eu +[ "$#" -ge 2 ] || { echo 'usage: apt-delivery.sh transfer|deploy REV [PACKAGE...]' >&2; exit 1; } +action=$1 +rev=$2 +shift 2 +case "$rev" in '' | *[!0-9a-f]*) exit 1 ;; esac +[ "${#rev}" -eq 40 ] || exit 1 +self=$(CDPATH= cd -- "$(dirname "$0")" && pwd) +receiver=${FPKGS_APT_RECEIVER:-/usr/local/libexec/foundationpkgs-apt} +case "$action" in +transfer) + [ "$#" -gt 0 ] || { echo 'No Debian packages selected' >&2; exit 1; } + handoff=${FPKGS_APT_HANDOFF:-/var/lib/foundationpkgs-handoff} + work=$(mktemp -d "$handoff/.transfer.XXXXXX") + trap 'rm -rf "$work"' 0 + trap 'exit 1' HUP INT TERM + for pkg do + case "$pkg" in '' | . | .. | *[!a-z0-9+.-]*) exit 1 ;; esac + status=$(FPKGS_FORMAT=deb "$self/fpkgs-ci.sh" status "$pkg" x86_64-unknown-linux-gnu "$rev") + archive=$(printf '%s\n' "$status" | awk -F= '$1 == "artifact_path" {print substr($0,15)}') + [ -f "$archive" ] || exit 1 + mkdir "$work/$pkg" + cp "${archive%/*}/manifest" "${archive%/*}/SHA256SUMS" "${archive%/*}/build.log" "$archive" "$work/$pkg/" + done + git -C "${FPKGS_ROOT:-.}" archive --format=tar.gz "$rev" > "$work/source.tar.gz" + # The receiver may read the bundle, but never executes or extracts its source. + chmod -R a+rX "$work" + sudo -n -u fpkgs-publisher "$receiver" receive "$rev" "$work" + ;; +deploy) + [ "$#" -eq 0 ] || exit 1 + sudo -n -u fpkgs-publisher "$receiver" deploy "$rev" + ;; +*) exit 1 ;; +esac
diff --git a/scripts/build-deb.sh b/scripts/build-deb.sh @@ -28,7 +28,12 @@ CHOST=$target [ -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" +# Stable archive timestamps across CI reruns; payload changes still need pkgrel bumps. +SOURCE_DATE_EPOCH=${SOURCE_DATE_EPOCH:-$(git -C "$(dirname "$recipe")" log -1 --format=%ct -- . 2>/dev/null || :)} +SOURCE_DATE_EPOCH=${SOURCE_DATE_EPOCH:-0} +case "$SOURCE_DATE_EPOCH" in *[!0-9]*) die 'Invalid SOURCE_DATE_EPOCH' ;; esac +export SOURCE_DATE_EPOCH +FPKGS_REPRODUCIBLE=1 FPKGS_FORMAT=tar.gz "$self/build.sh" -f tar.gz -t "$target" -o "$work/tar" -s "$work/sysroot" -n "$work/native" "$recipe" archive_target=$target case "${arch:-}" in noarch | any) archive_target=noarch; debarch=all ;; @@ -52,6 +57,7 @@ if [ -n "${deb_postinst:-}" ]; then fi (cd "$work/stage" && find . -type f ! -path './DEBIAN/*' -exec md5sum {} +) > "$work/stage/DEBIAN/md5sums" artifact=$output/${pkgname}_${debversion}_${debarch}.deb +find "$work/stage" -exec touch -h -d "@$SOURCE_DATE_EPOCH" {} + 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 @@ -252,6 +252,11 @@ for _dep in ${depends:-} ${makedepends_host:-}; do done sysroot_env +if [ "${FPKGS_REPRODUCIBLE:-0}" = 1 ]; then + # Debian's immutable version archive must not embed randomized build paths. + export CFLAGS="${CFLAGS:-} -ffile-prefix-map=$workdir=." + export CXXFLAGS="${CXXFLAGS:-} -ffile-prefix-map=$workdir=." +fi # --------------------------------------------------------------------------- # If this recipe itself is verify()-only (e.g. build-essentials-stub), run
diff --git a/scripts/fpkgs-ci.sh b/scripts/fpkgs-ci.sh @@ -133,7 +133,7 @@ local_sources() { build_env_fingerprint() { printf 'format=%s\n' "$(package_format)" - for name in MAKEFLAGS CFLAGS CPPFLAGS CXXFLAGS LDFLAGS PKG_CONFIG_PATH PKG_CONFIG_LIBDIR PKG_CONFIG_SYSROOT_DIR CC CXX AR STRIP CHOST CBUILD CTARGET CARCH FPKGS_INIT_SYSTEM FPKGS_ABUILD APK CBUILDROOT SRCDEST options PACKAGER PACKAGER_PUBKEY; do + for name in SOURCE_DATE_EPOCH MAKEFLAGS CFLAGS CPPFLAGS CXXFLAGS LDFLAGS PKG_CONFIG_PATH PKG_CONFIG_LIBDIR PKG_CONFIG_SYSROOT_DIR CC CXX AR STRIP CHOST CBUILD CTARGET CARCH FPKGS_INIT_SYSTEM FPKGS_ABUILD APK CBUILDROOT SRCDEST options PACKAGER PACKAGER_PUBKEY; do eval val=\${$name:-} printf '%s=%s\n' "$name" "$val" done
diff --git a/tests/apt-delivery.sh b/tests/apt-delivery.sh @@ -0,0 +1,50 @@ +#!/bin/sh +# Exercise the real status lookup and a nonprivileged stand-in for the sudo boundary. +set -eu +root=$(CDPATH= cd -- "$(dirname "$0")/.." && pwd) +work=$(mktemp -d) +trap 'rm -rf "$work"' 0 +trap 'exit 1' HUP INT TERM +export FPKGS_ROOT=$work/source FPKGS_DL_ROOT=$work/published FPKGS_APT_HANDOFF=$work/handoff +export FPKGS_APT_RECEIVER=/fixed/receiver CAPTURE=$work/capture +mkdir -p "$FPKGS_ROOT" "$FPKGS_APT_HANDOFF" "$work/bin" +git -C "$FPKGS_ROOT" init -q +printf 'fixture source\n' > "$FPKGS_ROOT/source" +git -C "$FPKGS_ROOT" add source +git -C "$FPKGS_ROOT" -c user.name=Fixture -c user.email=fixture@example.invalid -c commit.gpgsign=false commit -qm fixture +rev=$(git -C "$FPKGS_ROOT" rev-parse HEAD) +out=$FPKGS_DL_ROOT/x86_64-unknown-linux-gnu/fixture/1.0-r0/key +mkdir -p "$out" +printf 'fixture archive\n' > "$out/fixture_1.0-0_amd64.deb" +printf 'pkgname=fixture\npkgver=1.0\npkgrel=0\nformat=deb\nartifact=fixture_1.0-0_amd64.deb\ntarget=x86_64-unknown-linux-gnu\ngitrev=%s\n' "$rev" > "$out/manifest" +printf 'build log\n' > "$out/build.log" +(cd "$out" && shasum -a 256 fixture_1.0-0_amd64.deb > SHA256SUMS) +cat > "$work/bin/sudo" <<'SH' +#!/bin/sh +set -eu +[ "$1" = -n ] && [ "$2" = -u ] && [ "$3" = fpkgs-publisher ] && [ "$4" = /fixed/receiver ] +shift 4 +printf '%s\n' "$@" > "$CAPTURE" +if [ "$1" = receive ]; then + test -s "$3/source.tar.gz" + test -s "$3/fixture/manifest" + test -s "$3/fixture/SHA256SUMS" + test -s "$3/fixture/build.log" +fi +exit "${RECEIVER_FAILURE:-0}" +SH +chmod 755 "$work/bin/sudo" +export PATH=$work/bin:$PATH +sh "$root/scripts/apt-delivery.sh" transfer "$rev" fixture +grep -q '^receive$' "$CAPTURE" +grep -q "^$rev$" "$CAPTURE" +sh "$root/scripts/apt-delivery.sh" deploy "$rev" +grep -q '^deploy$' "$CAPTURE" +if RECEIVER_FAILURE=1 sh "$root/scripts/apt-delivery.sh" deploy "$rev"; then echo 'FAIL: deploy failure hidden'; exit 1; fi +rm "$CAPTURE" +printf 'corruption\n' >> "$out/fixture_1.0-0_amd64.deb" +if sh "$root/scripts/apt-delivery.sh" transfer "$rev" fixture > "$work/rejected" 2>&1; then echo 'FAIL: corrupt transfer accepted'; exit 1; fi +[ ! -e "$CAPTURE" ] +if sh "$root/scripts/apt-delivery.sh" transfer "$rev" ../fixture > "$work/rejected" 2>&1; then echo 'FAIL: invalid package accepted'; exit 1; fi +[ ! -e "$CAPTURE" ] +printf 'PASS: exact-SHA artifact lookup, source/provenance handoff, publisher identity, corrupt-input rejection, deploy failure propagation\n'
diff --git a/tests/deb-backend.sh b/tests/deb-backend.sh @@ -38,6 +38,9 @@ file=$work/out/x86_64-unknown-linux-gnu/deb-fixture_1.0-2_amd64.deb [ "$(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")" ] +sleep 2 +"$root/scripts/build.sh" -f deb -t x86_64-unknown-linux-gnu -o "$work/repeated" "$work/recipe/APKBUILD" > "$work/repeated.log" 2>&1 +cmp "$file" "$work/repeated/x86_64-unknown-linux-gnu/deb-fixture_1.0-2_amd64.deb" 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
: nply/foundationpkgs