svn commit: r367277 - head
Kyle Evans
kevans at freebsd.org
Mon Jan 18 18:25:26 UTC 2021
On Mon, Nov 2, 2020 at 12:24 PM Emmanuel Vadot <manu at freebsd.org> wrote:
>
> Author: manu
> Date: Mon Nov 2 18:23:50 2020
> New Revision: 367277
> URL: https://svnweb.freebsd.org/changeset/base/367277
>
> Log:
> 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
>
> Modified:
> head/Makefile
> head/Makefile.inc1
>
> [.. snip ..]
> Modified: head/Makefile.inc1
> ==============================================================================
> --- head/Makefile.inc1 Mon Nov 2 17:39:59 2020 (r367276)
> +++ head/Makefile.inc1 Mon Nov 2 18:23:50 2020 (r367277)
> [... snip ...]
> @@ -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}; \
Any objection to making update-packages harmless to run the first
time, too? It'd be nicer for some external scripting to not worry
about the distinction between packages and update-packages if the
real-update-packages target skipped the loop entirely if
${REPODIR}/${PKG_ABI} didn't exist at all.
Thanks,
Kyle Evans
More information about the freebsd-pkgbase
mailing list