| Message ID | 20261204083254.1215409-1-sean@geanix.com |
|---|---|
| State | New |
| Headers | show |
| Series | rm_work: don't remove WORKDIR while do_populate_sdk is running | expand |
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 () { : }
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(+)