[1/1] rootfs: unconditionally clean isar-apt lists before deploying

Message ID 20260923154243.2429624-1-felix.moessbauer@siemens.com
State Under Review
Headers show
Series [1/1] rootfs: unconditionally clean isar-apt lists before deploying | expand

Commit Message

MOESSBAUER, Felix Sept. 23, 2026, 3:42 p.m. UTC
The isar-apt data is non-deterministic across builds, as the content of
the isar-apt itself changes whenever new packages are added or removed.
By that, it makes the whole chroot non-reproducible which results in
cache trashing when not building the exactly same set of targets.

As the isar-apt is anyways updated prior to using it (both in sbuild, as
well as in the rootfs tasks), we can safely drop it from the rootfs.

Note, that we cannot do the same for the upstream apt lists, as they
must not change during the build. But as they are never updated and also
do not depend on the bitbake state, it is safe to keep them.

Signed-off-by: Felix Moessbauer <felix.moessbauer@siemens.com>
---
 meta/classes-recipe/rootfs.bbclass | 6 ++++++
 1 file changed, 6 insertions(+)

Patch

diff --git a/meta/classes-recipe/rootfs.bbclass b/meta/classes-recipe/rootfs.bbclass
index d033bdf0..1fa733d9 100644
--- a/meta/classes-recipe/rootfs.bbclass
+++ b/meta/classes-recipe/rootfs.bbclass
@@ -559,6 +559,12 @@  rootfs_postprocess_clean_package_cache() {
         \( -name '*.deb' -o -name '*.bin' \) -delete
 }
 
+# always clean the isar-apt as it is not reproducible and anyways unconditionally updated
+ROOTFS_POSTPROCESS_COMMAND += "rootfs_postprocess_clean_isar_apt_lists"
+rootfs_postprocess_clean_isar_apt_lists() {
+    run_privileged find "${ROOTFSDIR}/var/lib/apt/lists" -type f -name '_isar-apt*' -delete
+}
+
 ROOTFS_POSTPROCESS_COMMAND += "${@bb.utils.contains('ROOTFS_FEATURES', 'clean-apt-lists', 'rootfs_postprocess_clean_apt_lists', '', d)}"
 rootfs_postprocess_clean_apt_lists() {
     run_privileged find "${ROOTFSDIR}/var/lib/apt/lists" -type f -delete