summaryrefslogtreecommitdiffstats
path: root/meta/classes-recipe
diff options
context:
space:
mode:
authorJoshua Watt <JPEWhacker@gmail.com>2024-07-15 15:52:12 -0600
committerRichard Purdie <richard.purdie@linuxfoundation.org>2024-07-18 17:21:39 +0100
commit431767f069e9a8aedcb99c3013a261d606288d6f (patch)
tree18939fba72da06bd7715fe55ce36a2fbca16daa6 /meta/classes-recipe
parentc11d1b5b8f7b0936214d711a5f555cfc80a458be (diff)
downloadpoky-431767f069e9a8aedcb99c3013a261d606288d6f.tar.gz
classes-recipe/multilib_script: Expand before splitting
multilib_script.bbclass was unable to work correctly in the case where e.g. a PACKAGECONFIG removed the script that it was intended to rename (as an example, the "trace" PACKAGECONFIG in cairo). The way to fix this would be to do something like: MULTILIB_SCRIPTS = "${@bb.utils.contains('PACKAGECONFIG', 'trace', '${PN}-perf-utils:${bindir}/cairo-trace', '', d)}" but this is not possible because the variable is not expanded before being split. To fix this, change the class to expand the variable before splitting. There are two cases to be considered that could possibly break: 1) If the RHS of the ":" contains a ":", which is accounted for by limiting the splitting to 1 split, which will leave the ":" in the RHS in tact. Of note, this works because ":" isn't valid in a package name 2) If the RHS of the ":" contained whitespace, however this would have broken the mv command written to multilibscript_rename(), so this isn't occurring in practice. (From OE-Core rev: b9c992e69f3f44051610386ce4f743e224750694) Signed-off-by: Joshua Watt <JPEWhacker@gmail.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes-recipe')
-rw-r--r--meta/classes-recipe/multilib_script.bbclass18
1 files changed, 8 insertions, 10 deletions
diff --git a/meta/classes-recipe/multilib_script.bbclass b/meta/classes-recipe/multilib_script.bbclass
index e6f0249529..a7a08930b7 100644
--- a/meta/classes-recipe/multilib_script.bbclass
+++ b/meta/classes-recipe/multilib_script.bbclass
@@ -28,14 +28,12 @@ python () {
28 if bb.data.inherits_class('native', d) or bb.data.inherits_class('cross', d): 28 if bb.data.inherits_class('native', d) or bb.data.inherits_class('cross', d):
29 return 29 return
30 30
31 for entry in (d.getVar("MULTILIB_SCRIPTS", False) or "").split(): 31 for entry in (d.getVar("MULTILIB_SCRIPTS") or "").split():
32 pkg, script = entry.split(":") 32 pkg, script = entry.split(":", 1)
33 epkg = d.expand(pkg) 33 scriptname = os.path.basename(script)
34 escript = d.expand(script) 34 d.appendVar("ALTERNATIVE:" + pkg, " " + scriptname + " ")
35 scriptname = os.path.basename(escript) 35 d.setVarFlag("ALTERNATIVE_LINK_NAME", scriptname, script)
36 d.appendVar("ALTERNATIVE:" + epkg, " " + scriptname + " ") 36 d.setVarFlag("ALTERNATIVE_TARGET", scriptname, script + "-${MULTILIB_SUFFIX}")
37 d.setVarFlag("ALTERNATIVE_LINK_NAME", scriptname, escript) 37 d.appendVar("multilibscript_rename", "\n mv ${PKGD}" + script + " ${PKGD}" + script + "-${MULTILIB_SUFFIX}")
38 d.setVarFlag("ALTERNATIVE_TARGET", scriptname, escript + "-${MULTILIB_SUFFIX}") 38 d.appendVar("FILES:" + pkg, " " + script + "-${MULTILIB_SUFFIX}")
39 d.appendVar("multilibscript_rename", "\n mv ${PKGD}" + escript + " ${PKGD}" + escript + "-${MULTILIB_SUFFIX}")
40 d.appendVar("FILES:" + epkg, " " + escript + "-${MULTILIB_SUFFIX}")
41} 39}