@@ -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:
@@ -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
@@ -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)
@@ -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
@@ -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
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(-)