pkg-binaries, userland: the 935 MB download survives a failed run
make_repo did rm -rf on build/packages/ARCH/All, the directory tools/pkg-binaries.sh downloads the NetBSD project's binary packages into: every release deleted the download and fetched it again, four times on the MacBook on 2026-11-23, 20 minutes each. The manifest and the key are now written before the first download rather than after the last, and make_repo clears only what the manifest does not name. Verified: a directory with a.tgz, b.tgz (in the manifest) and mine.tgz (not) keeps the first two and loses the third; dash -n on both scripts.
This commit is contained in:
1 parent
7f74532130
commit
bddad95266
2 files changed
+31
-2
No files matched your search
+15
-1
@@ -195,9 +195,23 @@ echo "pkg-binaries: $ARCH $BRANCH: $(wc -l < "$tmp/pkgs" | tr -d ' ') packages,
|
||||
|
||||
[ "$CMD" = fetch ] || exit 0
|
||||
|
||||
# The manifest and the key are written before the first download, not after
|
||||
# the last: a run that is stopped or fails partway used to leave neither, so
|
||||
# the next run could not recognise the archives that were already here and
|
||||
# fetched all 935 MB again (measured 2026-11-23 on the MacBook, four runs).
|
||||
# A file of the wrong size is fetched again below, so an early manifest is
|
||||
# safe.
|
||||
: > "$tmp/files"
|
||||
while read -r p; do
|
||||
file=$(awk -F'\t' -v p="$p" '$1 == p { print $3 }' "$tmp/index")
|
||||
size=$(awk -F'\t' -v p="$p" '$1 == p { print $2 }' "$tmp/index")
|
||||
echo "$file $size" >> "$tmp/files"
|
||||
done < "$tmp/pkgs"
|
||||
cp "$tmp/files" "$OUT/.fetch-files"
|
||||
printf '%s\n' "$fetchkey" > "$OUT/.fetch-key"
|
||||
|
||||
fail=0
|
||||
stale=
|
||||
: > "$tmp/files"
|
||||
while read -r p; do
|
||||
file=$(awk -F'\t' -v p="$p" '$1 == p { print $3 }' "$tmp/index")
|
||||
size=$(awk -F'\t' -v p="$p" '$1 == p { print $2 }' "$tmp/index")
|
||||
|
||||
+16
-1
@@ -252,8 +252,23 @@ make_repo()
|
||||
repo=$("$TOP/tools/pkglist.sh" repo)
|
||||
[ -n "$repo" ] || return 0
|
||||
out=$TOP/build/packages/$ARCH/All
|
||||
rm -rf "$out"
|
||||
# This directory also holds the NetBSD project's binary packages
|
||||
# (tools/pkg-binaries.sh), 935 MB that a run must not throw away: this used
|
||||
# to be an `rm -rf $out', so every release deleted the download and fetched
|
||||
# it again (measured 2026-11-23 on the MacBook, four runs of 20 minutes).
|
||||
# What is cleared is the repository's own set from an earlier run, and
|
||||
# .fetch-files says which files are not it.
|
||||
mkdir -p "$out"
|
||||
if [ -f "$out/.fetch-files" ]; then
|
||||
for f in "$out"/*.tgz; do
|
||||
[ -f "$f" ] || continue
|
||||
b=${f##*/}
|
||||
awk -v b="$b" '$1 == b { found = 1 } END { exit !found }' \
|
||||
"$out/.fetch-files" || rm -f "$f"
|
||||
done
|
||||
else
|
||||
rm -f "$out"/*.tgz
|
||||
fi
|
||||
missing=
|
||||
# The run-time closure. A package's +CONTENTS names its own run-time
|
||||
# dependencies as "@pkgdep name>=version", and those can depend again:
|
||||
|
||||
Reference in new issue
Block a user