commit 77fd006164c9f9549dd114130cac8a37eabe0cb0
Author: Bharatvaj Hemanth <bharatvaj@yahoo.com>
Date: Thu, 29 Oct 2026 22:27:08 +0530
Author: Bharatvaj Hemanth <bharatvaj@yahoo.com>
Date: Thu, 29 Oct 2026 22:27:08 +0530
Package upstream abuild and apk-tools for Debian bootstrap
14 files changed, 330 insertions(+), 0 deletions(-)
A
|
93
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
diff --git a/.gitignore b/.gitignore @@ -0,0 +1,3 @@ +.DS_Store +out/ +*.log
diff --git a/AGENTS.md b/AGENTS.md @@ -0,0 +1,15 @@ +# Bootstrap binaries + +Read `README.md` for the host/package contract, build commands, and smoke test. +This repository distributes upstream tools; keep patches in `patches/` minimal. +Keep the ordinary upstream abuild interface and recipe-controlled toolchains. + +- Store `.deb` binaries and their digests under `packages/debian/<release>/<arch>/`. +- Keep corresponding source archives, checksums, and provenance under `sources/`. +- Build on the documented Debian host using `sh scripts/build-debs.sh`. +- Validate with `sh tests/debian-smoke.sh` on Debian, plus `sh -n` on each script. + The smoke test needs root only for switching to an unprivileged builder and + installing APKs into a disposable root; it never installs live host packages. +- Retain released versions. Bump package revisions when changing shipped bytes. +- Commit no private keys, credentials, local build logs, or temporary roots. +- Choose a remote explicitly before publishing. CI integration is not configured.
diff --git a/README.md b/README.md @@ -0,0 +1,109 @@ +# bootstrap-binaries + +Binary bootstrap packages for a Debian CI host that builds genuine Alpine APKs. +No Docker, Alpine root filesystem, or replacement packaging implementation. + +## Included binaries + +Initial supported host: **Debian 13 (trixie), amd64**. + +| Debian package | Upstream source | Adjustment | +| --- | --- | --- | +| `abuild` 3.18.0~rc5+git20260823-1 | alpinelinux/abuild `2770c8ec05ca2a5bbdaf74e340b9dba0257c1fd5` | One patch: `/bin/busybox ash` instead of `/bin/ash -e`, with `set -e` preserved | +| `apk-tools` 2.14.12-1 | Alpine apk-tools v2.14.12 | Native Debian build, no source patches | + +Packages live in `packages/debian/trixie/amd64/`, with SHA-256 digests. +They include upstream licenses and Debian installed-file checksums. `apk-tools` +includes its native `libapk` shared library and an `ldconfig` trigger. +Sources are kept under `sources/` with checksums; see [provenance](sources/README.md). +These small binary artifacts are stored directly in Git, not Git LFS. + +This is **distribution packaging of upstream software**, not an abuild fork. +Keep portability patches explicit and minimal. Do not add a replacement APKBUILD +parser, custom APK writer, or automatic libc/toolchain policy. + +## Install on Debian + +```sh +cd packages/debian/trixie/amd64 +sha256sum -c SHA256SUMS +sudo apt install ./apk-tools_2.14.12-1_amd64.deb ./abuild_3.18.0~rc5+git20260823-1_amd64.deb +``` + +APT installs ordinary Debian dependencies, including BusyBox, fakeroot, +scanelf (`pax-utils`), getcap (`libcap2-bin`), and `bc`. This repository does not duplicate the entire +Debian base distribution. No APK database/repositories or signing private keys +are installed on the Debian host. + +The upstream privileged helper `abuild-sudo` is deliberately packaged without +its setuid bit. This package does not introduce privileged APK dependency +installation into Debian's system root. + +## Build APKs + +Run as a regular user, using the normal upstream interface: + +```sh +abuild-keygen -a -n +# Install the generated PUBLIC key in /etc/apk/keys for local index verification. +# The command above prints the key location. Keep its private key out of Git. +sudo install -d -m755 /etc/apk/keys +sudo install -m644 /path/to/generated-key.rsa.pub /etc/apk/keys/ +cd /path/to/recipes/category/package +abuild -d +``` + +`-d` skips **Alpine's dependency checks**: provision the recipe's build tools +through APT or the user's toolchain. `-r` is Alpine's APK-based dependency +installer, not an APT resolver; do not use it to provision Debian dependencies. +This does not skip recipe `check()` execution. Signing, splitting, APK metadata, +repository indexing, and checks remain upstream abuild behavior. The packaged +configuration adds `/usr/sbin` and `/sbin` to PATH for Debian's getcap. + +Configure the usual upstream variables in `~/.config/abuild/abuild.conf` (or +`ABUILD_USERCONF`): `REPODEST`, `SRCDEST`, signing keys, `CARCH`, `CHOST`, compiler +and flags. Binary target compatibility is the recipe/toolchain author's +responsibility. Merely creating an APK does not make a Debian-linked binary +compatible with Alpine. ELF dependency tracing also expects a matching target +APK database, not Debian's dpkg database. Provision that target dependency state +or explicitly control tracing and runtime dependencies for the recipe. This +package imposes no libc conversion policy. + +Use `apk` to manage an Alpine system or an explicitly selected isolated root; +installing APKs directly into the Debian host can conflict with dpkg. + +## Rebuild the Debian packages + +On Debian 13 amd64: + +```sh +sudo apt install build-essential pkgconf libssl-dev zlib1g-dev libzstd-dev patch +sh scripts/build-debs.sh +``` + +The script verifies pinned sources, builds natively in temporary staging, and +produces `.deb` files with root-owned package metadata. It does not install them. +Set `OUTDIR` and `JOBS` to change output location and parallelism. No live CI +configuration or foundationpkgs recipes are changed by this repository. +Man pages and Lua bindings are omitted from these initial bootstrap packages. + +## Verify + +```sh +# With normal runtime dependencies installed: +sudo sh tests/debian-smoke.sh +``` + +The test extracts both `.deb` files into a private temporary tree, builds and +signs two APK versions as `nobody` using upstream abuild and fakeroot, then tests +signature verification, install, upgrade, downgrade, ownership, audit, and removal +in a disposable APK root. It creates no persistent signing keys and installs no +packages into the live Debian system. If testing without installing runtime +prerequisites, `SCANELF_BIN` and `BC_BIN` may point at privately extracted Debian +binaries. `DEBDIR` selects a different artifact directory. + +An APK downgrade restores package files, not application databases or data. +Application recovery still needs backups and compatible migrations. + +Private signing keys and bootstrap host credentials never belong in this repo. +A remote Git destination and long-term release signing policy are not configured.
diff --git a/packages/debian/trixie/amd64/BUILDINFO b/packages/debian/trixie/amd64/BUILDINFO @@ -0,0 +1,7 @@ +Built-At: 2026-10-29T16:54:10Z +Build-Host: 13.6 +Compiler: cc (Debian 14.2.0-19) 14.2.0 +Abuild-Upstream: 2770c8ec05ca2a5bbdaf74e340b9dba0257c1fd5 +Apk-Tools-Upstream: v2.14.12 +a0e3627d8b8075240446900325a4f7ec0056fbdd3b6a1070a8c7d0757bfe2be7 patches/abuild-debian-shell.patch +d47411a007a96953d692b85ba98c602471354e2c0a76cd18b239417b3a89570f scripts/build-debs.sh
diff --git a/packages/debian/trixie/amd64/SHA256SUMS b/packages/debian/trixie/amd64/SHA256SUMS @@ -0,0 +1,2 @@ +50867af7151b9f39d4bb242649f27c81c6eaf2a15f38a6d05fd2e93f6c62c2ea ./abuild_3.18.0~rc5+git20260823-1_amd64.deb +8580d05d05148097eafcca3bc03141ba231ee2d4b301edd899a6d59311716355 ./apk-tools_2.14.12-1_amd64.deb
diff --git a/packages/debian/trixie/amd64/abuild_3.18.0~rc5+git20260823-1_amd64.deb b/packages/debian/trixie/amd64/abuild_3.18.0~rc5+git20260823-1_amd64.deb Binary files differ.
diff --git a/packages/debian/trixie/amd64/apk-tools_2.14.12-1_amd64.deb b/packages/debian/trixie/amd64/apk-tools_2.14.12-1_amd64.deb Binary files differ.
diff --git a/patches/abuild-debian-shell.patch b/patches/abuild-debian-shell.patch @@ -0,0 +1,7 @@ +--- a/abuild.in ++++ b/abuild.in +@@ -1,2 +1,3 @@ +-#!/bin/ash -e ++#!/bin/busybox ash ++set -e + # vim: set filetype=sh:
diff --git a/scripts/build-debs.sh b/scripts/build-debs.sh @@ -0,0 +1,93 @@ +#!/bin/sh +# Build Debian-native upstream abuild and apk-tools. No live installation. +set -eu +root=$(CDPATH= cd -- "$(dirname "$0")/.." && pwd) +[ "$(dpkg --print-architecture)" = amd64 ] || { echo 'This release is tested on Debian 13 amd64 only.' >&2; exit 1; } +for tool in cc make pkg-config dpkg-deb strip patch; do + command -v "$tool" >/dev/null || { echo "Missing build tool: $tool" >&2; exit 1; } +done +pkg-config --exists openssl zlib libzstd +out=${OUTDIR:-$root/packages/debian/trixie/amd64} +mkdir -p "$out" +out=$(CDPATH= cd -- "$out" && pwd) +work=$(mktemp -d) +trap 'rm -rf "$work"' EXIT HUP INT TERM +(cd "$root/sources" && sha256sum -c SHA256SUMS) +tar -xzf "$root/sources/apk-tools-v2.14.12.tar.gz" -C "$work" +tar -xzf "$root/sources/abuild-2770c8e.tar.gz" -C "$work" +apksrc=$work/apk-tools-v2.14.12 +abuildsrc=$work/abuild-2770c8ec05ca2a5bbdaf74e340b9dba0257c1fd5 +make -C "$apksrc" -j"${JOBS:-1}" LUA=no compile +(cd "$abuildsrc" && patch -p1 <"$root/patches/abuild-debian-shell.patch") +programs='abuild abuild-keygen abuild-sign newapkbuild abump apkgrel apkbuild-cpan apkbuild-pypi checkapk apkbuild-gem-resolver' +helpers='abuild-tar abuild-gzsplit abuild-fetch abuild-rm abuild-sudo' +# Man pages use scdoc; these bootstrap binaries don't require it to build. +make -C "$abuildsrc" -j"${JOBS:-1}" $programs $helpers functions.sh abuild.conf + +apkstage=$work/apk-tools +abuildstage=$work/abuild +mkdir -p "$apkstage/DEBIAN" "$apkstage/usr/bin" "$apkstage/usr/lib" "$apkstage/usr/share/doc/apk-tools" +install -m755 "$apksrc/src/apk" "$apkstage/usr/bin/apk" +install -m755 "$apksrc/src/libapk.so.2.14.10" "$apkstage/usr/lib/" +install -m644 "$apksrc/LICENSE" "$apkstage/usr/share/doc/apk-tools/copyright" +cat >"$apkstage/DEBIAN/control" <<'CONTROL' +Package: apk-tools +Version: 2.14.12-1 +Architecture: amd64 +Maintainer: Bootstrap Binaries Maintainers <maintainers@localhost> +Section: admin +Priority: optional +Depends: libc6 (>= 2.38), libssl3t64, zlib1g, libzstd1, ca-certificates +Description: Upstream Alpine package tools built natively for Debian + Produces, indexes, verifies, and manages Alpine APK packages. + No host APK database or repositories are configured by this package. +CONTROL +printf 'activate-noawait ldconfig\n' >"$apkstage/DEBIAN/triggers" + +mkdir -p "$abuildstage/DEBIAN" "$abuildstage/usr/bin" "$abuildstage/usr/share/abuild" "$abuildstage/etc" "$abuildstage/usr/share/doc/abuild" +for program in $programs $helpers; do + install -m755 "$abuildsrc/$program" "$abuildstage/usr/bin/$program" +done +# Keep upstream aliases, but don't introduce a setuid binary on the Debian host. +for name in apk adduser addgroup; do + ln -s abuild-sudo "$abuildstage/usr/bin/abuild-$name" +done +for file in functions.sh default.conf config.sub config.guess sample.APKBUILD sample.initd sample.confd sample.pre-install sample.post-install; do + install -m644 "$abuildsrc/$file" "$abuildstage/usr/share/abuild/$file" +done +chmod 0755 "$abuildstage/usr/share/abuild/config.sub" "$abuildstage/usr/share/abuild/config.guess" +install -m644 "$abuildsrc/abuild.conf" "$abuildstage/etc/abuild.conf" +printf '\n# Debian installs getcap in /usr/sbin.\nexport PATH="$PATH:/usr/sbin:/sbin"\n' >>"$abuildstage/etc/abuild.conf" +install -m644 "$abuildsrc/COPYING" "$abuildstage/usr/share/doc/abuild/copyright" +printf '/etc/abuild.conf\n' >"$abuildstage/DEBIAN/conffiles" +cat >"$abuildstage/DEBIAN/control" <<'CONTROL' +Package: abuild +Version: 3.18.0~rc5+git20260823-1 +Architecture: amd64 +Maintainer: Bootstrap Binaries Maintainers <maintainers@localhost> +Section: devel +Priority: optional +Depends: apk-tools (>= 2.14), busybox, fakeroot, pax-utils, libcap2-bin, bc, openssl, libc6 (>= 2.38), libssl3t64, zlib1g, binutils, build-essential, pkgconf, git, patch, curl, tar, gzip, bzip2, xz-utils, zstd, util-linux +Description: Upstream Alpine APKBUILD packaging tools for a Debian build host + Uses BusyBox ash in place of Alpine's /bin/ash. + Use abuild -d with build dependencies supplied by the Debian host or user. + Cross toolchains and target binary compatibility are controlled by the recipe. +CONTROL +strip --strip-unneeded "$apkstage/usr/bin/apk" "$apkstage/usr/lib/libapk.so.2.14.10" +for helper in $helpers; do strip --strip-unneeded "$abuildstage/usr/bin/$helper"; done +for stage in "$apkstage" "$abuildstage"; do + find "$stage" -type d -exec chmod 0755 {} + + (cd "$stage" && find . -type f ! -path './DEBIAN/*' -exec md5sum {} + | sed 's| ./| |') >"$stage/DEBIAN/md5sums" + name=$(awk '/^Package:/ {print $2}' "$stage/DEBIAN/control") + version=$(awk '/^Version:/ {print $2}' "$stage/DEBIAN/control") + dpkg-deb --root-owner-group --build "$stage" "$out/${name}_${version}_amd64.deb" +done +(cd "$out" && sha256sum ./*.deb >SHA256SUMS) +{ + printf 'Built-At: %s\n' "$(date -u +%Y-%m-%dT%H:%M:%SZ)" + printf 'Build-Host: '; cat /etc/debian_version + printf 'Compiler: '; cc --version | head -n1 + printf 'Abuild-Upstream: 2770c8ec05ca2a5bbdaf74e340b9dba0257c1fd5\nApk-Tools-Upstream: v2.14.12\n' + sha256sum "$root/patches/abuild-debian-shell.patch" "$root/scripts/build-debs.sh" | sed "s|$root/||" +} >"$out/BUILDINFO" +printf 'Packages written to %s\n' "$out"
diff --git a/sources/README.md b/sources/README.md @@ -0,0 +1,18 @@ +# Source provenance + +The committed archives are the sources used to build the Debian packages. +Verify them with `sha256sum -c SHA256SUMS` from this directory. + +- `abuild-2770c8e.tar.gz`: + <https://github.com/alpinelinux/abuild/archive/2770c8ec05ca2a5bbdaf74e340b9dba0257c1fd5.tar.gz> + Upstream commit `2770c8ec05ca2a5bbdaf74e340b9dba0257c1fd5`, 2026-08-23. + GPL-2.0-only; license is inside the archive. Debian adjustment: + `../patches/abuild-debian-shell.patch`. +- `apk-tools-v2.14.12.tar.gz`: + <https://gitlab.alpinelinux.org/alpine/apk-tools/-/archive/v2.14.12/apk-tools-v2.14.12.tar.gz> + Source version 2.14.12, GPL-2.0-only, with bundled components' licenses in + the source tree. Built natively, not extracted from an Alpine binary package. + +Archives were fetched over HTTPS and pinned by SHA-256; upstream release +signatures were not independently verified in this initial bootstrap. +No private signing keys are committed.
diff --git a/sources/SHA256SUMS b/sources/SHA256SUMS @@ -0,0 +1,2 @@ +dde9e38cd4d7074640cc362cd8fe5eeca72f4d4b9b6b657fb70d6f2cdb7d79c4 abuild-2770c8e.tar.gz +62dcb1951108ba24c7478bbca402ea9a34b3bb09baa161b220d0a18e15645e35 apk-tools-v2.14.12.tar.gz
diff --git a/sources/abuild-2770c8e.tar.gz b/sources/abuild-2770c8e.tar.gz Binary files differ.
diff --git a/sources/apk-tools-v2.14.12.tar.gz b/sources/apk-tools-v2.14.12.tar.gz Binary files differ.
diff --git a/tests/debian-smoke.sh b/tests/debian-smoke.sh @@ -0,0 +1,74 @@ +#!/bin/sh +# Run on Debian as root. Packages are extracted privately, never installed live. +set -eu +root=$(CDPATH= cd -- "$(dirname "$0")/.." && pwd) +debs=${DEBDIR:-$root/packages/debian/trixie/amd64} +[ "$(id -u)" -eq 0 ] || { echo 'Run as root for isolated APK install and runuser checks.' >&2; exit 1; } +work=$(mktemp -d) +trap 'rm -rf "$work"' EXIT HUP INT TERM +mkdir -p "$work/runtime" "$work/home" "$work/tools/bin" "$work/testing/fixture" +for deb in "$debs"/*.deb; do dpkg-deb -x "$deb" "$work/runtime"; done +# APT-provided scanelf may be supplied privately without installing pax-utils. +scanelf=${SCANELF_BIN:-$(command -v scanelf || true)} +[ -n "$scanelf" ] || { echo 'Install pax-utils or set SCANELF_BIN.' >&2; exit 1; } +install -m755 "$scanelf" "$work/tools/bin/scanelf" +bc=${BC_BIN:-$(command -v bc || true)} +[ -n "$bc" ] || { echo 'Install bc or set BC_BIN.' >&2; exit 1; } +install -m755 "$bc" "$work/tools/bin/bc" +cat >"$work/testing/fixture/APKBUILD" <<'RECIPE' +pkgname=bootstrap-fixture +pkgver=1 +pkgrel=0 +pkgdesc="Disposable bootstrap packaging test" +url="https://example.invalid" +arch="noarch" +license="MIT" +source="" +builddir="$srcdir" +build() { :; } +check() { echo yes >"$startdir/check-ran"; } +package() { + mkdir -p "$pkgdir/usr/share/bootstrap-fixture" + printf 'version %s\n' "$pkgver" >"$pkgdir/usr/share/bootstrap-fixture/version" +} +RECIPE +cat >"$work/worker.sh" <<'WORKER' +set -eu +cd "$HOME/../testing/fixture" +abuild-keygen -a -n +mkdir -p "$HOME/../keys" +cp "$ABUILD_USERDIR/"*.pub "$HOME/../keys/" +abuild -d +[ -f check-ran ] +sed -i 's/^pkgver=1$/pkgver=2/' APKBUILD +abuild -d +WORKER +# Upstream abuild runs as a normal user and uses fakeroot, as on Alpine. +chown -R nobody:nogroup "$work" +runuser -u nobody -- env HOME="$work/home" PATH="$work/runtime/usr/bin:$work/tools/bin:$PATH" LD_LIBRARY_PATH="$work/runtime/usr/lib" ABUILD_SHAREDIR="$work/runtime/usr/share/abuild" ABUILD_CONF="$work/runtime/etc/abuild.conf" ABUILD_USERDIR="$work/home/.abuild" APK="$work/runtime/usr/bin/apk --keys-dir $work/keys" PACKAGER='Bootstrap Smoke <smoke@example.invalid>' REPODEST="$work/packages" SRCDEST="$work/sources" /bin/sh "$work/worker.sh" +apk=$work/runtime/usr/bin/apk +export LD_LIBRARY_PATH=$work/runtime/usr/lib +keys=$work/keys +mkdir -p "$keys" +cp "$work/home/.abuild/"*.pub "$keys/" +first=$(find "$work/packages" -name 'bootstrap-fixture-1-r0.apk') +second=$(find "$work/packages" -name 'bootstrap-fixture-2-r0.apk') +[ -f "$first" ] && [ -f "$second" ] +"$apk" --keys-dir "$keys" verify "$first" "$second" +index=$(find "$work/packages" -name APKINDEX.tar.gz) +[ -f "$index" ] +tar -tzf "$index" | grep -q '^.SIGN.RSA.' +# Installs only into the disposable APK root, never the Debian host. +"$apk" --root "$work/apk-root" --keys-dir "$keys" --initdb --no-network --no-scripts --force-non-repository add "$first" +[ "$(cat "$work/apk-root/usr/share/bootstrap-fixture/version")" = 'version 1' ] +"$apk" --root "$work/apk-root" --keys-dir "$keys" --no-network --no-scripts --force-non-repository add "$second" +[ "$(cat "$work/apk-root/usr/share/bootstrap-fixture/version")" = 'version 2' ] +"$apk" --root "$work/apk-root" --keys-dir "$keys" --no-network --no-scripts --force-non-repository add "$first" +[ "$(cat "$work/apk-root/usr/share/bootstrap-fixture/version")" = 'version 1' ] +"$apk" --root "$work/apk-root" --no-network info --who-owns /usr/share/bootstrap-fixture/version +printf 'modified\n' >>"$work/apk-root/usr/share/bootstrap-fixture/version" +"$apk" --root "$work/apk-root" --no-network audit --system >"$work/audit.log" +grep -q 'usr/share/bootstrap-fixture/version' "$work/audit.log" +"$apk" --root "$work/apk-root" --no-network --no-scripts del bootstrap-fixture +[ ! -e "$work/apk-root/usr/share/bootstrap-fixture/version" ] +echo 'PASS: non-root upstream abuild, automatic check(), signed APKs/index, install, upgrade, downgrade, ownership, audit, removal'
: nply/foundationpkgs-binaries