git: 4e224e4be7c3 - main - pkgbase: accommodate pkg < 1.17

Ed Maste emaste at FreeBSD.org
Tue Jul 27 18:51:49 UTC 2021


The branch main has been updated by emaste:

URL: https://cgit.FreeBSD.org/src/commit/?id=4e224e4be7c37052567ec4cd2481f299487fc222

commit 4e224e4be7c37052567ec4cd2481f299487fc222
Author:     Ed Maste <emaste at FreeBSD.org>
AuthorDate: 2021-07-27 16:44:45 +0000
Commit:     Ed Maste <emaste at FreeBSD.org>
CommitDate: 2021-07-27 18:50:06 +0000

    pkgbase: accommodate pkg < 1.17
    
    6cafdee71d2b 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 2bfba2a04b05.
    
    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
---
 Makefile.inc1 | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/Makefile.inc1 b/Makefile.inc1
index f7e8f9c41d2f..23fb4b5581ac 100644
--- a/Makefile.inc1
+++ b/Makefile.inc1
@@ -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 \


More information about the dev-commits-src-all mailing list