aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile.inc1
diff options
context:
space:
mode:
authorEmmanuel Vadot <manu@FreeBSD.org>2020-11-02 18:23:50 +0000
committerEmmanuel Vadot <manu@FreeBSD.org>2020-11-02 18:23:50 +0000
commit0ac8aa55da1cb5e53a9102fd007dd01ee6d17894 (patch)
treee4e370815ab8b3fbe9c705cb1df687ecf6e0a000 /Makefile.inc1
parent36639c3942f587e652d2aba6a71ad45b64c2ce47 (diff)
downloadsrc-0ac8aa55da1cb5e53a9102fd007dd01ee6d17894.tar.gz
src-0ac8aa55da1cb5e53a9102fd007dd01ee6d17894.zip
pkgbase: Add incremental packages
This adds a new target update-packages which will create the new packages compared to the last run. This is how to use it: At this point we cut a release $ make buildworld ... $ make buildkernel $ make packages There is now a PKG_VERSION directory with latest link pointing to it Distribute the packages to server $ something something that update the source tree $ make buildworld ... $ make buildkernel $ make update-packages You know have a PKG_VERSION directory in the REPODIR and latest link pointing to it. In PKG_VERSION dir only the packages which differs from the latest run are named PKG_VERSION, otherwise the old packages are there. The process is : Build the new packages in the PKG_VERSION directory Compare the internal data with the PKG_VERSION_FROM version. The comparison is done by checking the internal hash of the packages. By default PKG_VERSION_FROM is set to what the latest link points to. If the old and new version matches, we rm the new package and cp the old one. Differential Revision: https://reviews.freebsd.org/D25984
Notes
Notes: svn path=/head/; revision=367277
Diffstat (limited to 'Makefile.inc1')
-rw-r--r--Makefile.inc143
1 files changed, 37 insertions, 6 deletions
diff --git a/Makefile.inc1 b/Makefile.inc1
index c52895259e3a..7c9f266eba6c 100644
--- a/Makefile.inc1
+++ b/Makefile.inc1
@@ -568,12 +568,12 @@ EXTRA_REVISION= _${_BRANCH:C/-PRERELEASE/.p/}
.elif ${_BRANCH:M*-p*}
EXTRA_REVISION= _${_BRANCH:C/.*-p([0-9]+$)/\1/}
.endif
-PKG_VERSION= ${_REVISION}${EXTRA_REVISION}
+PKG_VERSION:= ${_REVISION}${EXTRA_REVISION}
.endif
.endif # !defined(PKG_VERSION)
.if !defined(PKG_TIMESTAMP)
-TIMEEPOCHNOW= %s
+TIMEEPOCHNOW= %s
SOURCE_DATE_EPOCH= ${TIMEEPOCHNOW:gmtime}
.else
SOURCE_DATE_EPOCH= ${PKG_TIMESTAMP}
@@ -1855,9 +1855,22 @@ _pkgbootstrap: .PHONY
@env ASSUME_ALWAYS_YES=YES pkg bootstrap
.endif
+.if make(create-world-packages-jobs) || make(create-kernel-packages*) || make(real-update-packages)
+PKG_ABI!=${PKG_CMD} -o ABI_FILE=${WSTAGEDIR}/usr/bin/uname config ABI
+.endif
+
+.if !defined(PKG_VERSION_FROM)
+.if defined(PKG_ABI)
+PKG_VERSION_FROM!=/usr/bin/readlink ${REPODIR}/${PKG_ABI}/latest
+.endif
+.endif
+
packages: .PHONY
${_+_}${MAKE} -C ${.CURDIR} PKG_VERSION=${PKG_VERSION} real-packages
+update-packages: .PHONY
+ ${_+_}${MAKE} -C ${.CURDIR} PKG_VERSION=${PKG_VERSION} real-update-packages
+
package-pkg: .PHONY
rm -rf /tmp/ports.${TARGET} || :
env ${WMAKEENV:Q} SRCDIR=${.CURDIR} PORTSDIR=${PORTSDIR} REVISION=${_REVISION} \
@@ -1867,6 +1880,28 @@ package-pkg: .PHONY
real-packages: stage-packages create-packages sign-packages .PHONY
+real-update-packages: stage-packages .PHONY
+ ${_+_}${MAKE} -C ${.CURDIR} PKG_VERSION=${PKG_VERSION} create-packages
+ @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 \
+ 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') ; \
+ 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_FORMAT}" ; \
+ rm ${REPODIR}/${PKG_ABI}/${PKG_VERSION}/$${newpkgname} ; \
+ cp $${pkg} ${REPODIR}/${PKG_ABI}/${PKG_VERSION} ; \
+ else \
+ echo "==> New package $${newpkgname}" ; \
+ fi ; \
+ done
+ ${_+_}@cd ${.CURDIR}; \
+ ${MAKE} -f Makefile.inc1 PKG_VERSION=${PKG_VERSION} sign-packages
+
stage-packages-world: .PHONY
@mkdir -p ${WSTAGEDIR}
${_+_}@cd ${.CURDIR}; \
@@ -1917,10 +1952,6 @@ create-world-packages: _pkgbootstrap .PHONY
.include "${WSTAGEDIR}/packages.mk"
.endif
-.if make(create-world-packages-jobs) || make(create-kernel-packages*)
-PKG_ABI!=${PKG_CMD} -o ABI_FILE=${WSTAGEDIR}/usr/bin/uname config ABI
-.endif
-
create-world-packages-jobs: .PHONY
.for pkgname in ${_PKGS}
create-world-packages-jobs: create-world-package-${pkgname}