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"