[1/2] rootfs: clean rootfs dir before unpack from sstate

Message ID 20261023133338.32200-1-akarpovich@ilbers.de
State New
Headers show
Series [1/2] rootfs: clean rootfs dir before unpack from sstate | expand

Commit Message

Aliaksei Karpovich Oct. 23, 2026, 1:33 p.m. UTC
In case when rootfs is restored (unpacked) from sstate, we have to clean
rootfs dir because it can contain files from previous build which should
not be included in current rootfs and will not be deleted during unpack.
---
 meta/classes-recipe/rootfs.bbclass | 1 +
 1 file changed, 1 insertion(+)

Patch

diff --git a/meta/classes-recipe/rootfs.bbclass b/meta/classes-recipe/rootfs.bbclass
index 4fd627c2..99e701e9 100644
--- a/meta/classes-recipe/rootfs.bbclass
+++ b/meta/classes-recipe/rootfs.bbclass
@@ -776,6 +776,7 @@  rootfs_install_sstate_finalize() {
     # - after restoring from cache, there will be a tar which we unpack and then delete
     if [ -f rootfs.tar ]; then
         run_privileged_heredoc <<'EOF'
+        rm -rf ${ROOTFSDIR}/*
         mkdir -p ${ROOTFSDIR}
         tar -C ${ROOTFSDIR} -xp ${SSTATE_TAR_ATTR_FLAGS} -f rootfs.tar
 EOF