diff --git a/AGENTS.md b/AGENTS.md index 6be7fcf..f7723c4 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -28,7 +28,7 @@ It uses a pure **X11 (`Xlibre` + `sxmo-de-dwm`)** stack (no Wayland) with **Adre - `vendor/edl/`: vendored, patched EDL client library (MIT) used by `flash-edl.py`; a local `edl/` checkout or `BANANARCHY_EDL_DIR` overrides it. - `scripts/rootfs-packages.txt`: single source of truth for the `armv7` rootfs package set, read by both `bootstrap-rootfs.sh` and `rebuild-image.sh`. - `scripts/rootfs-prune-packages.txt`: denylist of Wayland-only, Rust-based, and retired packages purged from existing rootfs trees by `bootstrap-rootfs-container.sh` and `rebuild-image.sh`. -- `scripts/prune-rootfs-packages.sh`: two-phase rootfs pruner (`world` before `apk add`, `purge` after) that reads the denylist; the `world` phase is required so apk can atomically replace Rust `sudo-rs` with C `sudo`. +- `scripts/prune-rootfs-packages.sh`: two-phase rootfs pruner (`world` before `apk add`, `purge` after) that reads the denylist and pins `install_if` packages with negative `!pkg` world constraints plus `apk fix`; the `world` phase is required so apk can atomically replace Rust `sudo-rs` with C `sudo`. ## 3. Build and image generation commands All cross-compilation scripts run inside rootless Docker (`alpine:3.24` `armv7` sysroot) and write to `prebuilt/`; `rebuild-image.sh` mirrors those artifacts into `overlay/rootfs/`: diff --git a/CHANGELOG.md b/CHANGELOG.md index 69df786..685d8cc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,9 +11,13 @@ Release versions follow the `
` format (where `2026` is `a`, ## Unreleased +### Updated Bantam agent and install_if prune fix +- Cross-compiled and installed the updated `bantam-cpp` upstream (`0cd1a67`, "Send stable x-opencode-session header based on project_id") into `prebuilt/bantam/`, `overlay/rootfs/`, and the target rootfs, then rebuilt `images/bananarchy-nokia-argon.img`. +- Fixed a prune regression found during that rebuild: apk re-adds `install_if` packages (`imv-wayland`, `gstreamer-ptp-helper`, `libheif-rav1e`) on every transaction, so `apk del` alone could not remove the Wayland viewer or the two Rust helpers. `scripts/rootfs-prune-packages.txt` now pins them with negative `!pkg` world constraints, and `scripts/prune-rootfs-packages.sh` restores those constraints and runs `apk fix` after each purge. `scripts/check-rebuild.sh` verifies the constraints are present. + ### Lean rootfs, Rust and Wayland removal, and dead code cleanup - Replaced the Rust `sudo-rs` (and its `postmarketos-base-sudo-rs` companion) with the C `sudo` implementation in `scripts/rootfs-packages.txt`; the APK index confirms `sudo` provides `sudo-virt` at priority 100 with the same `sudo`, `sudoedit`, and `visudo` commands, so `postmarketos-base`, `sxmo_power.sh`, `gs-warp-simple.sh`, and the overlay setuid handling are unchanged. -- Added `scripts/prune-rootfs-packages.sh` with a `world` phase (before `apk add`, so apk atomically replaces `sudo-rs` with C `sudo` instead of failing on the `cmd:sudo` conflict) and a `purge` phase (after `apk add`, so `install_if` helpers are not re-added); verified in an `alpine:3.24` container against a real `armv7` pmOS rootfs. +- Added `scripts/prune-rootfs-packages.sh` with a `world` phase (before `apk add`, so apk atomically replaces `sudo-rs` with C `sudo` instead of failing on the `cmd:sudo` conflict) and a `purge` phase (after `apk add`, so retired packages are removed after the transaction); verified in an `alpine:3.24` container against a real `armv7` pmOS rootfs. - Removed the Wayland-purpose `libwpebackend-fdo` from the runtime package set. `webarchy.so` and `libwebkit2gtk-4.1.so` have no `DT_NEEDED` on `libWPEBackend-fdo-1.0.so.1`, and `libwpe` only loads a backend after an explicit `wpe_loader_init` that WebKitGTK never performs; `libwpebackend-fdo-dev` stays in the ephemeral cross-build sysroot for `pkgconf`. - Added `imv-x11` alongside the `imv` wrapper so a clean bootstrap has a working X11 image viewer without pulling `imv-wayland`; the session unsets `WAYLAND_DISPLAY`, so the wrapper always takes the X11 branch. - Removed unused or superseded packages: `mesa-demos` (Wayland-linked demo binaries and `libdecor`), `postmarketos-artwork-wallpapers` (already deleted by the overlay, which ships its own wallpapers), `ttyescape` (with the disabled Rust `hkdm` daemon and `kbd` data), `clickclack` (virtual-keyboard feedback daemon unused with `SXMO_NO_VIRTUAL_KEYBOARD=1`, plus `sdl3`), and `font-twemoji` (fontconfig uses Noto Color Emoji). `glxinfo`, `eglinfo`, and `glxgears` remain via `mesa-utils`; `README.md` and `MANUAL.md` no longer advertise `glteapot` or `es2gears_x11`. diff --git a/overlay/rootfs/usr/bin/bantam b/overlay/rootfs/usr/bin/bantam index 161396b..dda6d96 100755 Binary files a/overlay/rootfs/usr/bin/bantam and b/overlay/rootfs/usr/bin/bantam differ diff --git a/overlay/rootfs/usr/local/bin/bantam b/overlay/rootfs/usr/local/bin/bantam index 161396b..dda6d96 100755 Binary files a/overlay/rootfs/usr/local/bin/bantam and b/overlay/rootfs/usr/local/bin/bantam differ diff --git a/prebuilt/bantam/bantam b/prebuilt/bantam/bantam index 161396b..dda6d96 100755 Binary files a/prebuilt/bantam/bantam and b/prebuilt/bantam/bantam differ diff --git a/scripts/check-rebuild.sh b/scripts/check-rebuild.sh index 0c5bdbe..947ca58 100755 --- a/scripts/check-rebuild.sh +++ b/scripts/check-rebuild.sh @@ -77,6 +77,11 @@ else fail "missing prune entry: $pkg" fi done + for deny in '!imv-wayland' '!gstreamer-ptp-helper' '!libheif-rav1e'; do + if ! grep -Fxq "$deny" "$PRUNE_FILE"; then + fail "missing negative world constraint: $deny" + fi + done fi if [ ! -x "$BASE_DIR/scripts/prune-rootfs-packages.sh" ]; then fail "missing or non-executable scripts/prune-rootfs-packages.sh" diff --git a/scripts/prune-rootfs-packages.sh b/scripts/prune-rootfs-packages.sh index 955248a..220f1ef 100755 --- a/scripts/prune-rootfs-packages.sh +++ b/scripts/prune-rootfs-packages.sh @@ -2,9 +2,10 @@ # Remove Wayland-only, Rust-based, and retired packages from a target rootfs. # Usage: prune-rootfs-packages.sh world|purge # world - drop retired entries from etc/apk/world before apk add, so apk can -# atomically replace conflicting providers (C sudo replaces sudo-rs) -# purge - apk del the still-installed entries after apk add, so install_if -# helpers are not re-added by the same transaction +# atomically replace conflicting providers (C sudo replaces sudo-rs), +# and pin install_if packages with negative constraints +# purge - apk del the still-installed entries after apk add, then re-pin the +# constraints and run apk fix so install_if packages stay removed # Runs inside the build container, where apk and the repositories are available. set -eu @@ -19,18 +20,34 @@ if [ ! -f "$PRUNE_FILE" ]; then echo "Error: missing $PRUNE_FILE" >&2 exit 1 fi -PRUNE_PKGS="$(grep -v '^[[:space:]]*#' "$PRUNE_FILE" | grep -v '^[[:space:]]*$' | tr '\n' ' ')" +PRUNE_PKGS="$(grep -v '^[[:space:]]*#' "$PRUNE_FILE" | grep -v '^[[:space:]]*$' | grep -v '^!' | tr '\n' ' ')" +WORLD_DENY="$(grep '^!' "$PRUNE_FILE" | tr '\n' ' ')" +DENY_NAMES="" +for deny in $WORLD_DENY; do + DENY_NAMES="$DENY_NAMES ${deny#!}" +done + +pin_world_constraints() { + if [ -f "$WORLD_FILE" ]; then + cp "$WORLD_FILE" "$WORLD_FILE.bananarchy-tmp" + else + : > "$WORLD_FILE.bananarchy-tmp" + fi + for pkg in $PRUNE_PKGS $DENY_NAMES; do + grep -vxF "$pkg" "$WORLD_FILE.bananarchy-tmp" > "$WORLD_FILE.bananarchy-tmp2" || true + mv "$WORLD_FILE.bananarchy-tmp2" "$WORLD_FILE.bananarchy-tmp" + grep -vxF "!$pkg" "$WORLD_FILE.bananarchy-tmp" > "$WORLD_FILE.bananarchy-tmp2" || true + mv "$WORLD_FILE.bananarchy-tmp2" "$WORLD_FILE.bananarchy-tmp" + done + for deny in $WORLD_DENY; do + printf '%s\n' "$deny" >> "$WORLD_FILE.bananarchy-tmp" + done + mv "$WORLD_FILE.bananarchy-tmp" "$WORLD_FILE" +} case "$PHASE" in world) - if [ -f "$WORLD_FILE" ]; then - cp "$WORLD_FILE" "$WORLD_FILE.bananarchy-tmp" - for pkg in $PRUNE_PKGS; do - grep -vxF "$pkg" "$WORLD_FILE.bananarchy-tmp" > "$WORLD_FILE.bananarchy-tmp2" || true - mv "$WORLD_FILE.bananarchy-tmp2" "$WORLD_FILE.bananarchy-tmp" - done - mv "$WORLD_FILE.bananarchy-tmp" "$WORLD_FILE" - fi + pin_world_constraints ;; purge) if [ -f "$INSTALLED_DB" ]; then @@ -47,6 +64,12 @@ case "$PHASE" in echo " -> Warning: some retired packages could not be purged" >&2 fi fi + # apk del drops negative constraints, so restore them and let apk fix + # purge the install_if packages that apk del cannot remove on its own. + pin_world_constraints + if ! apk --root "$ROOTFS" --arch armv7 fix --no-scripts; then + echo " -> Warning: apk fix could not enforce the prune constraints" >&2 + fi fi ;; *) diff --git a/scripts/rootfs-prune-packages.txt b/scripts/rootfs-prune-packages.txt index c1da5a4..c3348bd 100644 --- a/scripts/rootfs-prune-packages.txt +++ b/scripts/rootfs-prune-packages.txt @@ -1,7 +1,9 @@ # Packages that must never be present in the final armv7 image. -# Read by scripts/bootstrap-rootfs-container.sh and rebuild-image.sh, which -# remove only the entries actually installed in the target rootfs. +# Read by scripts/prune-rootfs-packages.sh, which removes only the entries +# actually installed in the target rootfs. # One package per line; lines starting with '#' and blank lines are ignored. +# Lines starting with '!' are negative etc/apk/world constraints: apk re-adds +# install_if packages on every transaction, so apk del alone cannot remove them. # Wayland-purpose components (Bananarchy is pure X11). wayland-libs-* are # shared libraries linked by GTK3/WebKitGTK and are deliberately not listed: @@ -33,3 +35,10 @@ font-twemoji mesa-demos postmarketos-artwork-wallpapers ttyescape + +# Negative world constraints for install_if packages. apk del removes these +# constraints, so the pruner restores them and runs apk fix after every purge. +!imv-wayland +!gstreamer-ptp-helper +!libheif-rav1e +!postmarketos-base-sudo-rs