Use explicit local package DB for extension validation and inventory

This commit is contained in:
Pavel Isaev 2026-11-09 04:41:36 +03:00
parent 9e963b87ef
commit 609db0e08d
2 changed files with 15 additions and 4 deletions

View file

@ -124,6 +124,14 @@ Required before claiming hardware readiness:
## Execution order after this audit
Run `20261108T225854Z` passed JSON download and exact nano installation in the
private checkout. Validation then failed because `pacman -Dk` initialized the
runtime DownloadUser=alpm from pacman.conf, absent in this checkout. Post-install
local DB reason updates, consistency checks and inventory now use --config
/dev/null with explicit /usr/lib/archipelago/package-db, matching builder queries.
Repository download/signature checks remain in the package adapter. Confirmation
of validation/finalization and installed activation awaits the next normal run.
Run `20261108T202529Z` passed adapter builds and reached package download in Core
Stage, past the previous lock failure. The package command exited successfully but
its output failed JSON decoding. nspawn defaults to a read-only PTY for nonterminal

View file

@ -147,25 +147,28 @@ systemd-nspawn --settings=no --register=no --private-network --resolv-conf=off "
else
pacman -S --needed --noconfirm --cachedir /inputs -- "${requested[@]}"
fi
# Local DB operations must not initialize repository transport or require
# the runtime DownloadUser in this account-free checkout.
local_db=(pacman --config /dev/null --dbpath /usr/lib/archipelago/package-db)
for target in "${requested[@]}"; do
name=${target%%=*}
if ! grep -Fxq "$name" /explicit-requested; then
pacman -D --asdeps -- "$name"
"${local_db[@]}" -D --asdeps -- "$name"
fi
done
# Add is not an override or base upgrade. Reject any removed/replaced base package.
if [[ ${ARCHIPELAGO_SERVICE_PACKAGE:-0} != 1 ]]; then
while read -r name version; do
[[ $(pacman -Q -- "$name") == "$name $version" ]] || {
[[ $("${local_db[@]}" -Q -- "$name") == "$name $version" ]] || {
echo "Base package replacement requires a separate override: $name" >&2; exit 1;
}
done < /base-packages
fi
pacman -Dk
"${local_db[@]}" -Dk
if command -v dkms >/dev/null; then
/bin/bash /dkms-finalize.sh
fi
pacman -Q > /usr/lib/archipelago/packages.txt
"${local_db[@]}" -Q > /usr/lib/archipelago/packages.txt
/bin/bash -euo pipefail /finalize-managed.sh
' 2>&1 | tee "$generation/logs/transaction.log"
if grep -Ei 'error:|warning:.*(failed|failure)' "$generation/logs/transaction.log"; then