pkg-binaries.sh: a size mismatch means the cached summary is stale -- drop it and the bad file

make release on the MacBook (build/logs/pkg-binaries-amd64.log): 24 packages 'is N bytes, want M'; the
cached pkg_summary.repo.gz was from 2026-11-19.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
lotherkandClaude Sonnet 5.5 committed 2026-11-23 09:59:30 +00:00
1 parent db91645aab
commit 7e9d92d75f
1 file changed
+12 -2
+12 -2
View File
@@ -196,6 +196,7 @@ echo "pkg-binaries: $ARCH $BRANCH: $(wc -l < "$tmp/pkgs" | tr -d ' ') packages,
[ "$CMD" = fetch ] || exit 0
fail=0
stale=
: > "$tmp/files"
while read -r p; do
file=$(awk -F'\t' -v p="$p" '$1 == p { print $3 }' "$tmp/index")
@@ -207,7 +208,12 @@ while read -r p; do
curl -s -f -m 1800 -o "$dst.part" "$REPO/$file" || { echo "FAIL: $file"; fail=1; continue; }
mv "$dst.part" "$dst"
have=$(wc -c < "$dst" | tr -d ' ')
[ "$have" = "$size" ] || { echo "FAIL: $file is $have bytes, want $size"; fail=1; }
# The summary is cached, and the project rebuilds the quarterly branch
# under it: an archive whose size differs from the summary's is a
# newer build, not a damaged download (measured 2026-11-23: 24 of 282
# packages, the cached summary of 2026-11-19). Drop the bad file and
# the summary, so the next run reads the current one.
[ "$have" = "$size" ] || { echo "FAIL: $file is $have bytes, want $size"; rm -f "$dst"; stale=1; fail=1; }
fi
done < "$tmp/pkgs"
@@ -217,7 +223,11 @@ zcat "$SUMMARY" | awk -v list="$tmp/pkgs" '
/^PKGNAME=/ { keep = (substr($0, 9) in want) }
keep
' | gzip -9n > "$OUT/All/pkg_summary.gz"
[ $fail -eq 0 ] || { rm -f "$OUT/.fetch-key"; die "some packages failed"; }
if [ $fail -ne 0 ]; then
rm -f "$OUT/.fetch-key"
[ -z "${stale:-}" ] || { rm -f "$SUMMARY"; echo "pkg-binaries: the cached summary is out of date and was removed; run again"; }
die "some packages failed"
fi
# what this fetch put here, for the next run to see that nothing changed
cp "$tmp/files" "$OUT/.fetch-files"
printf '%s\n' "$fetchkey" > "$OUT/.fetch-key"