From: "'Felix Moessbauer' via isar-users" <isar-users@googlegroups.com>
To: isar-users@googlegroups.com
Cc: jan.kiszka@siemens.com, Felix Moessbauer <felix.moessbauer@siemens.com>
Subject: [PATCH 2/4] fix(dpkg-build): clean isar-apt by source package and arch
Date: Thu, 10 Sep 2026 16:01:59 +0200 [thread overview]
Message-ID: <20260910140201.250854-3-felix.moessbauer@siemens.com> (raw)
In-Reply-To: <20260910140201.250854-1-felix.moessbauer@siemens.com>
deb_clean() removed the packages from isar-apt by iterating the .deb
files in DEPLOY_DIR_DEB. Since do_dpkg_build updates DEPLOY_DIR_DEB via
sstate, its sstate_clean() empties the directory before deb_clean() runs,
so the scan finds nothing and stale packages are left behind in isar-apt.
Remove the packages by their source package name and architecture
instead, using reprepro's removefilter. This no longer depends on the
.deb files being present, is idempotent, and also copes with binary
packages that were split off or renamed between builds.
Fixes: 1182a45b ("fix(dpkg-build): deploy debs via shared sstate dir")
Reported-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Felix Moessbauer <felix.moessbauer@siemens.com>
---
meta/classes-recipe/dpkg-base.bbclass | 22 +++++++++++++++-------
meta/classes-recipe/repository.bbclass | 22 ++++++++++++++++++++++
2 files changed, 37 insertions(+), 7 deletions(-)
diff --git a/meta/classes-recipe/dpkg-base.bbclass b/meta/classes-recipe/dpkg-base.bbclass
index 164f247e..66f4d177 100644
--- a/meta/classes-recipe/dpkg-base.bbclass
+++ b/meta/classes-recipe/dpkg-base.bbclass
@@ -231,14 +231,22 @@ addtask dpkg_build_setscene
CLEANFUNCS += "deb_clean"
+# Architectures under which this recipe's binary packages end up in the repo:
+# the concrete build arch (PACKAGE_ARCH resolves DPKG_ARCH=any), plus "all"
+# when this is the build that also produces the arch-independent packages.
+def deb_clean_archs(d):
+ dpkg_arch = d.getVar('DPKG_ARCH') or 'any'
+ package_arch = d.getVar('PACKAGE_ARCH')
+ host_arch = d.getVar('HOST_ARCH')
+ archs = [package_arch if dpkg_arch == 'any' else dpkg_arch]
+ if package_arch == host_arch and 'all' not in archs:
+ archs.append('all')
+ return ' '.join(a for a in archs if a)
+
deb_clean() {
- DEBS=$( find ${DEPLOY_DIR_DEB} -maxdepth 1 -name "*.deb" || [ ! -d ${S} ] )
- if [ -n "${DEBS}" ]; then
- for d in ${DEBS}; do
- repo_del_package "${REPO_ISAR_DIR}"/"${DISTRO}" \
- "${REPO_ISAR_DB_DIR}"/"${DISTRO}" "${DEBDISTRONAME}" "${d}"
- done
- fi
+ repo_del_by_source "${REPO_ISAR_DIR}"/"${DISTRO}" \
+ "${REPO_ISAR_DB_DIR}"/"${DISTRO}" "${DEBDISTRONAME}" \
+ "${BPN}" ${@deb_clean_archs(d)}
}
# the clean function modifies isar-apt. Do not add DEPLOY_DIR_DEB_LOCK here:
# CLEANFUNCS also runs sstate_cleanall(), which takes that lock itself, and
diff --git a/meta/classes-recipe/repository.bbclass b/meta/classes-recipe/repository.bbclass
index a2061100..d255d1c8 100644
--- a/meta/classes-recipe/repository.bbclass
+++ b/meta/classes-recipe/repository.bbclass
@@ -129,6 +129,28 @@ repo_del_package() {
repo_set_release_date "${dir}" "${codename}"
}
+repo_del_by_source() {
+ local dir="$1"
+ local dbdir="$2"
+ local codename="$3"
+ local source="$4"
+ shift 4
+
+ if [ -n "${GNUPGHOME}" ]; then
+ export GNUPGHOME="${GNUPGHOME}"
+ fi
+ local arch_filter=""
+ local arch
+ for arch in "$@"; do
+ [ -n "${arch_filter}" ] && arch_filter="${arch_filter}|"
+ arch_filter="${arch_filter}Architecture (= ${arch})"
+ done
+ reprepro -b "${dir}" --dbdir "${dbdir}" -C main \
+ removefilter "${codename}" \
+ '$Source (= '"${source}"'), ('"${arch_filter}"'), $PackageType (= deb)'
+ repo_set_release_date "${dir}" "${codename}"
+}
+
repo_contains_package() {
local dir="$1"
local dbdir="$2"
--
2.55.0
--
You received this message because you are subscribed to the Google Groups "isar-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to isar-users+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/isar-users/20260910140201.250854-3-felix.moessbauer%40siemens.com.
next prev parent reply other threads:[~2026-09-10 14:02 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-10 14:01 [PATCH 0/4] Fix various race conditions on multiconfig 'Felix Moessbauer' via isar-users
2026-09-10 14:01 ` [PATCH 1/4] fix(dpkg-build): make sstate updates of DEPLOY_DIR_DEB atomic 'Felix Moessbauer' via isar-users
2026-09-10 14:01 ` 'Felix Moessbauer' via isar-users [this message]
2026-09-10 14:02 ` [PATCH 3/4] fix(dpkg-build): scan DEPLOY_DIR_DEB only once in do_deploy_deb 'Felix Moessbauer' via isar-users
2026-09-10 14:02 ` [PATCH 4/4] fix(dpkg-source): make sstate updates of DEPLOY_DIR_SRC atomic 'Felix Moessbauer' via isar-users
2026-09-15 8:31 ` [PATCH 0/4] Fix various race conditions on multiconfig Zhihang Wei
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260910140201.250854-3-felix.moessbauer@siemens.com \
--to=isar-users@googlegroups.com \
--cc=felix.moessbauer@siemens.com \
--cc=jan.kiszka@siemens.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox