From e3065ad823878d35714e39ff5fe922b89d243bd5 Mon Sep 17 00:00:00 2001 From: lotherk Date: Mon, 23 Nov 2026 17:52:13 +0000 Subject: [PATCH] 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. --- tools/userland.sh | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/tools/userland.sh b/tools/userland.sh index 63a9a3fdaa..7276109b22 100755 --- a/tools/userland.sh +++ b/tools/userland.sh @@ -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}')