Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 21 Jan 2021 03:58:40 GMT
From:      Kyle Evans <kevans@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 26490d9b74f0 - main - pkgbase: allow update-packages for first-run of packaging
Message-ID:  <202101210358.10L3weTH048954@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by kevans:

URL: https://cgit.FreeBSD.org/src/commit/?id=26490d9b74f0bdefbb9df74dcd285ecd08e0a961

commit 26490d9b74f0bdefbb9df74dcd285ecd08e0a961
Author:     Kyle Evans <kevans@FreeBSD.org>
AuthorDate: 2021-01-18 20:11:58 +0000
Commit:     Kyle Evans <kevans@FreeBSD.org>
CommitDate: 2021-01-21 03:58:30 +0000

    pkgbase: allow update-packages for first-run of packaging
    
    If ${REPODIR}/${PKG_ABI} does not exist when we begin real-update-packages,
    skip the comparison with the non-existent previous repository and just
    finish the repo off. This allows external scripts to just assume they can
    run `update-packages` rather than figuring out if they'd previously run
    `packages` for this Version/Arch combo.
    
    PKG_VERSION_FROM_DIR was added so that we could perhaps detect the three
    distinct cases:
    
    1.) If the repo has not yet been created, PKG_VERSION_FROM_DIR will be
      empty.
    2.) If the repo is in some intermediate state between created and fully
      initialized, PKG_VERSION_FROM_DIR may point to the ABI directory.
    3.) If the repo is fully initialized, then PKG_VERSION_FROM_DIR points to
      the latest build to compare to.
    
    Option #2 is explicitly unhandled at the moment, but this is no different
    than it was before.
    
    Reviewed-by:    manu
    Differential-Revision:  https://reviews.freebsd.org/D28229
---
 Makefile.inc1 | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/Makefile.inc1 b/Makefile.inc1
index 969e3d67cd05..d9ef01eefde5 100644
--- a/Makefile.inc1
+++ b/Makefile.inc1
@@ -1876,7 +1876,13 @@ PKG_ABI!=${PKG_CMD} -o ABI_FILE=${WSTAGEDIR}/usr/bin/uname config ABI
 
 .if !defined(PKG_VERSION_FROM) && make(real-update-packages)
 .if defined(PKG_ABI)
+.if exists(${REPODIR}/${PKG_ABI})
 PKG_VERSION_FROM!=/usr/bin/readlink ${REPODIR}/${PKG_ABI}/latest
+PKG_VERSION_FROM_DIR=	${REPODIR}/${PKG_ABI}/${PKG_VERSION_FROM}
+.else
+PKG_VERSION_FROM=
+PKG_VERSION_FROM_DIR=
+.endif
 .endif
 .endif
 
@@ -1900,8 +1906,11 @@ real-packages:	stage-packages create-packages sign-packages .PHONY
 
 real-update-packages: stage-packages .PHONY
 	${_+_}${MAKE} -C ${.CURDIR} PKG_VERSION=${PKG_VERSION} create-packages
+.if empty(PKG_VERSION_FROM_DIR)
+	@echo "==> Bootstrapping repository, not checking for new packages"
+.else
 	@echo "==> Checking for new packages (comparing ${PKG_VERSION} to ${PKG_VERSION_FROM})"
-	@for pkg in ${REPODIR}/${PKG_ABI}/${PKG_VERSION_FROM}/${PKG_NAME_PREFIX}-*; do \
+	@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_FORMAT} ; \
 	  oldsum=$$(pkg query -F $${pkg} '%X') ; \
@@ -1917,6 +1926,7 @@ real-update-packages: stage-packages .PHONY
 	    echo "==> New package $${newpkgname}" ; \
 	  fi ; \
 	done
+.endif
 	${_+_}@cd ${.CURDIR}; \
 		${MAKE} -f Makefile.inc1 PKG_VERSION=${PKG_VERSION} sign-packages
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202101210358.10L3weTH048954>