pkgbase: fix decision logic to keep the old packages

when running update-package, we try to keep as much as possible the old
packages to avoid wasting users bandwidth. the previous code was failing
at catching properly the "snap" extension and we lost incremental build.

With this new code we only stop checking we we have an old package with
the same checksum if we transition from:
- alpha to beta
- beta to rc
- rc to release

but we keep old packages when we transition from release to p1 or when
we stay on a given snapshot

PR:		281393
Reported by:	Evgenii Khramtsov <throwaway_vthgwq4@protonmail.com>
This commit is contained in:
Baptiste Daroussin 2024-09-10 17:56:44 +02:00
parent fd3d3240b0
commit 2b9c818d8d

View file

@ -2038,7 +2038,7 @@ PKG_EXT= pkg
.if exists(${PKG_ABI_FILE}) && exists(${REPODIR}/${PKG_ABI})
PKG_VERSION_FROM!=/usr/bin/readlink ${REPODIR}/${PKG_ABI}/latest
PKG_VERSION_FROM_DIR= ${REPODIR}/${PKG_ABI}/${PKG_VERSION_FROM}
BRANCH_EXT_FROM= ${PKG_VERSION_FROM:C/.*([[:alpha:]][^\.]*).*/\1/}
BRANCH_EXT_FROM= ${PKG_VERSION_FROM:C/^[^[:alpha:]]+p?([[:alpha:]]*)[0-9]+$/\1/}
.else
PKG_VERSION_FROM=
PKG_VERSION_FROM_DIR=
@ -2079,7 +2079,7 @@ real-update-packages: stage-packages .PHONY
continue; \
fi ; \
newsum=$$(pkg query -F ${REPODIR}/${PKG_ABI}/${PKG_VERSION}/$${newpkgname} '%X') ; \
if [ "${BRANCH_EXT_FROM}" == "${BRANCH_EXT}" -a "$${oldsum}" == "$${newsum}" ]; then \
if [ "${BRANCH_EXT_FROM}" == "${BRANCH_EXT:C/[0-9]+$//}" -a "$${oldsum}" == "$${newsum}" ]; then \
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} ; \