pkgbase: accommodate pkg < 1.17

6cafdee71d adapted the pkgbase build for 1.17, but broke Cirrus-CI's
use of PKG_FORMAT=tar (the quarterly package set still has pkg 1.16).
Because of this I disabled the pkgbase build and test in 2bfba2a04b.

Now, check `pkg --version` and use the old logic for < 1.17.

To be reverted once we no longer encounter pkg 1.16 in Cirrus-CI (i.e.,
via GCP cloud images) to avoid keeping this extra complexity around.

PR:		257422
Reviewed by:	manu
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D31324
This commit is contained in:
Ed Maste 2021-07-27 12:44:45 -04:00
parent 674400eb20
commit 4e224e4be7

View file

@ -1857,9 +1857,15 @@ _pkgbootstrap: .PHONY
@env ASSUME_ALWAYS_YES=YES pkg bootstrap
.endif
.if make(create-world-packages-jobs) || make(create-kernel-packages*) || make(real-update-packages)
.if make(create-world-packages-jobs) || make(create-kernel-packages*) || make(real-update-packages) || make(sign-packages)
PKG_ABI!=${PKG_CMD} -o ABI_FILE=${WSTAGEDIR}/usr/bin/uname config ABI
.endif
PKG_BIN_VERSION!=${PKG_CMD} --version | awk -F. '{print $$1 * 10000 + $$2 * 100 + $$3}'
.if ${PKG_BIN_VERSION} < 11700
PKG_EXT= ${PKG_FORMAT}
.else
PKG_EXT= pkg
.endif
.if !defined(PKG_VERSION_FROM) && make(real-update-packages)
.if defined(PKG_ABI)
@ -1899,14 +1905,14 @@ real-update-packages: stage-packages .PHONY
@echo "==> Checking for new packages (comparing ${PKG_VERSION} to ${PKG_VERSION_FROM})"
@for pkg in ${PKG_VERSION_FROM_DIR}/${PKG_NAME_PREFIX}-*; do \
pkgname=$$(pkg query -F $${pkg} '%n' | sed 's/${PKG_NAME_PREFIX}-\(.*\)/\1/') ; \
newpkgname=${PKG_NAME_PREFIX}-$${pkgname}-${PKG_VERSION}.pkg ; \
newpkgname=${PKG_NAME_PREFIX}-$${pkgname}-${PKG_VERSION}.${PKG_EXT} ; \
oldsum=$$(pkg query -F $${pkg} '%X') ; \
if [ ! -f ${REPODIR}/${PKG_ABI}/${PKG_VERSION}/$${newpkgname} ]; then \
continue; \
fi ; \
newsum=$$(pkg query -F ${REPODIR}/${PKG_ABI}/${PKG_VERSION}/$${newpkgname} '%X') ; \
if [ "$${oldsum}" == "$${newsum}" ]; then \
echo "==> Keeping old ${PKG_NAME_PREFIX}-$${pkgname}-${PKG_VERSION_FROM}.pkg" ; \
echo "==> Keeping old ${PKG_NAME_PREFIX}-$${pkgname}-${PKG_VERSION_FROM}.${PKG_EXT}" ; \
rm ${REPODIR}/${PKG_ABI}/${PKG_VERSION}/$${newpkgname} ; \
cp $${pkg} ${REPODIR}/${PKG_ABI}/${PKG_VERSION} ; \
else \
@ -2064,6 +2070,9 @@ create-kernel-packages-extra-flavor${flavor:C,^""$,${_default_flavor},}-${_kerne
sign-packages: _pkgbootstrap .PHONY
printf "version = 2;\n" > ${WSTAGEDIR}/meta
.if ${PKG_BIN_VERSION} < 11700
printf "packing_format = \"${PKG_FORMAT}\";\n" >> ${WSTAGEDIR}/meta
.endif
@[ -L "${REPODIR}/$$(${PKG_CMD} -o ABI_FILE=${WSTAGEDIR}/usr/bin/uname config ABI)/latest" ] && \
unlink ${REPODIR}/$$(${PKG_CMD} -o ABI_FILE=${WSTAGEDIR}/usr/bin/uname config ABI)/latest ; \
${PKG_CMD} -o ABI_FILE=${WSTAGEDIR}/usr/bin/uname repo \