Reuse the cached Flatpak export when nothing changed
- prepare-flatpak-seed.sh records the exact ref->commit manifest of the installation; an unchanged manifest keeps the previously verified export instead of rebuilding create-usb, fsck, 123 GPG checks and 192k hashes. - pacman -Sy --needed instead of -Syu: the toolroot is a fixed bootstrap. - flatpak-cache.sh keeps an "unchanged" outcome and verifies each export once (marker) instead of re-hashing 190k files on every run.
This commit is contained in:
parent
bf7028e683
commit
f4978e6bdc
1 changed files with 14 additions and 3 deletions
|
|
@ -33,7 +33,12 @@ grep -q '^DisableSandbox' "$cache/tools/root.x86_64/etc/pacman.conf" || \
|
|||
touch "$attempt/builder-marker"
|
||||
cached=()
|
||||
if [[ -f $cache/current/SHA256SUMS ]]; then
|
||||
(cd "$cache/current"; sha256sum --quiet -c SHA256SUMS)
|
||||
# Full verification of ~190k files costs minutes and the export is immutable
|
||||
# once published, so verify it once and trust the marker afterwards.
|
||||
if [[ ! -f $cache/current/.verified ]]; then
|
||||
(cd "$cache/current"; sha256sum --quiet -c SHA256SUMS)
|
||||
: > "$cache/current/.verified"
|
||||
fi
|
||||
cached=(--bind-ro="$cache/current:/cached-seed")
|
||||
fi
|
||||
result=0
|
||||
|
|
@ -48,10 +53,16 @@ timeout --signal=TERM --kill-after=60 "$timeout_seconds" \
|
|||
--bind-ro="$attempt/builder-marker:/run/archipelago-flatpak-seed-builder" \
|
||||
--bind="$attempt:/seed" --bind="$cache/installation:/var/lib/flatpak" \
|
||||
--bind="$packages:/var/cache/pacman/pkg" "${cached[@]}" \
|
||||
/bin/bash -ec 'pacman-key --init; pacman-key --populate archlinux; pacman -Syu --needed --noconfirm flatpak python diffutils; bash /prepare.sh' \
|
||||
/bin/bash -ec 'pacman-key --init; pacman-key --populate archlinux; pacman -Sy --needed --noconfirm flatpak python diffutils; bash /prepare.sh' \
|
||||
> "$attempt/refresh.log" 2>&1 || result=$?
|
||||
if (( result == 0 )); then
|
||||
if (( result == 0 )) && [[ -f $attempt/no-change ]]; then
|
||||
# The installed refs and their commits did not move: the previous export is
|
||||
# still exact, so skip create-usb, fsck, signature checks and hashing.
|
||||
outcome=unchanged
|
||||
rm -rf "$attempt/export" "$attempt/no-change"
|
||||
elif (( result == 0 )); then
|
||||
(cd "$attempt/export"; sha256sum --quiet -c SHA256SUMS)
|
||||
: > "$attempt/export/.verified"
|
||||
mv "$attempt/export" "$cache/exports/$stamp"
|
||||
ln -s "exports/$stamp" "$cache/current.next"
|
||||
mv -Tf "$cache/current.next" "$cache/current"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue