* [PATCH 1/2] rootfs: clean rootfs dir before unpack from sstate
@ 2026-10-23 13:33 Aliaksei Karpovich
2026-10-23 13:33 ` [PATCH 2/2] testsuite: add test for rootfs sstate Aliaksei Karpovich
2026-10-26 9:47 ` [PATCH 1/2] rootfs: clean rootfs dir before unpack from sstate 'Moessbauer, Felix' via isar-users
0 siblings, 2 replies; 5+ messages in thread
From: Aliaksei Karpovich @ 2026-10-23 13:33 UTC (permalink / raw)
To: isar-users; +Cc: Aliaksei Karpovich
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(+)
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
--
2.53.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/20261023133338.32200-1-akarpovich%40ilbers.de.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 2/2] testsuite: add test for rootfs sstate
2026-10-23 13:33 [PATCH 1/2] rootfs: clean rootfs dir before unpack from sstate Aliaksei Karpovich
@ 2026-10-23 13:33 ` Aliaksei Karpovich
2026-10-26 9:47 ` [PATCH 1/2] rootfs: clean rootfs dir before unpack from sstate 'Moessbauer, Felix' via isar-users
1 sibling, 0 replies; 5+ messages in thread
From: Aliaksei Karpovich @ 2026-10-23 13:33 UTC (permalink / raw)
To: isar-users; +Cc: Aliaksei Karpovich
This test should catch the bug when user builds the same image
multiple times, adds and removes some package in image, but this
package is stayed on rootfs after removing.
The root cause is in sstate for rootfs.
Test conatins 3 build steps:
1. Build the target
2. Add some package in image and build the same target
3. Remove package from image (return back to state in step 1) and
build the target again.
After each step, the test checks for the presence or absence of
the package on the rootfs.
---
testsuite/citest.py | 36 ++++++++++++++++++++++++++++++++++++
1 file changed, 36 insertions(+)
diff --git a/testsuite/citest.py b/testsuite/citest.py
index 0cedcc2c..b701ed13 100644
--- a/testsuite/citest.py
+++ b/testsuite/citest.py
@@ -1563,6 +1563,42 @@ class SstateTest(CIBaseTest):
self.perform_sstate_test(image_target, package_target)
+class RootfsSstateTest(CIBaseTest):
+ """
+ Test for correct behavior of sstate for rootfs.
+ Contains 3 steps:
+ - Step 1: build isar-image-base without any package.
+ - Step 2: build isar-image-base with hello-isar package only.
+ - Step 3: build again isar-image-base without any package.
+
+ :avocado: tags=sstate,fast
+ """
+
+ def test_rootfs_sstate(self):
+ import glob
+
+ image = 'isar-image-base'
+ arch = 'amd64'
+ distro = 'trixie'
+
+ self.init()
+
+ image_target = f'mc:qemu{arch}-{distro}:{image}'
+ hello_bin_file = f'{self.build_dir}/tmp/work/*-{distro}-{arch}/{image}-qemu{arch}/*/rootfs/usr/bin/hello-isar'
+
+ self.perform_build_test(image_target, image_install='', sstate=True)
+ if glob.glob(hello_bin_file):
+ self.fail("Step 1: hello-isar shouldn't be on rootfs")
+
+ self.perform_build_test(image_target, image_install='hello-isar', sstate=True)
+ if not glob.glob(hello_bin_file):
+ self.fail("Step 2: hello-isar should be on rootfs")
+
+ self.perform_build_test(image_target, image_install='', sstate=True)
+ if glob.glob(hello_bin_file):
+ self.fail("Step 3: hello-isar shouldn't be on rootfs")
+
+
class SingleTest(CIBaseTest):
"""
--
2.53.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/20261023133338.32200-2-akarpovich%40ilbers.de.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] rootfs: clean rootfs dir before unpack from sstate
2026-10-23 13:33 [PATCH 1/2] rootfs: clean rootfs dir before unpack from sstate Aliaksei Karpovich
2026-10-23 13:33 ` [PATCH 2/2] testsuite: add test for rootfs sstate Aliaksei Karpovich
@ 2026-10-26 9:47 ` 'Moessbauer, Felix' via isar-users
2026-10-26 11:16 ` Aliaksei Karpovich
1 sibling, 1 reply; 5+ messages in thread
From: 'Moessbauer, Felix' via isar-users @ 2026-10-26 9:47 UTC (permalink / raw)
To: Aliaksei Karpovich, isar-users
On Fri, 2026-10-23 at 15:33 +0200, Aliaksei Karpovich wrote:
> 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(+)
>
> 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}/*
Hi, this skips hidden files. Can't we use
rootfs_install_sstate_finalize[root_cleandirs] += "${ROOTFSDIR}"
instead? Then we could also avoid the following mkdir.
Felix
> mkdir -p ${ROOTFSDIR}
> tar -C ${ROOTFSDIR} -xp ${SSTATE_TAR_ATTR_FLAGS} -f rootfs.tar
> EOF
> --
> 2.53.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/20261023133338.32200-1-akarpovich%40ilbers.de.
--
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/89be46116224a626aafc4a246f7b41e6bed6bbb8.camel%40siemens.com.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] rootfs: clean rootfs dir before unpack from sstate
2026-10-26 9:47 ` [PATCH 1/2] rootfs: clean rootfs dir before unpack from sstate 'Moessbauer, Felix' via isar-users
@ 2026-10-26 11:16 ` Aliaksei Karpovich
2026-10-26 11:29 ` 'Moessbauer, Felix' via isar-users
0 siblings, 1 reply; 5+ messages in thread
From: Aliaksei Karpovich @ 2026-10-26 11:16 UTC (permalink / raw)
To: Moessbauer, Felix, isar-users
[-- Attachment #1: Type: text/plain, Size: 2272 bytes --]
On 10/26/26 12:47, Moessbauer, Felix wrote:
> On Fri, 2026-10-23 at 15:33 +0200, Aliaksei Karpovich wrote:
>> 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(+)
>>
>> 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}/*
> Hi, this skips hidden files. Can't we use
>
> rootfs_install_sstate_finalize[root_cleandirs] += "${ROOTFSDIR}"
>
> instead? Then we could also avoid the following mkdir.
>
> Felix
Hi,
I thought about it, but in this case logic will be different, the ROOTFS
dir will be deleted always.
But in current implementation it's deleted only if rootfs.tar exists.
> this skips hidden files It will skip hidden files only in root. Is it real case (hidden files
in root)? I can change it to 'rm -rf ${ROOTFSDIR}'. Aliaksei
>
>
>> mkdir -p ${ROOTFSDIR}
>> tar -C ${ROOTFSDIR} -xp ${SSTATE_TAR_ATTR_FLAGS} -f rootfs.tar
>> EOF
>> --
>> 2.53.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 toisar-users+unsubscribe@googlegroups.com.
>> To view this discussion visithttps://groups.google.com/d/msgid/isar-users/20261023133338.32200-1-akarpovich%40ilbers.de.
--
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/dc6bebf9-ca39-4342-85da-e7c3dc8a4502%40ilbers.de.
[-- Attachment #2: Type: text/html, Size: 3641 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] rootfs: clean rootfs dir before unpack from sstate
2026-10-26 11:16 ` Aliaksei Karpovich
@ 2026-10-26 11:29 ` 'Moessbauer, Felix' via isar-users
0 siblings, 0 replies; 5+ messages in thread
From: 'Moessbauer, Felix' via isar-users @ 2026-10-26 11:29 UTC (permalink / raw)
To: Aliaksei Karpovich, isar-users
On Mon, 2026-10-26 at 14:16 +0300, Aliaksei Karpovich wrote:
>
>
>
>
>
>
>
>
>
> On 10/26/26 12:47, Moessbauer, Felix wrote:
>
>
>
>
>
>
>
>
> >
> >
> >
> >
> > On Fri, 2026-10-23 at 15:33 +0200, Aliaksei Karpovich wrote:
> >
> >
> >
> >
> > >
> > >
> > >
> > >
> > > 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(+)
> > >
> > > 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}/*
> > >
> > >
> > >
> > >
> >
> >
> >
> >
> > Hi, this skips hidden files. Can't we use
> >
> > rootfs_install_sstate_finalize[root_cleandirs] += "${ROOTFSDIR}"
> >
> > instead? Then we could also avoid the following mkdir.
> >
> > Felix
> >
> >
> >
> >
>
>
>
>
> Hi,
> I thought about it, but in this case logic will be different, the ROOTFS dir will be deleted always.
> But in current implementation it's deleted only if rootfs.tar exists.
Ah... makes sense.
>
>
>
>
>
>
>
>
> > this skips hidden files
> It will skip hidden files only in root. Is it real case (hidden files in root)? I can change it to 'rm -rf ${ROOTFSDIR}'.
Not a real case yet, but a bug waiting to happen. Let's use rm -rf
${ROOTFSDIR}.
Felix
>
> Aliaksei
>
>
>
>
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > >
> > >
> > >
> > >
> > > mkdir -p ${ROOTFSDIR}
> > > tar -C ${ROOTFSDIR} -xp ${SSTATE_TAR_ATTR_FLAGS} -f rootfs.tar
> > > EOF
> > > --
> > > 2.53.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/20261023133338.32200-1-akarpovich%40ilbers.de.
--
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/80b50104d5a3c10a65dd217e26e6f9d2244e3d32.camel%40siemens.com.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-10-26 11:29 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-23 13:33 [PATCH 1/2] rootfs: clean rootfs dir before unpack from sstate Aliaksei Karpovich
2026-10-23 13:33 ` [PATCH 2/2] testsuite: add test for rootfs sstate Aliaksei Karpovich
2026-10-26 9:47 ` [PATCH 1/2] rootfs: clean rootfs dir before unpack from sstate 'Moessbauer, Felix' via isar-users
2026-10-26 11:16 ` Aliaksei Karpovich
2026-10-26 11:29 ` 'Moessbauer, Felix' via isar-users
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox