Openembedded Core Discussions
 help / color / mirror / Atom feed
* [PATCH 0/2] rm_work: remove work directories for do_populate_sdk
@ 2026-11-27 12:46 Sean Nyekjaer
  2026-11-27 12:46 ` [PATCH 1/2] rm_work: also " Sean Nyekjaer
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Sean Nyekjaer @ 2026-11-27 12:46 UTC (permalink / raw)
  To: openembedded-core; +Cc: Sean Nyekjaer

With rm_work enabled, "bitbake <image> -c populate_sdk" leaves the work
directories of all recipes the SDK depends on behind, as do_rm_work_all
only runs before do_build. Patch 1 fixes this, patch 2 documents the new
task.

Before this series:
% du -csh sstate-cache tmp
16G     sstate-cache
129G    tmp
144G    total

After this series:
% du -csh sstate-cache tmp
16G     sstate-cache
31G     tmp
47G     total

[YOCTO #15824]

Sean Nyekjaer (2):
  rm_work: also remove work directories for do_populate_sdk
  documentation.conf: add do_rm_work_populate_sdk doc

 meta/classes-global/staging.bbclass |  3 +++
 meta/classes/rm_work.bbclass        | 14 ++++++++++++++
 meta/conf/documentation.conf        |  1 +
 meta/lib/oe/sstatesig.py            |  5 +++++
 4 files changed, 23 insertions(+)

-- 
2.56.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/2] rm_work: also remove work directories for do_populate_sdk
  2026-11-27 12:46 [PATCH 0/2] rm_work: remove work directories for do_populate_sdk Sean Nyekjaer
@ 2026-11-27 12:46 ` Sean Nyekjaer
  2026-11-27 12:46 ` [PATCH 2/2] documentation.conf: add do_rm_work_populate_sdk doc Sean Nyekjaer
  2026-12-04 13:35 ` [PATCH 0/2] rm_work: remove work directories for do_populate_sdk Paul Barker
  2 siblings, 0 replies; 5+ messages in thread
From: Sean Nyekjaer @ 2026-11-27 12:46 UTC (permalink / raw)
  To: openembedded-core; +Cc: Sean Nyekjaer

do_rm_work_all only runs before do_build, so "bitbake <image> -c
populate_sdk" leaves the work directories of all recipes the SDK
depends on behind.

Add do_rm_work_populate_sdk before do_populate_sdk to run do_rm_work
for those recipes, without building the image itself. Keep it out of
the do_populate_sdk signature, and don't let extend_recipe_sysroot
stage the sysroots of the recipes the do_rm_work tasks depend on.

