diff --git a/tools/build-lock.sh b/tools/build-lock.sh index a06d541748..572e244051 100755 --- a/tools/build-lock.sh +++ b/tools/build-lock.sh @@ -78,6 +78,7 @@ esac # A nested call (make cdtest -> make release, or a tool started by the lock) # already runs inside the lock. if [ -n "${BUILD_LOCK_HELD:-}" ] && [ -d "$BUILD_LOCK_HELD" ]; then + unset MAKEFLAGS MAKELEVEL MFLAGS sh -c "$1" exit $? fi diff --git a/tools/pkgchroot.sh b/tools/pkgchroot.sh index 31d73652b2..4440d7ea6b 100755 --- a/tools/pkgchroot.sh +++ b/tools/pkgchroot.sh @@ -194,10 +194,20 @@ umount) umount_all ;; mount) sandbox_mount; echo "pkgchroot: mounted" ;; build) shift + # The target comes first: a package of the "makronix" set is installed + # into the sysroot (install, the default), a package of the media's + # repository is built as a binary package (package) -- tools/userland.sh + # passes it, because `install' keeps an old registration and builds no + # archive, so build/packages/All stayed empty and make_repo had nothing + # to put on the media (measured 2026-11-23 on the MacBook). + tgt=install + case ${1:-} in + install|package) tgt=$1; shift ;; + esac sandbox_mount trap 'umount_all' EXIT INT TERM HUP for p in "$@"; do - echo "=== pkgchroot: $p" + echo "=== pkgchroot: $p ($tgt)" # A rebuilt package must replace its registration: pkg_add only # compares names, and the same name is what a changed recipe and a # new archive produce. The old version goes before the install, the @@ -211,7 +221,7 @@ build) [ -n "$pn" ] && chroot "$D" /usr/sbin/pkg_delete -f \ -K /usr/pkg/pkgdb "$pn" > /dev/null 2>&1 || true fi - sandbox_run "$p" install + sandbox_run "$p" "$tgt" done sandbox_clean echo "pkgchroot: packages in build/packages/All" diff --git a/tools/userland.sh b/tools/userland.sh index cd12ba4811..9778911006 100755 --- a/tools/userland.sh +++ b/tools/userland.sh @@ -560,10 +560,21 @@ phase "host tools" ensure_mk_key failed= if [ $MODE = chroot ]; then + # Two targets, the same split the cross path makes: a package of the + # "makronix" set is installed into the sysroot, a package of the media's + # repository is built as a binary package. `install' does neither for a + # repository package -- it sees the version already recorded and keeps + # the old files, so build/packages/All stayed empty and make_repo had + # nothing to put on the media (measured 2026-11-23 on the MacBook). for p in $("$TOP/tools/pkglist.sh" built); do phase "package $p" echo "=== chroot: $p" - "$TOP/tools/pkgchroot.sh" build "$p" || failed="$failed $p" + if "$TOP/tools/pkglist.sh" repo | grep -qx "$p"; then + tgt=package + else + tgt=install + fi + "$TOP/tools/pkgchroot.sh" build "$tgt" "$p" || failed="$failed $p" done else for p in $("$TOP/tools/pkglist.sh" built); do