pkgbootstrap: Gate building from ports

In release builds we want to build pkg from the ports tree for reasons
mentioned in a previous commit; but non-release pkgbase builds may be
just fine with installing pkg from pkg.freebsd.org.

Gate it behind BOOTSTRAP_PKG_FROM_PORTS rather than building form ports
any time we have a ports tree available.

While I'm here, make the pkgbase-repo target in release/Makefile
create the temporary directories we need for building.

Reviewed by:	ivy
MFC after:	6 hours
Sponsored by:	https://www.patreon.com/cperciva
Fixes:	2c06b82443 ("pkgbootstrap: Build pkg if PORTSDIR exists")
This commit is contained in:
Colin Percival 2025-09-19 09:46:21 -07:00
parent b346820299
commit e87b75a8bf
2 changed files with 3 additions and 2 deletions

View file

@ -1992,7 +1992,7 @@ PKG_ABI!= ${PKG_CMD} -o ABI_FILE=${PKG_ABI_FILE} config ABI
_pkgbootstrap: .PHONY
.if make(*package*) && !exists(${LOCALBASE}/sbin/pkg)
.if exists(${PORTSDIR}/ports-mgmt/pkg/Makefile)
.if defined(BOOTSTRAP_PKG_FROM_PORTS)
env - UNAME_r=${UNAME_r} PATH=$$PATH \
make -C ${PORTSDIR}/ports-mgmt/pkg \
I_DONT_CARE_IF_MY_BUILDS_TARGET_THE_WRONG_RELEASE=1 \

View file

@ -195,8 +195,9 @@ PKG_ABI= $$(${PKG_CMD} -o ABI_FILE=${.TARGET}/usr/bin/uname config ABI)
pkgbase-repo:
mkdir -p pkgbase-repo
mkdir -p /tmp/ports /tmp/distfiles
( ${IMAKE} -C ${WORLDDIR} packages REPODIR=${.OBJDIR}/pkgbase-repo \
INCLUDE_PKG_IN_PKGBASE_REPO=YES )
INCLUDE_PKG_IN_PKGBASE_REPO=YES BOOTSTRAP_PKG_FROM_PORTS=YES )
disc1: ${PKGBASE_REPO}
# Install system