Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 18 Jan 2021 12:25:12 -0600
From:      Kyle Evans <kevans@freebsd.org>
To:        Emmanuel Vadot <manu@freebsd.org>
Cc:        freebsd-pkgbase@freebsd.org
Subject:   Re: svn commit: r367277 - head
Message-ID:  <CACNAnaEwUGABHoY9nbB7WH0X0KZx0-pgwBzcGbyZMWnb4VkWaA@mail.gmail.com>
In-Reply-To: <202011021823.0A2INo93086367@repo.freebsd.org>
References:  <202011021823.0A2INo93086367@repo.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, Nov 2, 2020 at 12:24 PM Emmanuel Vadot <manu@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



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