From: Joshua Watt <jpewhacker@gmail.com>
To: openembedded-core@lists.openembedded.org
Cc: Joshua Watt <JPEWhacker@gmail.com>
Subject: [OE-core][PATCH] classes-recipe/multilib_script: Expand before splitting
Date: Mon, 15 Jul 2024 15:52:12 -0600 [thread overview]
Message-ID: <20240715215212.1859324-1-JPEWhacker@gmail.com> (raw)
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.
Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
---
meta/classes-recipe/multilib_script.bbclass | 18 ++++++++----------
1 file changed, 8 insertions(+), 10 deletions(-)
diff --git a/meta/classes-recipe/multilib_script.bbclass b/meta/classes-recipe/multilib_script.bbclass
index e6f0249529c..a7a08930b7e 100644
--- a/meta/classes-recipe/multilib_script.bbclass
+++ b/meta/classes-recipe/multilib_script.bbclass
@@ -28,14 +28,12 @@ python () {
if bb.data.inherits_class('native', d) or bb.data.inherits_class('cross', d):
return
- for entry in (d.getVar("MULTILIB_SCRIPTS", False) or "").split():
- pkg, script = entry.split(":")
- epkg = d.expand(pkg)
- escript = d.expand(script)
- scriptname = os.path.basename(escript)
- d.appendVar("ALTERNATIVE:" + epkg, " " + scriptname + " ")
- d.setVarFlag("ALTERNATIVE_LINK_NAME", scriptname, escript)
- d.setVarFlag("ALTERNATIVE_TARGET", scriptname, escript + "-${MULTILIB_SUFFIX}")
- d.appendVar("multilibscript_rename", "\n mv ${PKGD}" + escript + " ${PKGD}" + escript + "-${MULTILIB_SUFFIX}")
- d.appendVar("FILES:" + epkg, " " + escript + "-${MULTILIB_SUFFIX}")
+ for entry in (d.getVar("MULTILIB_SCRIPTS") or "").split():
+ pkg, script = entry.split(":", 1)
+ scriptname = os.path.basename(script)
+ d.appendVar("ALTERNATIVE:" + pkg, " " + scriptname + " ")
+ d.setVarFlag("ALTERNATIVE_LINK_NAME", scriptname, script)
+ d.setVarFlag("ALTERNATIVE_TARGET", scriptname, script + "-${MULTILIB_SUFFIX}")
+ d.appendVar("multilibscript_rename", "\n mv ${PKGD}" + script + " ${PKGD}" + script + "-${MULTILIB_SUFFIX}")
+ d.appendVar("FILES:" + pkg, " " + script + "-${MULTILIB_SUFFIX}")
}
--
2.45.2
reply other threads:[~2024-07-15 21:52 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20240715215212.1859324-1-JPEWhacker@gmail.com \
--to=jpewhacker@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