diff mbox series

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

Message ID 20240523182425.2254046-1-JPEWhacker@gmail.com
State New
Headers show
Series classes/staging: Allow tasks to opt-out of extending the sysroot | expand

Commit Message

Joshua Watt May 23, 2024, 6:24 p.m. UTC
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

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
---
 meta/classes-global/staging.bbclass | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/meta/classes-global/staging.bbclass b/meta/classes-global/staging.bbclass
index 3678a1b4415..86cdacd307a 100644
--- a/meta/classes-global/staging.bbclass
+++ b/meta/classes-global/staging.bbclass
@@ -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"