Skip to contentSkip to conversation

multilib_script: Add support for multilib scripts

PATCH In review Richard Purdie 2 participants 3 messages Jul 30, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 multilib_script: Add support for multilib scripts

Whilst the package managers handle multilib ELF binaries well, they don't handle scripts in the *bindir directories well. This adds support for marking these up so that they can be handled using update-alternatives.

Its done this way so that non-multilib systems don't see any changes and there is standardisation amongst the multilibs on how the alternatives are named and prioritiesd. The priotitisation code needs to be added but this change means there is somewhere to add it.

Recipe needs to set MULTILIB_SCRIPTS in the form <pkgname>:<scriptname>, e.g. MULTILIB_SCRIPTS = "${PN}-dev:${bindir}/file1 ${PN}:${base_bindir}/file2" to indicate which script files to process from which packages.

libtool is used a as a reference to stop the libtool scripts conflicting in a multilib case and allows the kernel-devsrc change to be merged.

---
 meta/classes/multilib_script.bbclass          | 32 +++++++++++++++++++
 .../recipes-devtools/libtool/libtool_2.4.6.bb |  4 +++
 2 files changed, 36 insertions(+)
 create mode 100644 meta/classes/multilib_script.bbclass
meta/classes/multilib_script.bbclass new file +32 -0
new file mode 100644
index 00000000000..a5a552b7163
@@ -0,0 +1,32 @@
+#
+# Recipe needs to set MULTILIB_SCRIPTS in the form <pkgname>:<scriptname>, e.g.
+# MULTILIB_SCRIPTS = "${PN}-dev:${bindir}/file1 ${PN}:${base_bindir}/file2"
+# to indicate which script files to process from which packages.
+#
+
+inherit update-alternatives
+
+MULTILIB_SUFFIX = "${@d.getVar('base_libdir',1).split('/')[-1]}"
+
+PACKAGE_PREPROCESS_FUNCS += "multilibscript_rename"
+
+multilibscript_rename() {
+	:
+}
+
+python () {
+    # Do nothing if multilib isn't being used
+    if not d.getVar("MULTILIB_VARIANTS"):
+       return
+    # Do nothing for native/cross
+    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(":")
+       scriptname = os.path.basename(script)
+       d.setVar("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}")
+}
meta/recipes-devtools/libtool/libtool_2.4.6.bb +4 -0
index b02620b4b41..b8a52408853 100644
@@ -26,3 +26,7 @@ do_install_append () {
             -e "s@${HOSTTOOLS_DIR}/@@g" \
             -i ${D}${bindir}/libtool
 }
+
+inherit multilib_script
+
+MULTILIB_SCRIPTS = "${PN}:${bindir}/libtool"
Signature · 1 line
2.17.1
#1 lore raw

PATCH 2/2 libtool: Fix problem with libtoolize in multilib installations

Without this patch /usr/bin/libtoolize is different for each multilib since their host-triplets are different, despite there being no difference in the functionality of libtoolize itself.

This change just patches out the problematic line since its just a comment for the user in help text. Ugly but solves the problem. This fixes issues where libtool and libXX-libtool couldn't be installed into the same system.

---
 .../libtool/libtool/multilib.patch            | 23 +++++++++++++++++++
 .../recipes-devtools/libtool/libtool_2.4.6.bb |  2 ++
 2 files changed, 25 insertions(+)
 create mode 100644 meta/recipes-devtools/libtool/libtool/multilib.patch
meta/recipes-devtools/libtool/libtool/multilib.patch new file +23 -0
new file mode 100644
index 00000000000..c4794113efe
@@ -0,0 +1,23 @@
+Without this patch /usr/bin/libtoolize is different for each multilib
+since their host-triplets are different, despite there being no difference in
+the functionality of libtoolize itself.
+
+Ugly, but just patch this out. This fixes issues where libtool and
+libXX-libtool couldn't be installed into the same system.
+
+Upstream-Status: Inapproriate
+RP 2018/7/30
+
+Index: libtool-2.4.6/libtoolize.in
+===================================================================
+--- libtool-2.4.6.orig/libtoolize.in
++++ libtool-2.4.6/libtoolize.in
+@@ -113,7 +113,7 @@ You must 'cd' to the top directory of yo
+ When reporting a bug, please describe a test case to reproduce it and
+ include the following information:
+ 
+-       host-triplet:   @host_triplet@
++       host-triplet    <redacted>
+        version:        $progname (GNU @PACKAGE@) @VERSION@
+        automake:       `($AUTOMAKE --version) 2>/dev/null |$SED 1q`
+        autoconf:       `($AUTOCONF --version) 2>/dev/null |$SED 1q`
meta/recipes-devtools/libtool/libtool_2.4.6.bb +2 -0
index b8a52408853..f5fdd00e5ee 100644
@@ -1,5 +1,7 @@
 require libtool-${PV}.inc
 
+SRC_URI += "file://multilib.patch"
+
 RDEPENDS_${PN} += "bash"
 
 #
Signature · 1 line
2.17.1
#2 lore raw

✗ patchtest: failure for "multilib_script: Add support f..." and 1 more

In reply to Richard Purdie

== Series Details ==

Series: "multilib_script: Add support f..." and 1 more
Revision: 1
URL : https://patchwork.openembedded.org/series/13308/
State : failure

== Summary ==

Thank you for submitting this patch series to OpenEmbedded Core. This is an automated response. Several tests have been executed on the proposed series by patchtest resulting in the following failures:

* Issue A patch file has been added, but does not have a Signed-off-by tag [test_signed_off_by_presence]
Suggested fix Sign off the added patch file (meta/recipes-devtools/libtool/libtool/multilib.patch)

* Issue Upstream-Status is in incorrect format [test_upstream_status_presence_format]

  Suggested fix    Fix Upstream-Status format in multilib.patch
  Current          Upstream-Status: Inapproriate
  Standard format  Upstream-Status: <Valid status>
  Valid status     Pending, Accepted, Backport, Denied, Inappropriate [reason], Submitted [where]

If you believe any of these test results are incorrect, please reply to the mailing list ([email protected]) raising your concerns. Otherwise we would appreciate you correcting the issues and submitting a new version of the patchset if applicable. Please ensure you add/increment the version number when sending the new version (i.e. [PATCH] -> [PATCH v2] -> [PATCH v3] -> ...).

---

Guidelines:     https://www.openembedded.org/wiki/Commit_Patch_Message_Guidelines
Test framework: http://git.yoctoproject.org/cgit/cgit.cgi/patchtest
Test suite:     http://git.yoctoproject.org/cgit/cgit.cgi/patchtest-oe