From: "Zk47T" <zizuzacker@gmail.com>
To: openembedded-core@lists.openembedded.org
Cc: zizuzacker@gmail.com
Subject: [PATCH 1/1] rm_work: fix recipe self-exclusion lost when RM_WORK_EXCLUDE is conditional
Date: Sat, 25 Jul 2026 21:30:15 +0700 [thread overview]
Message-ID: <20260725143015.23804-2-zizuzacker@gmail.com> (raw)
In-Reply-To: <20260725143015.23804-1-zizuzacker@gmail.com>
A recipe keeps its WORKDIR by adding itself to the exclusion list:
RM_WORK_EXCLUDE += "${PN}"
+= is evaluated at parse time against the unoverridden variable, so it
appends to the base value. As soon as configuration sets an override such
as RM_WORK_EXCLUDE:qemuarm64, that override takes precedence at lookup
time and the recipe's own entry is hidden from both the python guard in
inject_rm_work() and the shell guard in do_rm_work.
The WORKDIR is then removed even though it was meant to be kept. For
gcc-source that is the shared source tree the other gcc recipes build
from, 1.4G here, so the next build needing it fetches, unpacks and
patches it again, and anything still using it while do_rm_work runs can
fail outright. The report has gcc-source do_patch failing.
Use :append, which is applied on top of whichever override wins. With no
override involved both operators produce the same string, so task
signatures and sstate are unaffected.
gcc-source used deltask, which had no such failure mode, until
1f2a3cdadac1 switched it to this idiom; the other three recipes adopted
the idiom afterwards.
Fixes: 1f2a3cdadac1 ("gcc-source.inc: cleanly disable do_rm_work")
[YOCTO #16157]
Signed-off-by: Nguyen Minh Tien <zizuzacker@gmail.com>
---
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(-)
diff --git a/meta/classes/rm_work.bbclass b/meta/classes/rm_work.bbclass
index 52ecfafb72..cdef74f6a7 100644
--- a/meta/classes/rm_work.bbclass
+++ b/meta/classes/rm_work.bbclass
@@ -16,6 +16,12 @@
#
# RM_WORK_EXCLUDE += "icu-native icu busybox"
#
+# += does not combine with a conditional value, so use :append if either the
+# configuration or a recipe excluding itself may be overridden:
+#
+# RM_WORK_EXCLUDE:append:qemuarm64 = " busybox"
+# RM_WORK_EXCLUDE:append = " ${PN}"
+#
# Recipes can also configure which entries in their ${WORKDIR}
# are preserved besides temp, which already gets excluded by default
# because it contains logs:
diff --git a/meta/recipes-core/meta/meta-ide-support.bb b/meta/recipes-core/meta/meta-ide-support.bb
index c449302923..222ae21b29 100644
--- a/meta/recipes-core/meta/meta-ide-support.bb
+++ b/meta/recipes-core/meta/meta-ide-support.bb
@@ -4,7 +4,7 @@ LICENSE = "MIT"
PACKAGE_ARCH = "${MACHINE_ARCH}"
DEPENDS = "virtual/libc ${MLPREFIX}gdb-cross-${TARGET_ARCH} qemu-native qemu-helper-native unfs3-native cmake-native autoconf-native automake-native meson-native intltool-native pkgconfig-native"
-RM_WORK_EXCLUDE += "${PN}"
+RM_WORK_EXCLUDE:append = " ${PN}"
inherit toolchain-scripts nopackages deploy testsdk
diff --git a/meta/recipes-core/meta/wic-tools.bb b/meta/recipes-core/meta/wic-tools.bb
index 823dbe6db6..9123f6e55a 100644
--- a/meta/recipes-core/meta/wic-tools.bb
+++ b/meta/recipes-core/meta/wic-tools.bb
@@ -23,7 +23,7 @@ inherit nopackages
# The sysroot of wic-tools is needed for wic, but if rm_work is enabled, it will
# be removed before wic has a chance to use it, hence the exclusion below.
-RM_WORK_EXCLUDE += "${PN}"
+RM_WORK_EXCLUDE:append = " ${PN}"
python do_build_sysroot () {
bb.build.exec_func("extend_recipe_sysroot", d)
diff --git a/meta/recipes-devtools/clang/llvm-project-source.inc b/meta/recipes-devtools/clang/llvm-project-source.inc
index 85b5ef06dc..af601914bc 100644
--- a/meta/recipes-devtools/clang/llvm-project-source.inc
+++ b/meta/recipes-devtools/clang/llvm-project-source.inc
@@ -3,7 +3,7 @@ deltask do_compile
deltask do_install
deltask do_populate_sysroot
deltask do_populate_lic
-RM_WORK_EXCLUDE += "${PN}"
+RM_WORK_EXCLUDE:append = " ${PN}"
inherit nopackages allarch
diff --git a/meta/recipes-devtools/gcc/gcc-source.inc b/meta/recipes-devtools/gcc/gcc-source.inc
index d760171661..d2bb5222bf 100644
--- a/meta/recipes-devtools/gcc/gcc-source.inc
+++ b/meta/recipes-devtools/gcc/gcc-source.inc
@@ -3,7 +3,7 @@ deltask do_compile
deltask do_install
deltask do_populate_sysroot
deltask do_populate_lic
-RM_WORK_EXCLUDE += "${PN}"
+RM_WORK_EXCLUDE:append = " ${PN}"
inherit nopackages allarch
--
2.34.1
prev parent reply other threads:[~2026-07-26 16:27 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-25 14:30 [PATCH 0/1] rm_work: recipe self-exclusion vs conditional RM_WORK_EXCLUDE Zk47T
2026-07-25 14:30 ` Zk47T [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260725143015.23804-2-zizuzacker@gmail.com \
--to=zizuzacker@gmail.com \
--cc=openembedded-core@lists.openembedded.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox