diff mbox series

[2/2] sstatesig: do_image_complete needs to run with pseudo disbale

Message ID 20230713110244.3169513-2-jose.quaresma@foundries.io
State New
Headers show
Series [1/2] sstatesig: be more precise and show the full path in exceptions | expand

Commit Message

Jose Quaresma July 13, 2023, 11:02 a.m. UTC
sstate_report_unihash function from sstate.bbclass needs to
run with pseudo disbaled when running do_image_complete task.
This is because it have the deploy content with uid and gid
of the user that run bitbake on the build machine.

By default the creation of sstate is skiped in the task do_image_complete
in the image.bbclass using SSTATE_SKIP_CREATION:task-image-complete=1
so the issue is not triggered.

There are some situation when is useful to store the image artifacts on the
sstate cache for future reuse and speedup the build without need to pruduce
the same image again. These cases are especially useful in the case of the
initramfs images used by the kernel.

The issue can be reproduced in oe-core with:
 echo "SSTATE_SKIP_CREATION:task-image-complete = '0'" >> meta/recipes-core/images/core-image-minimal-initramfs.bb
 bitbake core-image-minimal-initramfs -C do_image_complete

Signed-off-by: Jose Quaresma <jose.quaresma@foundries.io>
---
 meta/lib/oe/sstatesig.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Richard Purdie July 13, 2023, 11:11 a.m. UTC | #1
On Thu, 2023-07-13 at 11:02 +0000, Jose Quaresma wrote:
> sstate_report_unihash function from sstate.bbclass needs to
> run with pseudo disbaled when running do_image_complete task.
> This is because it have the deploy content with uid and gid
> of the user that run bitbake on the build machine.
> 
> By default the creation of sstate is skiped in the task do_image_complete
> in the image.bbclass using SSTATE_SKIP_CREATION:task-image-complete=1
> so the issue is not triggered.
> 
> There are some situation when is useful to store the image artifacts on the
> sstate cache for future reuse and speedup the build without need to pruduce
> the same image again. These cases are especially useful in the case of the
> initramfs images used by the kernel.
> 
> The issue can be reproduced in oe-core with:
>  echo "SSTATE_SKIP_CREATION:task-image-complete = '0'" >> meta/recipes-core/images/core-image-minimal-initramfs.bb
>  bitbake core-image-minimal-initramfs -C do_image_complete

I can see why you've done this but I have a lot of worries about adding
code for use cases we don't support. 

If we do this in too many places the code just becomes unmaintainable
as we have no idea how it is being used. I'll merge patches which break
things, then we'll get patches to fix that and break something else
someone relies upon and things will turn into a mess.

I really don't know what to do with such patches :(

Cheers,

Richard
Jose Quaresma July 13, 2023, 11:31 a.m. UTC | #2
Richard Purdie <richard.purdie@linuxfoundation.org> escreveu no dia quinta,
13/07/2023 à(s) 12:11:

> On Thu, 2023-07-13 at 11:02 +0000, Jose Quaresma wrote:
> > sstate_report_unihash function from sstate.bbclass needs to
> > run with pseudo disbaled when running do_image_complete task.
> > This is because it have the deploy content with uid and gid
> > of the user that run bitbake on the build machine.
> >
> > By default the creation of sstate is skiped in the task do_image_complete
> > in the image.bbclass using SSTATE_SKIP_CREATION:task-image-complete=1
> > so the issue is not triggered.
> >
> > There are some situation when is useful to store the image artifacts on
> the
> > sstate cache for future reuse and speedup the build without need to
> pruduce
> > the same image again. These cases are especially useful in the case of
> the
> > initramfs images used by the kernel.
> >
> > The issue can be reproduced in oe-core with:
> >  echo "SSTATE_SKIP_CREATION:task-image-complete = '0'" >>
> meta/recipes-core/images/core-image-minimal-initramfs.bb
> >  bitbake core-image-minimal-initramfs -C do_image_complete
>
> I can see why you've done this but I have a lot of worries about adding
> code for use cases we don't support.
>
> If we do this in too many places the code just becomes unmaintainable
> as we have no idea how it is being used. I'll merge patches which break
> things, then we'll get patches to fix that and break something else
> someone relies upon and things will turn into a mess.
>
> I really don't know what to do with such patches :(
>

I can try another approaches to not change the default behavior:

Inside the python sstate_report_unihash of the sstate bbclass
I can get the SSTATE_SKIP_CREATION and if it is not set (disabled) and the
task is
do_image_complete we explicitly set the PSEUDO_DISABLED to run
the report_unihash.

Is something like that more acceptable? or is better to keep things like
that in distro layers.

Thanks for your time.

Jose


> Cheers,
>
> Richard
>
>
>
>
>
diff mbox series

Patch

diff --git a/meta/lib/oe/sstatesig.py b/meta/lib/oe/sstatesig.py
index 4a886215b2..cbf551889c 100644
--- a/meta/lib/oe/sstatesig.py
+++ b/meta/lib/oe/sstatesig.py
@@ -503,7 +503,7 @@  def OEOuthashBasic(path, sigfile, task, d):
     corebase = d.getVar("COREBASE")
     tmpdir = d.getVar("TMPDIR")
     include_owners = os.environ.get('PSEUDO_DISABLED') == '0'
-    if "package_write_" in task or task == "package_qa":
+    if "package_write_" in task or task == "package_qa" or task == "image_complete":
         include_owners = False
     include_timestamps = False
     include_root = True