Skip to content

gpkg: gapk Phase 7 — apk backend on-target integration#44

Open
ispyisail wants to merge 6 commits into
openwrt-2512from
gapk-phase7-apk-backend
Open

gpkg: gapk Phase 7 — apk backend on-target integration#44
ispyisail wants to merge 6 commits into
openwrt-2512from
gapk-phase7-apk-backend

Conversation

@ispyisail

Copy link
Copy Markdown
Owner

Stacked on #43 — base branch is openwrt-2512 (the 25.12 bump), not master. Merge #43 first; this rebases cleanly onto master afterward.

Continues the gpkg→apk backend work (gapk) into Phase 7: on-target integration and boot-time initialization, now exercised against the real 25.12 apk-tools rather than a lab prototype.

  • Select apk-mbedtls into the vnet-wifi profile for on-target testing.
  • Add the apk_* directives to the gpkg conf template and a conf-file backend switch alongside the existing GPKG_BACKEND env var, so the backend can be chosen per-install rather than only at build time.
  • Initialize apk's own database on boot when the apk backend is selected.
  • Fix a double architecture segment in the apk_repository template.
  • Fix apk's target build silently missing its lua5.1 host dependency — package/system/apk only declared lua/host as a host-build dependency; the target package's own meson configure also needs it, and nothing pulls lua/host into the graph when apk is only selected as a target package (Gargoyle's situation, since gpkg remains the default). New patches-generic/032 adds PKG_BUILD_DEPENDS:=lua/host. Without this, any build selecting apk-mbedtls fails deterministically and non-obviously at package/system/apk/compile.

Verified via a real booted-VM smoke test earlier in this branch's history: full install/remove/reinstall cycle through the actual CGI shapes (install_gargoyle_package.sh/remove_gargoyle_package.sh/plugins.sh), no --allow-untrusted needed anywhere.

Shane Ringrose added 6 commits July 10, 2026 07:30
…testing

gpkg's own apk backend (GPKG_BACKEND=apk, merged in #39) needs a real
apk binary present in the image -- nothing previously selected one.
Picked the mbedtls variant since libmbedtls is already selected on
this profile (avoids pulling in a second TLS stack for openssl).
Re-derived via a real make defconfig + scripts/diffconfig.sh round
trip; confirmed no other symbols changed as a side effect.
conf.c already parses apk_root/apk_repository/apk_keys_dir (added in
earlier gapk phases) but nothing ever emitted them into a real image's
/etc/opkg.conf. Adds them to opkg.gpkg.tmp using the same
version/board/profile substitution tokens as the existing gargoyle
src/gz lines, nested under an "apk" path segment so both feed formats
can be served from the same release tree. Inert for the default legacy
backend.

Also has gpkg-uci-defaults create /etc/gargoyle/apk-keys on first boot,
ready for a release or test signing pubkey to be dropped in later.

Verified via a real scoped package rebuild + host gpkg run: the
rendered template parses cleanly (dest-info reads destinations
correctly; list attempts a real apk_query_json call using the
configured repository, failing only on no real feed/binary present in
this dev environment, not a parsing error). One bug caught and fixed
before this: the added comment used literal %G/%T/%F characters, which
the package's own build-time sed then mangled since it substitutes
those tokens file-wide, not just in the src/gz lines -- reworded in
prose instead.
…pk Phase 7.3)

A CGI process spawned through haserl can't be relied on to inherit an
environment variable the way an interactive shell does, so the
env-only GPKG_BACKEND switch (Phase 3) isn't usable for a real
on-target Plugins UI flow. Adds a `backend apk` conf-file directive,
parsed the same way as the existing apk_root/apk_repository/
apk_keys_dir lines. GPKG_BACKEND still wins if set (unchanged CLI/test
behavior); the conf file is now the on-target mechanism.

Verified all four precedence combinations manually (env unset+conf
unset -> legacy; conf-only apk -> apk codepath attempted; conf apk +
env opkg -> env wins, legacy; env apk + conf unset -> apk codepath),
plus a full re-run of every existing gapk golden suite (48 tests:
17 legacy + 5 apk-read + 10 apk-install + 10 apk-remove/update + 6
apk-local-file), all passing -- this touches shared init code in
main() that every gpkg invocation runs through.
Found via the real booted-VM smoke test: every apk operation, even a
read-only query, fails with "Unable to read database: No such file or
directory" against a fresh root that's never run a real apk command --
installing the apk-mbedtls/apk-openssl package alone doesn't create
/lib/apk/db's actual database file, only the empty directory. Needs an
explicit `apk add --initdb` once. Confirmed idempotent (harmless no-op
on an already-initialized db), so it runs unconditionally on every
boot rather than gating on first-run state.
…7.4)

Found via the real booted-VM smoke test: apk itself appends its own
--print-arch value (e.g. "x86") when fetching
"<apk_repository>/<arch>/APKINDEX.tar.gz" -- the earlier template
version also appended the ipk-side %A token (e.g. "i386_pentium4"),
double-nesting the arch segment and 404ing every real fetch attempt.
package/system/apk declares lua/host only as HOST_BUILD_DEPENDS, which
covers apk's own host build -- but the target package's meson configure
also hard-requires lua5.1 on the host ("Program 'lua5.1' not found").
In this tree nothing ever builds apk/host (gpkg is the default package
manager, apk-mbedtls is selected only as a target package), so lua/host
never enters the build graph and every from-scratch build fails
deterministically at package/system/apk/compile.

Add PKG_BUILD_DEPENDS:=lua/host via a new generic patch so the target
build pulls the host tool in itself.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant