* [PATCH 1/2] fix: only remove binary packages created by PN
@ 2026-10-14 15:50 'Felix Moessbauer' via isar-users
2026-10-14 15:50 ` [PATCH 2/2] testsuite: test if variant pkgs are correctly deployed to isar-apt 'Felix Moessbauer' via isar-users
2026-10-19 15:52 ` [PATCH 1/2] fix: only remove binary packages created by PN Zhihang Wei
0 siblings, 2 replies; 3+ messages in thread
From: 'Felix Moessbauer' via isar-users @ 2026-10-14 15:50 UTC (permalink / raw)
To: isar-users; +Cc: gamzenur.kaba, jan.kiszka, Felix Moessbauer
Cleaning the correct set of packages from isar-apt is surprisingly hard.
In fd0d030a we changed the cleanup logic to remove all binary packages
that are created by a single source package. This however broke the case
that multiple build variants (which use the same source package) are
built in a single run, hence each variant cleans all other generated
binary packages on do_deploy_deb. Having multiple builds of a single
variant is perfectly fine in Debian (e.g. independent builds of arch=all
and arch=any packages).
To fix this, we switch back to cleaning just the generated packages, but
we change the clean order on cleansstate: First run deb_clean to remove
the packages from the apt-cache, then run sstate clean to drop the
packages from the cache. Doing it the other way round would result in
the original error fixed in fd0d030a, by which the packages did not get
removed from isar-apt.
Fixes: fd0d030a ("fix(dpkg-build): clean isar-apt by source ...")
Reported-by: Kaba, Gamze Nur <gamzenur.kaba@siemens.com>
Signed-off-by: Felix Moessbauer <felix.moessbauer@siemens.com>
---
meta/classes-recipe/dpkg-base.bbclass | 36 ++++++++++++--------------
meta/classes-recipe/repository.bbclass | 22 ----------------
2 files changed, 17 insertions(+), 41 deletions(-)
diff --git a/meta/classes-recipe/dpkg-base.bbclass b/meta/classes-recipe/dpkg-base.bbclass
index b392211b..4ec0ddbe 100644
--- a/meta/classes-recipe/dpkg-base.bbclass
+++ b/meta/classes-recipe/dpkg-base.bbclass
@@ -229,24 +229,18 @@ python do_dpkg_build_setscene() {
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)
+# Prepend, so that deb_clean() runs before sstate_cleanall(): the latter calls
+# sstate_clean() of do_dpkg_build, which empties DEPLOY_DIR_DEB.
+CLEANFUNCS =+ "deb_clean"
+# Remove by .deb file, so that only the binary packages of this very recipe are
+# dropped (instead of its variants)
deb_clean() {
- repo_del_by_source "${REPO_ISAR_DIR}"/"${DISTRO}" \
- "${REPO_ISAR_DB_DIR}"/"${DISTRO}" "${DEBDISTRONAME}" \
- "${BPN}" ${@deb_clean_archs(d)}
+ [ -d "${DEPLOY_DIR_DEB}" ] || return 0
+ for deb in $(find ${DEPLOY_DIR_DEB} -maxdepth 1 -name '*.deb'); do
+ repo_del_package "${REPO_ISAR_DIR}"/"${DISTRO}" \
+ "${REPO_ISAR_DB_DIR}"/"${DISTRO}" "${DEBDISTRONAME}" "${deb}"
+ done
}
# 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
@@ -255,8 +249,9 @@ do_clean[lockfiles] = "${REPO_ISAR_DIR}/isar.lock"
do_clean[network] = "${TASK_USE_SUDO}"
do_deploy_deb() {
- # Removal is by source name and architecture (deb_clean), so a single scan
- # of DEPLOY_DIR_DEB is only needed for the addition below.
+ # Scan DEPLOY_DIR_DEB once: the same list drives both the removal of the
+ # previous revisions of this recipe's own binary packages and the addition
+ # of the new ones.
debs=$(find ${DEPLOY_DIR_DEB} -maxdepth 1 -name '*.deb')
if [ -z "${debs}" ]; then
# DEPLOY_DIR_DEB is shared by all multiconfigs with the same DISTRO and
@@ -267,7 +262,10 @@ do_deploy_deb() {
bbnote "${DEPLOY_DIR_DEB} is empty, leaving isar-apt untouched"
return
fi
- deb_clean
+ for deb in ${debs}; do
+ repo_del_package "${REPO_ISAR_DIR}"/"${DISTRO}" \
+ "${REPO_ISAR_DB_DIR}"/"${DISTRO}" "${DEBDISTRONAME}" "${deb}"
+ done
repo_add_packages "${REPO_ISAR_DIR}"/"${DISTRO}" \
"${REPO_ISAR_DB_DIR}"/"${DISTRO}" "${DEBDISTRONAME}" ${debs}
}
diff --git a/meta/classes-recipe/repository.bbclass b/meta/classes-recipe/repository.bbclass
index b9097de5..1b6acd9b 100644
--- a/meta/classes-recipe/repository.bbclass
+++ b/meta/classes-recipe/repository.bbclass
@@ -129,28 +129,6 @@ 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/20261014155009.937200-1-felix.moessbauer%40siemens.com.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 2/2] testsuite: test if variant pkgs are correctly deployed to isar-apt
2026-10-14 15:50 [PATCH 1/2] fix: only remove binary packages created by PN 'Felix Moessbauer' via isar-users
@ 2026-10-14 15:50 ` 'Felix Moessbauer' via isar-users
2026-10-19 15:52 ` [PATCH 1/2] fix: only remove binary packages created by PN Zhihang Wei
1 sibling, 0 replies; 3+ messages in thread
From: 'Felix Moessbauer' via isar-users @ 2026-10-14 15:50 UTC (permalink / raw)
To: isar-users; +Cc: gamzenur.kaba, jan.kiszka, Felix Moessbauer
Test package built in two variants that share one source package name and
one architecture, as the kernel recipes do via kbuildtarget.bbclass. Each
variant produces a differently named binary package, so a cleanup that keys
on the source package instead of the recipe is visible in isar-apt.
Regression test for fd0d030a and 1182a45b.
Signed-off-by: Felix Moessbauer <felix.moessbauer@siemens.com>
---
.../recipes-app/test-variants/files/control | 18 +++++++++++++
.../test-variants/test-variants.bb | 25 +++++++++++++++++++
testsuite/cibase.py | 13 ++++++++++
testsuite/citest.py | 20 +++++++++++++++
4 files changed, 76 insertions(+)
create mode 100644 meta-test/recipes-app/test-variants/files/control
create mode 100644 meta-test/recipes-app/test-variants/test-variants.bb
diff --git a/meta-test/recipes-app/test-variants/files/control b/meta-test/recipes-app/test-variants/files/control
new file mode 100644
index 00000000..b171c7e7
--- /dev/null
+++ b/meta-test/recipes-app/test-variants/files/control
@@ -0,0 +1,18 @@
+Source: test-variants
+Section: misc
+Priority: optional
+Maintainer: isar-users <isar-users@googlegroups.com>
+Build-Depends: debhelper-compat (= 10),
+Standards-Version: 4.1.3
+
+Package: test-variants
+Architecture: any
+Build-Profiles: <pkg.test-variants.base>
+Description: Binary package of the base recipe
+ Built by the base recipe only.
+
+Package: test-variants-extra
+Architecture: any
+Build-Profiles: <pkg.test-variants.extra>
+Description: Binary package of the -kbuildtarget variant
+ Built by the -kbuildtarget variant only.
diff --git a/meta-test/recipes-app/test-variants/test-variants.bb b/meta-test/recipes-app/test-variants/test-variants.bb
new file mode 100644
index 00000000..19382807
--- /dev/null
+++ b/meta-test/recipes-app/test-variants/test-variants.bb
@@ -0,0 +1,25 @@
+# This software is a part of Isar.
+# Copyright (C) 2026 Siemens AG
+#
+# SPDX-License-Identifier: MIT
+#
+# test package built in two variants that share one source package name and
+# one architecture, as the kernel recipes do via kbuildtarget.bbclass. Each
+# variant produces a differently named binary package, so a cleanup that keys
+# on the source package instead of the recipe is visible in isar-apt.
+DPKG_ARCH = "any"
+SRC_URI = "file://control"
+
+MAINTAINER = "isar-users <isar-users@googlegroups.com>"
+
+inherit dpkg-raw
+inherit kbuildtarget
+
+BBCLASSEXTEND = "kbuildtarget"
+
+DEB_BUILD_PROFILES = "pkg.${BPN}.base"
+DEB_BUILD_PROFILES:class-kbuildtarget = "pkg.${BPN}.extra"
+
+do_prepare_build:append() {
+ cp ${WORKDIR}/control ${S}/debian/
+}
diff --git a/testsuite/cibase.py b/testsuite/cibase.py
index 2cf8448b..e5150b36 100755
--- a/testsuite/cibase.py
+++ b/testsuite/cibase.py
@@ -115,6 +115,19 @@ class CIBaseTest(CIBuilder):
with open(config_filename, 'w') as f:
yaml.dump(cfg, f)
+ def isar_apt_packages(self, distro):
+ """Names of the binary packages currently registered in isar-apt."""
+ self.check_init()
+ pattern = os.path.join(self.build_dir, 'tmp', 'deploy', 'isar-apt',
+ distro, '**', 'Packages')
+ packages = set()
+ for index in glob.glob(pattern, recursive=True):
+ with open(index) as f:
+ for line in f:
+ if line.startswith('Package:'):
+ packages.add(line.split(':', 1)[1].strip())
+ return packages
+
def perform_wic_partition_test(self, targets, wic_deploy_parts, **kwargs):
lines = kwargs.get('lines', [])
lines += [
diff --git a/testsuite/citest.py b/testsuite/citest.py
index dfb6eaa2..0cedcc2c 100644
--- a/testsuite/citest.py
+++ b/testsuite/citest.py
@@ -194,6 +194,26 @@ class RepositoryTest(CIBaseTest):
bitbake_cmd='do_rootfs_install',
)
+ def test_repository_shared_source(self):
+ """
+ Test that recipe variants sharing a source package and an
+ architecture keep each other's binary packages in isar-apt.
+ """
+ targets = [
+ 'mc:qemuamd64-trixie:test-variants',
+ 'mc:qemuamd64-trixie:test-variants-kbuildtarget',
+ ]
+
+ self.init()
+ self.delete_from_build_dir('tmp')
+ self.perform_build_test(targets)
+
+ distro = CIUtils.getVars('DISTRO', target=targets[0])
+ packages = self.isar_apt_packages(distro)
+ for package in ('test-variants', 'test-variants-extra'):
+ self.assertIn(package, packages,
+ f"{package} is missing from isar-apt")
+
class SbuildFlavor(CIBaseTest):
"""
--
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/20261014155009.937200-2-felix.moessbauer%40siemens.com.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 1/2] fix: only remove binary packages created by PN
2026-10-14 15:50 [PATCH 1/2] fix: only remove binary packages created by PN 'Felix Moessbauer' via isar-users
2026-10-14 15:50 ` [PATCH 2/2] testsuite: test if variant pkgs are correctly deployed to isar-apt 'Felix Moessbauer' via isar-users
@ 2026-10-19 15:52 ` Zhihang Wei
1 sibling, 0 replies; 3+ messages in thread
From: Zhihang Wei @ 2026-10-19 15:52 UTC (permalink / raw)
To: Felix Moessbauer, isar-users; +Cc: gamzenur.kaba, jan.kiszka
Applied to next, thanks.
Zhihang
On 10/14/26 17:50, 'Felix Moessbauer' via isar-users wrote:
> Cleaning the correct set of packages from isar-apt is surprisingly hard.
> In fd0d030a we changed the cleanup logic to remove all binary packages
> that are created by a single source package. This however broke the case
> that multiple build variants (which use the same source package) are
> built in a single run, hence each variant cleans all other generated
> binary packages on do_deploy_deb. Having multiple builds of a single
> variant is perfectly fine in Debian (e.g. independent builds of arch=all
> and arch=any packages).
>
> To fix this, we switch back to cleaning just the generated packages, but
> we change the clean order on cleansstate: First run deb_clean to remove
> the packages from the apt-cache, then run sstate clean to drop the
> packages from the cache. Doing it the other way round would result in
> the original error fixed in fd0d030a, by which the packages did not get
> removed from isar-apt.
>
> Fixes: fd0d030a ("fix(dpkg-build): clean isar-apt by source ...")
> Reported-by: Kaba, Gamze Nur <gamzenur.kaba@siemens.com>
> Signed-off-by: Felix Moessbauer <felix.moessbauer@siemens.com>
> ---
> meta/classes-recipe/dpkg-base.bbclass | 36 ++++++++++++--------------
> meta/classes-recipe/repository.bbclass | 22 ----------------
> 2 files changed, 17 insertions(+), 41 deletions(-)
>
> diff --git a/meta/classes-recipe/dpkg-base.bbclass b/meta/classes-recipe/dpkg-base.bbclass
> index b392211b..4ec0ddbe 100644
> --- a/meta/classes-recipe/dpkg-base.bbclass
> +++ b/meta/classes-recipe/dpkg-base.bbclass
> @@ -229,24 +229,18 @@ python do_dpkg_build_setscene() {
>
> 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)
> +# Prepend, so that deb_clean() runs before sstate_cleanall(): the latter calls
> +# sstate_clean() of do_dpkg_build, which empties DEPLOY_DIR_DEB.
> +CLEANFUNCS =+ "deb_clean"
>
> +# Remove by .deb file, so that only the binary packages of this very recipe are
> +# dropped (instead of its variants)
> deb_clean() {
> - repo_del_by_source "${REPO_ISAR_DIR}"/"${DISTRO}" \
> - "${REPO_ISAR_DB_DIR}"/"${DISTRO}" "${DEBDISTRONAME}" \
> - "${BPN}" ${@deb_clean_archs(d)}
> + [ -d "${DEPLOY_DIR_DEB}" ] || return 0
> + for deb in $(find ${DEPLOY_DIR_DEB} -maxdepth 1 -name '*.deb'); do
> + repo_del_package "${REPO_ISAR_DIR}"/"${DISTRO}" \
> + "${REPO_ISAR_DB_DIR}"/"${DISTRO}" "${DEBDISTRONAME}" "${deb}"
> + done
> }
> # 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
> @@ -255,8 +249,9 @@ do_clean[lockfiles] = "${REPO_ISAR_DIR}/isar.lock"
> do_clean[network] = "${TASK_USE_SUDO}"
>
> do_deploy_deb() {
> - # Removal is by source name and architecture (deb_clean), so a single scan
> - # of DEPLOY_DIR_DEB is only needed for the addition below.
> + # Scan DEPLOY_DIR_DEB once: the same list drives both the removal of the
> + # previous revisions of this recipe's own binary packages and the addition
> + # of the new ones.
> debs=$(find ${DEPLOY_DIR_DEB} -maxdepth 1 -name '*.deb')
> if [ -z "${debs}" ]; then
> # DEPLOY_DIR_DEB is shared by all multiconfigs with the same DISTRO and
> @@ -267,7 +262,10 @@ do_deploy_deb() {
> bbnote "${DEPLOY_DIR_DEB} is empty, leaving isar-apt untouched"
> return
> fi
> - deb_clean
> + for deb in ${debs}; do
> + repo_del_package "${REPO_ISAR_DIR}"/"${DISTRO}" \
> + "${REPO_ISAR_DB_DIR}"/"${DISTRO}" "${DEBDISTRONAME}" "${deb}"
> + done
> repo_add_packages "${REPO_ISAR_DIR}"/"${DISTRO}" \
> "${REPO_ISAR_DB_DIR}"/"${DISTRO}" "${DEBDISTRONAME}" ${debs}
> }
> diff --git a/meta/classes-recipe/repository.bbclass b/meta/classes-recipe/repository.bbclass
> index b9097de5..1b6acd9b 100644
> --- a/meta/classes-recipe/repository.bbclass
> +++ b/meta/classes-recipe/repository.bbclass
> @@ -129,28 +129,6 @@ 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"
--
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/024d0468-b1e7-478d-a2e8-2f5ed4fbfd72%40ilbers.de.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-10-19 15:54 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-14 15:50 [PATCH 1/2] fix: only remove binary packages created by PN 'Felix Moessbauer' via isar-users
2026-10-14 15:50 ` [PATCH 2/2] testsuite: test if variant pkgs are correctly deployed to isar-apt 'Felix Moessbauer' via isar-users
2026-10-19 15:52 ` [PATCH 1/2] fix: only remove binary packages created by PN Zhihang Wei
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox