commit ca519b2bfb283e6ccd5450e1783fd7b09b259e1a
parent fe3ac9a198f2d49b1bccd59e46662071204da9d5
Author: Bharatvaj Hemanth <bharatvaj@yahoo.com>
Date: Fri, 30 Oct 2026 02:42:47 +0530
parent fe3ac9a198f2d49b1bccd59e46662071204da9d5
Author: Bharatvaj Hemanth <bharatvaj@yahoo.com>
Date: Fri, 30 Oct 2026 02:42:47 +0530
Package initify as a required CI tool with noarch Debian support
10 files changed, 151 insertions(+), 6 deletions(-)
diff --git a/.config/Jobfile b/.config/Jobfile @@ -1,8 +1,10 @@ project=foundationpkgs triggers="refs/heads/main: checks plan packages" -# Reviewed per-format allowlists; FxA is serviced through Debian's signed APT repo. +# Reviewed per-format allowlists; Debian artifacts use the signed APT publisher. ci_apk_packages=${FPKGS_APK_PACKAGES:-} -ci_deb_packages=${FPKGS_DEB_PACKAGES:-minimal-fxa-server} +# initify is a required CI tool artifact, even when application selection changes. +# Builds exercise conversion fixtures; package jobs never install into the host. +ci_deb_packages="initify ${FPKGS_DEB_PACKAGES:-minimal-fxa-server}" checks() { for file in "$srcdir"/scripts/*.sh "$srcdir"/tests/*.sh; do
diff --git a/.config/ci-packages.list b/.config/ci-packages.list @@ -9,6 +9,8 @@ apt ca-certificates apt git apt curl apt patch +# initify's rootless CI build/check and installed converter runtime. +apt perl apt pkgconf apt rsync apt bmake
diff --git a/docs/ci.md b/docs/ci.md @@ -16,8 +16,11 @@ 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. -**Per-format allowlists:** `.config/Jobfile` selects `minimal-fxa-server` for -Debian output through `ci_deb_packages`/`FPKGS_DEB_PACKAGES`. The APK allowlist +**Per-format allowlists:** `.config/Jobfile` always selects `initify` as a required +Debian CI tool artifact, plus `minimal-fxa-server` by default. `FPKGS_DEB_PACKAGES` +changes the application selection without dropping `initify`. Its recipe checks +Perl syntax and converts a synthetic service/timer during each uncached build. +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. @@ -30,6 +33,27 @@ your package may be queued behind others. One package can be published even if other packages fail and the overall job fails. Verify the requested package, target, and revision rather than inferring availability from overall job state. +## Init-system conversion tool + +`noarch/initify/APKBUILD` pins [goose121/initify](https://github.com/goose121/initify) +and packages `initify` and `cronify`. It supports APK, opt-in Debian, and legacy +archive output. The required CI build makes the tool available as an artifact; +it does **not** install packages into the running CI host. Perl is in the host +preparation manifest. Installing the resulting tool follows the normal reviewed +APT workflow after publication through `foundationpkgs-binaries`. + +Use `initify example.service` in a disposable directory: it writes an OpenRC +script beside the input, dropping `.service`. Use `cronify example.timer` to +print a cron schedule. These are build-time helpers, not a service manager. + +Upstream only converts simple services. It does not implement `.path` watchers, +`User`/`Group`, `EnvironmentFile`, `WorkingDirectory`, `ExecStartPre`, systemd +sandboxing, or equivalent oneshot semantics. Timer conversion is also limited; +the recipe exercises only a daily calendar fixture. Never assume the stagit +queue service can be deployed safely by passing it through this converter. +Review generated output and supply platform-specific behavior separately. +No automatic conversion/install/activation is added to package recipes here. + ## Prepare the Debian CI host The maintained host package list is [`.config/ci-packages.list`](../.config/ci-packages.list).
diff --git a/docs/usage.md b/docs/usage.md @@ -132,6 +132,8 @@ 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. +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 sudo, which the CI build identity deliberately lacks.
diff --git a/noarch/initify/APKBUILD b/noarch/initify/APKBUILD @@ -0,0 +1,42 @@ +pkgname=initify +pkgver=0_git20220129 +pkgrel=0 +deb_pkgver=0+git20220129 +deb_depends="perl" +pkgdesc="Convert simple systemd services to OpenRC init scripts" +url="https://github.com/goose121/initify" +arch="noarch" +license="MIT" +depends="perl" +makedepends="perl" +_commit=fa83de1aa5b5bd2477f0a0b86263c6c0d1339f0d +source="$url/archive/$_commit.tar.gz + remove-unused-switch.patch + check.sh" +sha256sums=" +3863890668a943a246f7a4463f6a82f08f0e02b999208976bb9f1dfd781e117b $_commit.tar.gz +f7a311c7a976a2c05925bd61da0f597ebcfb25f89757fb86b3f27362737020d1 remove-unused-switch.patch +c06f7a0e2a2e156217f96b56f77959e5ba439a60e0b8b2a666a22d76def430aa check.sh +" +builddir="$srcdir/$pkgname-$_commit" + +build() { + # Retain checks with the Debian/legacy backend, which does not call check(). + check +} + +check() { + cd "$builddir" + sh "$srcdir/check.sh" +} + +package() { + cd "$builddir" + mkdir -p "$pkgdir/usr/bin" "$pkgdir/usr/share/licenses/$pkgname" "$pkgdir/usr/share/doc/$pkgname" + install -m755 initify.pl "$pkgdir/usr/bin/initify" + # Upstream cronify uses /bin/env, which is not portable to Debian hosts. + sed '1s|.*|#!/usr/bin/perl|' cronify.pl > "$pkgdir/usr/bin/cronify" + chmod 755 "$pkgdir/usr/bin/cronify" + install -m644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE" + install -m644 README.md "$pkgdir/usr/share/doc/$pkgname/README.md" +}
diff --git a/noarch/initify/check.sh b/noarch/initify/check.sh @@ -0,0 +1,24 @@ +#!/bin/sh +set -eu +# Run from the unpacked source directory; only convert synthetic fixtures. +perl -c initify.pl +perl -c cronify.pl +work=$(mktemp -d) +trap 'rm -rf "$work"' 0 +cat > "$work/example.service" <<'UNIT' +[Unit] +Description=Fixture service +[Service] +Type=simple +ExecStart=/usr/bin/example --foreground +PIDFile=/run/example.pid +UNIT +perl initify.pl --name fixture "$work/example.service" +grep -Fx '#!/sbin/openrc-run' "$work/example" +grep -Fx 'command=/usr/bin/example' "$work/example" +grep -Fx 'command_args="--foreground"' "$work/example" +grep -Fx 'pidfile=/run/example.pid' "$work/example" +grep -Fx 'name="fixture"' "$work/example" +sh -n "$work/example" +printf '[Timer]\nOnCalendar=daily\n' > "$work/example.timer" +[ "$(perl cronify.pl "$work/example.timer" | tr -d '[:space:]')" = '@daily' ]
diff --git a/noarch/initify/remove-unused-switch.patch b/noarch/initify/remove-unused-switch.patch @@ -0,0 +1,10 @@ +--- a/initify.pl ++++ b/initify.pl +@@ -5,7 +5,6 @@ + use warnings; + #use strict; + use v5.10.1; +-use feature "switch"; + use Getopt::Long; + use Pod::Usage; +
diff --git a/scripts/build-deb.sh b/scripts/build-deb.sh @@ -29,7 +29,11 @@ CHOST=$target 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 +archive_target=$target +case "${arch:-}" in +noarch | any) archive_target=noarch; debarch=all ;; +esac +archive=$work/tar/$archive_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"
diff --git a/tests/deb-backend.sh b/tests/deb-backend.sh @@ -59,4 +59,11 @@ result=0 [ "$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' +# Architecture-independent recipes use the legacy noarch staging directory, +# but retain the requested Debian publication target and Architecture: all. +printf '\narch="noarch"\n' >> "$work/recipe/APKBUILD" +"$root/scripts/build.sh" -f deb -t x86_64-unknown-linux-gnu -o "$work/noarch" "$work/recipe/APKBUILD" > "$work/noarch.log" 2>&1 +all=$work/noarch/x86_64-unknown-linux-gnu/deb-fixture_1.0-2_all.deb +[ "$(dpkg-deb -f "$all" Architecture)" = all ] +dpkg-deb -c "$all" | grep -q 'root/root.*usr/bin/deb-fixture' +echo 'PASS: rootless Debian metadata/ownership, noarch staging, checksums, target/opt-in guards, publication, status and corrupt-cache rebuild'
diff --git a/tests/initify-recipe.sh b/tests/initify-recipe.sh @@ -0,0 +1,28 @@ +#!/bin/sh +# Offline packaging/CI contract; real source conversion runs in the recipe check. +set -eu +root=$(CDPATH= cd -- "$(dirname "$0")/.." && pwd) +work=$(mktemp -d) +trap 'rm -rf "$work"' 0 +( + srcdir=$work/src + pkgdir=$work/pkg + . "$root/noarch/initify/APKBUILD" + [ "$arch" = noarch ] && [ "$deb_depends" = perl ] + mkdir -p "$builddir" + printf '#!/usr/bin/perl\nprint "initify";\n' > "$builddir/initify.pl" + printf '#!/bin/env perl\nprint "cronify";\n' > "$builddir/cronify.pl" + printf 'MIT\n' > "$builddir/LICENSE" + printf '# Initify\n' > "$builddir/README.md" + package + [ -x "$pkgdir/usr/bin/initify" ] && [ -x "$pkgdir/usr/bin/cronify" ] + [ "$(head -n1 "$pkgdir/usr/bin/cronify")" = '#!/usr/bin/perl' ] + [ -f "$pkgdir/usr/share/licenses/initify/LICENSE" ] +) +( + FPKGS_DEB_PACKAGES=another-application + . "$root/.config/Jobfile" + case " $ci_deb_packages " in *' initify '*) ;; *) exit 1 ;; esac + case " $ci_deb_packages " in *' another-application '*) ;; *) exit 1 ;; esac +) +echo 'PASS: initify package payload, portable interpreter and required CI selection'
: nply/foundationpkgs