Skip to contentSkip to conversation

classes/staging: Allow tasks to opt-out of extending the sysroot

PATCH New Joshua Watt 1 participant 1 message May 23, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 classes/staging: Allow tasks to opt-out of extending the sysroot

Adds a task flag called 'extend-sysroot' that allows a task to opt out of having the sysroot extended just because it depends on do_populate_sysroot. In some (rare) cases (e.g. SPDX), tasks only really care about looking at the sysroot output of the local task, and this allows them to do that without extending the sysroot.

Modify do_prepare_recipe_sysroot to use this new flag instead of being hard-coded

---
 meta/classes-global/staging.bbclass | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
meta/classes-global/staging.bbclass +3 -1
index 3678a1b4415..86cdacd307a 100644
@@ -646,6 +646,7 @@ python extend_recipe_sysroot() {
 extend_recipe_sysroot[vardepsexclude] += "MACHINE_ARCH PACKAGE_EXTRA_ARCHS SDK_ARCH BUILD_ARCH SDK_OS BB_TASKDEPDATA"
 
 do_prepare_recipe_sysroot[deptask] = "do_populate_sysroot"
+do_prepare_recipe_sysroot[extend-sysroot] = "0"
 python do_prepare_recipe_sysroot () {
     bb.build.exec_func("extend_recipe_sysroot", d)
 }
@@ -655,7 +656,8 @@ python staging_taskhandler() {
     bbtasks = e.tasklist
     for task in bbtasks:
         deps = d.getVarFlag(task, "depends")
-        if task != 'do_prepare_recipe_sysroot' and (task == "do_configure" or (deps and "populate_sysroot" in deps)):
+        extend_sysroot = d.getVarFlag(task, "extend-sysroot") or "1"
+        if extend_sysroot == "1" and (task == "do_configure" or (deps and "populate_sysroot" in deps)):
             d.prependVarFlag(task, "prefuncs", "extend_recipe_sysroot ")
 }
 staging_taskhandler[eventmask] = "bb.event.RecipeTaskPreProcess"
Signature · 1 line
2.43.2