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

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