Skip to content

rm_work: recipe self-exclusion vs conditional RM_WORK_EXCLUDE

Zk47T openembedded-core 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest1 patch 1 replyIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/1rm_work: fix recipe self-exclusion lost when RM_WORK_EXCLUDE is conditionalmeta/classes/rm_work.bbclass meta/recipes-core/meta/meta-ide-support.bb meta/recipes-core/meta/wic-tools.bb +2 more+10 -41 reply

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/1] rm_work: recipe self-exclusion vs conditional RM_WORK_EXCLUDE

Reported in [YOCTO #16157]: with rm_work enabled and

    RM_WORK_EXCLUDE:qemuarm64 += "bash"

in local.conf the build breaks, at gcc-source do_patch for the reporter. Still reproduces on master.

The recipe the user named is fine. What breaks is every recipe that excludes itself with RM_WORK_EXCLUDE += "${PN}": += appends to the base value, and the override then hides it from both guards in the class. Details in the patch.

gcc-source is the one that hurts. Its WORKDIR is the shared source tree the other gcc recipes build from, and it gets deleted despite the
exclusion: 1.4G of unpacked, patched source down to an empty directory. On the next build that needs it, bitbake re-runs do_fetch, do_unpack, do_patch and do_preconfigure to put it back, which is exactly what the exclusion is there to avoid.

Being precise about the failure mode, since it decides how bad this is:
what I reproduced is the deletion and the redundant rebuild, and in a two-step build (gcc-source, then gcc-cross) it recovers on its own. The reporter's hard failure at gcc-source do_patch I have not reproduced. It looks like a race, since nothing orders gcc-source's do_rm_work against other recipes still reading that directory, which would also explain why they saw it in different places on different projects. Either way the exclusion is being silently defeated.

Note it only shows up on a cold build: with warm sstate the tree is still deleted, but nothing needs it again.

On why only four recipes: six places in oe-core exclude a recipe, and the kernel case plus externalsrc.bbclass already use d.appendVar() and were never affected. The four using += all descend from 1f2a3cdadac1 ("gcc-source.inc: cleanly disable do_rm_work"), which dropped deltask and settled on RM_WORK_EXCLUDE as "the API that is meant to be used for excluding recipes from cleaning". deltask had no exposure to this, so that is where gcc-source regressed. The mechanism is fine and unchanged here, only the operator is wrong.

:append is never weaker: += is lost for all three override forms (:<machine> =, :<machine> += and :pn-<recipe>), :append survives all of them, and with no override both give the same string so nothing rebuilds.

Making the class tolerant instead, by unioning the resolved value with the masked base, does not work: getVarFlag() checks expand_cache before honouring the parsing argument and parsing is not in the cache key, so the second read returns the first one's answer. Looks like a separate bitbake issue.

Not fixed here: RM_WORK_EXCLUDE:<machine> += "x" still replaces rather than adds, so combining it with a plain += loses the latter. That is ordinary override behaviour, so the patch just documents the working form in the class header.

Tested on qemux86-64 with rm_work and RM_WORK_EXCLUDE:qemux86-64 += "bash", patch applied to a pristine 9d89b3b802 with unpatched bitbake:

- bitbake gcc-source with an empty sstate: unpatched leaves an empty work-shared, patched leaves the 1.4G source tree intact
- all four recipes keep their own name in RM_WORK_EXCLUDE again
- with an unconditional RM_WORK_EXCLUDE the resolved value is byte identical before and after
- all 952 recipes parse, core-image-minimal builds, 5608 tasks
- oe-core patchtest: 10 pass, rest skipped as not applicable

Nguyen Minh Tien (1):
rm_work: fix recipe self-exclusion lost when RM_WORK_EXCLUDE is
conditional

 meta/classes/rm_work.bbclass                        | 6 ++++++
 meta/recipes-core/meta/meta-ide-support.bb          | 2 +-
 meta/recipes-core/meta/wic-tools.bb                 | 2 +-
 meta/recipes-devtools/clang/llvm-project-source.inc | 2 +-
 meta/recipes-devtools/gcc/gcc-source.inc            | 2 +-
 5 files changed, 10 insertions(+), 4 deletions(-)
Signature · 1 line
2.34.1