userland: make_repo clears its own copies, not the download

.make_repo read .fetch-files from $ARCH/All, but tools/pkg-binaries.sh writes
it in $ARCH: the manifest was never found, every .tgz looked foreign, and the
282 downloaded packages were deleted before pkg_add could install them
(measured 2026-11-23 on the MacBook: 'userland: 0 packages in
build/packages/amd64/All', then automake failed on 'perl>=5.0' because perl
was gone).  The function now keeps its own list, .repo-files, and clears only
what it copied itself.
This commit is contained in:
lotherk committed 2026-11-23 17:52:13 +00:00
1 parent 3c3eb59813
commit e3065ad823
1 file changed
+11 -11
+11 -11
View File
@@ -256,19 +256,18 @@ make_repo()
# (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.
# What is cleared is exactly what this function copied last time, listed in
# .repo-files. It used to consult .fetch-files for that, but that manifest
# is written one level up ($ARCH, not $ARCH/All): it was never found here,
# every .tgz looked foreign, and the whole download was deleted anyway
# (measured 2026-11-23: 282 packages gone, then perl missing for automake).
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
if [ -f "$out/.repo-files" ]; then
while read -r b; do
[ -n "$b" ] && rm -f "$out/$b"
done < "$out/.repo-files"
fi
: > "$out/.repo-files"
missing=
# The run-time closure. A package's +CONTENTS names its own run-time
# dependencies as "@pkgdep name>=version", and those can depend again:
@@ -287,6 +286,7 @@ make_repo()
return 0
fi
cp "$TOP/build/packages/All/$1.tgz" "$out/"
echo "$1.tgz" >> "$out/.repo-files"
}
for p in $repo; do
n=$(cd "$PKGSRC/$p" && "$BMAKE" -V '${PKGNAME}')