Openembedded Core Discussions
 help / color / mirror / Atom feed
* [PATCH] rm_work: don't remove WORKDIR while do_populate_sdk is running
@ 2026-12-04  8:32 Sean Nyekjaer
  2026-12-04 13:50 ` Paul Barker
  0 siblings, 1 reply; 2+ messages in thread
From: Sean Nyekjaer @ 2026-12-04  8:32 UTC (permalink / raw)
  To: openembedded-core; +Cc: Sean Nyekjaer

When an image and its SDK are built in the same run, e.g.
"bitbake <image> <image>:do_populate_sdk", nothing orders the image's
do_rm_work against do_populate_sdk(_ext), so do_rm_work can remove the
work directory while the SDK is being populated:

  Package foobar:core2-64 disappeared on us!

Serialize them with a lock in ${T}, which do_rm_work keeps. Ordering
do_rm_work after do_populate_sdk isn't an option, as that would build
the SDK with every image. The SDK tasks take the lock from a
TaskStarted handler, so it also covers their prefuncs and postfuncs,
which [lockfiles] does not.

AI-Generated: Uses Claude Code (Claude Opus 5.5)
Signed-off-by: Sean Nyekjaer <sean@geanix.com>
---
I was suggested to order do_rm_work after do_populate_sdk instead.
A plain "after" would build the SDK with every image, what is
missing is a weak ordering in bitbake, i.e. "run after X only if X is part
of this build".
Any suggestions?

 meta/classes/rm_work.bbclass | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/meta/classes/rm_work.bbclass b/meta/classes/rm_work.bbclass
index 7cb8a325b2..c189d6fea8 100644
--- a/meta/classes/rm_work.bbclass
+++ b/meta/classes/rm_work.bbclass
@@ -124,6 +124,15 @@ do_rm_work () {
 }
 do_rm_work[vardepsexclude] += "SSTATETASKS"
 
+do_rm_work[lockfiles] += "${T}/rm_work.lock"
+
+addhandler rm_work_sdk_lock
+rm_work_sdk_lock[eventmask] = "bb.build.TaskStarted"
+python rm_work_sdk_lock() {
+    if e.taskname in ("do_populate_sdk", "do_populate_sdk_ext"):
+        d.setVar("_RM_WORK_SDK_LOCK", bb.utils.lockfile(d.expand("${T}/rm_work.lock")))
+}
+
 do_rm_work_all () {
     :
 }
-- 
2.56.0


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

* Re: [PATCH] rm_work: don't remove WORKDIR while do_populate_sdk is running
  2026-12-04  8:32 [PATCH] rm_work: don't remove WORKDIR while do_populate_sdk is running Sean Nyekjaer
@ 2026-12-04 13:50 ` Paul Barker
  0 siblings, 0 replies; 2+ messages in thread
From: Paul Barker @ 2026-12-04 13:50 UTC (permalink / raw)
  To: Sean Nyekjaer, openembedded-core

On Fri Dec 4, 2026 at 8:32 AM GMT, Sean Nyekjaer wrote:
> When an image and its SDK are built in the same run, e.g.
> "bitbake <image> <image>:do_populate_sdk", nothing orders the image's
> do_rm_work against do_populate_sdk(_ext), so do_rm_work can remove the
> work directory while the SDK is being populated:
>
>   Package foobar:core2-64 disappeared on us!
>
> Serialize them with a lock in ${T}, which do_rm_work keeps. Ordering
> do_rm_work after do_populate_sdk isn't an option, as that would build
> the SDK with every image. The SDK tasks take the lock from a
> TaskStarted handler, so it also covers their prefuncs and postfuncs,
> which [lockfiles] does not.
>
> AI-Generated: Uses Claude Code (Claude Opus 5.5)
> Signed-off-by: Sean Nyekjaer <sean@geanix.com>
> ---
> I was suggested to order do_rm_work after do_populate_sdk instead.
> A plain "after" would build the SDK with every image, what is
> missing is a weak ordering in bitbake, i.e. "run after X only if X is part
> of this build".
> Any suggestions?

Hi Sean,

As I mentioned in my other email [1], the proper fix is a full
re-implementation of how rm_work is triggered. We need to be able to say
"run task X after any of tasks A,B,C if any of them run" and "run task X
after all of tasks A,B,C if any of them run".

The design needs to be right, and this will mess with the internals of
the bitbake runqueue, so I'd advise against simply throwing Claude at
it.

[1]: https://lore.kernel.org/openembedded-core/DNBZKJXOGF60.CX6AUK6Y1PFK@pbarker.dev/

Best regards,

-- 
Paul Barker


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

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

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-04  8:32 [PATCH] rm_work: don't remove WORKDIR while do_populate_sdk is running Sean Nyekjaer
2026-12-04 13:50 ` Paul Barker

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