Include a pkg package in the pkgbase repo

It is essential that users be able to install the FreeBSD base system
from release media and have all the bits needed to update the FreeBSD
base system without touching the ports tree or pkg.freebsd.org.  To
that end, resurrect (and heavily rewrite) the make-pkg-package.sh
script and hook it into the create-packages target; if /usr/ports
exists when building pkgbase packages, we'll also (cross)build pkg
and include it in the repository.

Scripting for actually installing this package as part of the FreeBSD
installation process to come later, but I wanted this in the tree in
time to test it in this week's snapshots.

MFC after:	1 day
Sponsored by:	https://www.patreon.com/cperciva
This commit is contained in:
Colin Percival
2025-09-17 15:34:25 -07:00
parent cddb9806b5
commit 6b5adf3387
2 changed files with 16 additions and 18 deletions
+4 -2
View File
@@ -2039,12 +2039,14 @@ update-packages: .PHONY
${_+_}${MAKE} -C ${.CURDIR} ${PKGMAKEARGS} real-update-packages
package-pkg: .PHONY
.if exists(${PORTSDIR})
rm -rf /tmp/ports.${TARGET} || :
env ${WMAKEENV:Q} SRCDIR=${.CURDIR} PORTSDIR=${PORTSDIR} REVISION=${_REVISION} \
env ${WMAKEENV} SRCDIR=${.CURDIR} PORTSDIR=${PORTSDIR} REVISION=${_REVISION} \
PKG_CMD=${PKG_CMD} PKG_VERSION=${PKG_VERSION} REPODIR=${REPODIR} \
WSTAGEDIR=${WSTAGEDIR} \
OSVERSION="${SRCRELDATE}" \
sh ${.CURDIR}/release/scripts/make-pkg-package.sh
.endif
real-packages: stage-packages create-packages sign-packages .PHONY
@@ -2127,7 +2129,7 @@ create-packages-source: _pkgbootstrap _repodir .PHONY
SOURCE_DATE_EPOCH=${SOURCE_DATE_EPOCH} \
create-source-packages
create-packages: .PHONY create-packages-world create-packages-kernel create-packages-source create-packages-sets
create-packages: .PHONY create-packages-world create-packages-kernel create-packages-source package-pkg create-packages-sets
create-source-src-package: _pkgbootstrap .PHONY
rm -f ${SSTAGEDIR}/src.plist 2>/dev/null || :
+12 -16
View File
@@ -1,26 +1,22 @@
#!/bin/sh
#
#
# Simulate the build environment.
eval $(make -C ${SRCDIR} TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} buildenvvars)
# Simulate the build environment. Note that we need to unset some variables
# which are set in the src tree since they have different (unwanted) effects
# in the ports tree.
SRC_PKG_VERSION=${PKG_VERSION}
PKG_ABI=$(${PKG_CMD} -o ABI_FILE=${WSTAGEDIR}/bin/sh config ABI)
unset PKG_VERSION
unset MAKEFLAGS
unset PKGBASE
export WRKDIRPREFIX=/tmp/ports.${TARGET}
export WSTAGEDIR=${WSTAGEDIR}
export REPODIR=${REPODIR}
export PKG_CMD=${PKG_CMD}
export PKG_VERSION=${PKG_VERSION}
export OSVERSION=${OSVERSION}
export WRKDIR=$(make -C ${PORTSDIR}/ports-mgmt/pkg -V WRKDIR)
make -C ${PORTSDIR}/ports-mgmt/pkg TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
CONFIGURE_ARGS="--host=$(uname -m)-portbld-freebsd${REVISION}" \
stage create-manifest
BATCH=YES stage create-manifest
${PKG_CMD} -o ABI_FILE=${WSTAGEDIR}/bin/sh \
create -v -m ${WRKDIR}/.metadir/ \
${PKG_CMD} -o ABI=${PKG_ABI} \
create -v -m ${WRKDIR}/.metadir.pkg/ \
-r ${WRKDIR}/stage \
-p ${WRKDIR}/.PLIST.mktmp \
-o ${REPODIR}/$(${PKG_CMD} -o ABI_FILE=${WSTAGEDIR}/bin/sh config ABI)/${PKG_VERSION}
mkdir -p ${REPODIR}/$(${PKG_CMD} -o ABI_FILE=${WSTAGEDIR}/bin/sh config ABI)/${PKG_VERSION}/Latest/
cd ${REPODIR}/$(${PKG_CMD} -o ABI_FILE=${WSTAGEDIR}/bin/sh config ABI)/${PKG_VERSION}/Latest/ && \
ln -s ../pkg-*.txz
-o ${REPODIR}/${PKG_ABI}/${SRC_PKG_VERSION}