[YOCTO #15824]

AI-Generated: Uses Claude Code (Claude Opus 5.5)
Signed-off-by: Sean Nyekjaer <sean@geanix.com>
---
 meta/classes-global/staging.bbclass |  3 +++
 meta/classes/rm_work.bbclass        | 14 ++++++++++++++
 meta/lib/oe/sstatesig.py            |  5 +++++
 3 files changed, 22 insertions(+)

diff --git a/meta/classes-global/staging.bbclass b/meta/classes-global/staging.bbclass
index 20340a16e1..558d808243 100644
--- a/meta/classes-global/staging.bbclass
+++ b/meta/classes-global/staging.bbclass
@@ -338,6 +338,9 @@ python extend_recipe_sysroot() {
             start.add(dep2)
         start.remove(dep)
 
+    # Don't stage the sysroots of the recipes the do_rm_work tasks depend on
+    start = set(dep for dep in start if not setscenedeps[dep][1].startswith("do_rm_work"))
+
     #bb.note(" start3 is %s" % str(start))
 
     # Create collapsed do_populate_sysroot -> do_populate_sysroot tree
diff --git a/meta/classes/rm_work.bbclass b/meta/classes/rm_work.bbclass
index 7cb8a325b2..12cb70d55d 100644
--- a/meta/classes/rm_work.bbclass
+++ b/meta/classes/rm_work.bbclass
@@ -131,6 +131,20 @@ do_rm_work_all[recrdeptask] = "do_rm_work"
 do_rm_work_all[noexec] = "1"
 addtask rm_work_all before do_build
 
+# Remove the work directories of the recipes do_populate_sdk depends on.
+# Only the dependencies on other recipes are copied, so the image isn't built.
+do_rm_work_populate_sdk () {
+    :
+}
+do_rm_work_populate_sdk[recrdeptask] = "do_rm_work"
+do_rm_work_populate_sdk[depends] = "${@d.getVarFlag('do_populate_sdk', 'depends') or ''}"
+do_rm_work_populate_sdk[rdepends] = "${@d.getVarFlag('do_populate_sdk', 'rdepends') or ''}"
+do_rm_work_populate_sdk[noexec] = "1"
+python () {
+    if d.getVarFlag('do_populate_sdk', 'task'):
+        bb.build.addtask('do_rm_work_populate_sdk', 'do_populate_sdk', '', d)
+}
+
 do_populate_sdk[postfuncs] += "rm_work_populatesdk"
 rm_work_populatesdk () {
     :
diff --git a/meta/lib/oe/sstatesig.py b/meta/lib/oe/sstatesig.py
index c0e581d0c8..cbe210215e 100644
--- a/meta/lib/oe/sstatesig.py
+++ b/meta/lib/oe/sstatesig.py
@@ -39,6 +39,11 @@ def sstate_rundepfilter(siggen, fn, recipename, task, dep, depname, dataCaches):
     if task == "do_rm_work":
         return False
 
+    # Skip the do_rm_work_populate_sdk task signature, it only removes work
+    # directories and must not change the do_populate_sdk signature
+    if deptaskname == "do_rm_work_populate_sdk":
+        return False
+
     # (Almost) always include our own inter-task dependencies (unless it comes
     # from a mcdepends). The exception is the special
     # do_kernel_configme->do_unpack_and_patch dependency from archiver.bbclass.
-- 
2.56.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] documentation.conf: add do_rm_work_populate_sdk doc
  2026-11-27 12:46 [PATCH 0/2] rm_work: remove work directories for do_populate_sdk Sean Nyekjaer
  2026-11-27 12:46 ` [PATCH 1/2] rm_work: also " Sean Nyekjaer
@ 2026-11-27 12:46 ` Sean Nyekjaer
  2026-12-04 13:35 ` [PATCH 0/2] rm_work: remove work directories for do_populate_sdk Paul Barker
  2 siblings, 0 replies; 5+ messages in thread
From: Sean Nyekjaer @ 2026-11-27 12:46 UTC (permalink / raw)
  To: openembedded-core; +Cc: Sean Nyekjaer

Document the task added to rm_work.bbclass for cleaning up the work
directories of the recipes do_populate_sdk depends upon.

AI-Generated: Uses Claude Code (Claude Opus 5.5)
Signed-off-by: Sean Nyekjaer <sean@geanix.com>
---
 meta/conf/documentation.conf | 1 +
 1 file changed, 1 insertion(+)

diff --git a/meta/conf/documentation.conf b/meta/conf/documentation.conf
index 2a3c7f80a2..02de0b6a24 100644
--- a/meta/conf/documentation.conf
+++ b/meta/conf/documentation.conf
@@ -42,6 +42,7 @@ do_populate_sdk[doc] = "Creates the file and directory structure for an installa
 do_populate_sysroot[doc] = "Copies a subset of files installed by do_install into the sysroot in order to make them available to other recipes"
 do_rm_work[doc] = "Removes work files after the build system has finished with them"
 do_rm_work_all[doc] = "Top-level task for removing work files after the build system has finished with them"
+do_rm_work_populate_sdk[doc] = "Removes work files of the recipes do_populate_sdk depends upon"
 do_rootfs[doc] = "Creates the root filesystem (file and directory structure) for an image"
 do_savedefconfig[doc] = "Creates a minimal Linux kernel configuration file"
 do_sizecheck[doc] = "Checks the size of the kernel image against KERNEL_IMAGE_MAXSIZE (if set)"
-- 
2.56.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 0/2] rm_work: remove work directories for do_populate_sdk
  2026-11-27 12:46 [PATCH 0/2] rm_work: remove work directories for do_populate_sdk Sean Nyekjaer
  2026-11-27 12:46 ` [PATCH 1/2] rm_work: also " Sean Nyekjaer
  2026-11-27 12:46 ` [PATCH 2/2] documentation.conf: add do_rm_work_populate_sdk doc Sean Nyekjaer
@ 2026-12-04 13:35 ` Paul Barker
  2026-12-04 13:49   ` Sean Nyekjaer
  2 siblings, 1 reply; 5+ messages in thread
From: Paul Barker @ 2026-12-04 13:35 UTC (permalink / raw)
  To: Sean Nyekjaer, openembedded-core

On Fri Nov 27, 2026 at 12:46 PM GMT, Sean Nyekjaer wrote:
> With rm_work enabled, "bitbake <image> -c populate_sdk" leaves the work
> directories of all recipes the SDK depends on behind, as do_rm_work_all
> only runs before do_build. Patch 1 fixes this, patch 2 documents the new
> task.
>
> Before this series:
> % du -csh sstate-cache tmp
> 16G     sstate-cache
> 129G    tmp
> 144G    total
>
> After this series:
> % du -csh sstate-cache tmp
> 16G     sstate-cache
> 31G     tmp
> 47G     total
>
> [YOCTO #15824]
>
> Sean Nyekjaer (2):
>   rm_work: also remove work directories for do_populate_sdk
>   documentation.conf: add do_rm_work_populate_sdk doc
>
>  meta/classes-global/staging.bbclass |  3 +++
>  meta/classes/rm_work.bbclass        | 14 ++++++++++++++
>  meta/conf/documentation.conf        |  1 +
>  meta/lib/oe/sstatesig.py            |  5 +++++
>  4 files changed, 23 insertions(+)

Hi Sean,

We discussed these patches during the patch review call yesterday. We
don't want to add more special cases for do_populate_sdk, and even if we
do so there would be other tasks which need this handling - including
some defined outside OE-Core which we can't fix in this way.

Instead we plan to re-implement the way rm_work is triggered to fix this
and other edge cases. This has been planned for a while, we wanted to
get the layer changes completed and merged first. We'd prefer to leave
things as-is for now until those changes are made.

Hope that makes sense.

Best regards,

-- 
Paul Barker


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 0/2] rm_work: remove work directories for do_populate_sdk
  2026-12-04 13:35 ` [PATCH 0/2] rm_work: remove work directories for do_populate_sdk Paul Barker
@ 2026-12-04 13:49   ` Sean Nyekjaer
  0 siblings, 0 replies; 5+ messages in thread
From: Sean Nyekjaer @ 2026-12-04 13:49 UTC (permalink / raw)
  To: Paul Barker; +Cc: openembedded-core



> On 4 Dec 2026, at 14.35, Paul Barker <paul@pbarker.dev> wrote:
> 
> On Fri Nov 27, 2026 at 12:46 PM GMT, Sean Nyekjaer wrote:
>> With rm_work enabled, "bitbake <image> -c populate_sdk" leaves the work
>> directories of all recipes the SDK depends on behind, as do_rm_work_all
>> only runs before do_build. Patch 1 fixes this, patch 2 documents the new
>> task.
>> 
>> Before this series:
>> % du -csh sstate-cache tmp
>> 16G     sstate-cache
>> 129G    tmp
>> 144G    total
>> 
>> After this series:
>> % du -csh sstate-cache tmp
>> 16G     sstate-cache
>> 31G     tmp
>> 47G     total
>> 
>> [YOCTO #15824]
>> 
>> Sean Nyekjaer (2):
>>  rm_work: also remove work directories for do_populate_sdk
>>  documentation.conf: add do_rm_work_populate_sdk doc
>> 
>> meta/classes-global/staging.bbclass |  3 +++
>> meta/classes/rm_work.bbclass        | 14 ++++++++++++++
>> meta/conf/documentation.conf        |  1 +
>> meta/lib/oe/sstatesig.py            |  5 +++++
>> 4 files changed, 23 insertions(+)
> 
> Hi Sean,
> 
> We discussed these patches during the patch review call yesterday. We
> don't want to add more special cases for do_populate_sdk, and even if we
> do so there would be other tasks which need this handling - including
> some defined outside OE-Core which we can't fix in this way.
> 
> Instead we plan to re-implement the way rm_work is triggered to fix this
> and other edge cases. This has been planned for a while, we wanted to
> get the layer changes completed and merged first. We'd prefer to leave
> things as-is for now until those changes are made.
> 
> Hope that makes sense.

Hi Paul,

That makes perfect sense.
We just wanted to get rid of all our workarounds for rm_work.

Maybe we should also discuss whether rm_work should be enabled
by default and made opt-out instead. Any reason not to have it?

This morning I sent another patch to fix rm_work when building both
an image and populating an SDK in the same run:
https://lore.kernel.org/openembedded-core/20261204083254.1215409-1-sean@geanix.com/T/#u
I guess that will also fall under the re-implementation.

/Sean




^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-12-04 13:49 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-27 12:46 [PATCH 0/2] rm_work: remove work directories for do_populate_sdk Sean Nyekjaer
2026-11-27 12:46 ` [PATCH 1/2] rm_work: also " Sean Nyekjaer
2026-11-27 12:46 ` [PATCH 2/2] documentation.conf: add do_rm_work_populate_sdk doc Sean Nyekjaer
2026-12-04 13:35 ` [PATCH 0/2] rm_work: remove work directories for do_populate_sdk Paul Barker
2026-12-04 13:49   ` Sean Nyekjaer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox