From f4978e6bdc77485aca9b5eed151a3dbda64e4047 Mon Sep 17 00:00:00 2001 From: Archipelago Date: Fri, 13 Nov 2026 15:51:14 +0300 Subject: [PATCH] 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. --- pipeline/flatpak-cache.sh | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/pipeline/flatpak-cache.sh b/pipeline/flatpak-cache.sh index ef1306c..59ce6e4 100644 --- a/pipeline/flatpak-cache.sh +++ b/pipeline/flatpak-cache.sh @@ -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"