* [PATCH v2 1/5] qemuwrapper: use fallback in case the ELF binary is wrong
2013-04-26 8:03 [PATCH v2 0/5] Multilib related postinstall fixes Laurentiu Palcu
@ 2013-04-26 8:03 ` Laurentiu Palcu
2013-04-26 8:03 ` [PATCH v2 2/5] pango: fix postinstall when using multilib Laurentiu Palcu
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Laurentiu Palcu @ 2013-04-26 8:03 UTC (permalink / raw)
To: openembedded-core
This wrapper script is called mainly from intercept hooks and allarch
packages postinstalls. When multilib is used, the qemuwrapper script
points to the binary that matches the MACHINE architecture.
For example: if MACHINE=qemux86_64 and we activate multilib, then the
postinstalls for lib32 packages would call qemu-x86_64 with 32 bit
binaries and they would certainly fail.
This patch adds just a fallback method if the exit code of the previous
qemu call corresponds to "Invalid ELF image for this architecture"
error. This will allow us to have all postinstalls run on host.
Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
---
.../recipes-devtools/qemu/qemuwrapper-cross_1.0.bb | 28 +++++++++++++++++++-
1 file changed, 27 insertions(+), 1 deletion(-)
diff --git a/meta/recipes-devtools/qemu/qemuwrapper-cross_1.0.bb b/meta/recipes-devtools/qemu/qemuwrapper-cross_1.0.bb
index 41617a6..18f1892 100644
--- a/meta/recipes-devtools/qemu/qemuwrapper-cross_1.0.bb
+++ b/meta/recipes-devtools/qemu/qemuwrapper-cross_1.0.bb
@@ -9,7 +9,33 @@ do_install () {
install -d ${D}${bindir_crossscripts}/
echo "#!/bin/sh" > ${D}${bindir_crossscripts}/qemuwrapper
- echo exec env ${@qemu_target_binary(d)} \"\$@\" >> ${D}${bindir_crossscripts}/qemuwrapper
+ qemu_binary=${@qemu_target_binary(d)}
+ echo "$qemu_binary \"\$@\"" >> ${D}${bindir_crossscripts}/qemuwrapper
+ fallback_qemu_bin=
+ case $qemu_binary in
+ "qemu-i386")
+ fallback_qemu_bin=qemu-x86_64
+ ;;
+ "qemu-x86_64")
+ fallback_qemu_bin=qemu-i386
+ ;;
+ *)
+ ;;
+ esac
+
+ if [ -n "$fallback_qemu_bin" ]; then
+
+ cat >> ${D}${bindir_crossscripts}/qemuwrapper << EOF
+rc=\$?
+if [ \$rc = 255 ]; then
+ $fallback_qemu_bin "\$@"
+ rc=\$?
+fi
+exit \$rc
+EOF
+
+ fi
+
chmod +x ${D}${bindir_crossscripts}/qemuwrapper
}
--
1.7.9.5
^ permalink raw reply related [flat|nested] 6+ messages in thread* [PATCH v2 2/5] pango: fix postinstall when using multilib
2013-04-26 8:03 [PATCH v2 0/5] Multilib related postinstall fixes Laurentiu Palcu
2013-04-26 8:03 ` [PATCH v2 1/5] qemuwrapper: use fallback in case the ELF binary is wrong Laurentiu Palcu
@ 2013-04-26 8:03 ` Laurentiu Palcu
2013-04-26 8:04 ` [PATCH v2 3/5] Revert "qemu.bbclass: Use the correct qemu binary in multilib cases" Laurentiu Palcu
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Laurentiu Palcu @ 2013-04-26 8:03 UTC (permalink / raw)
To: openembedded-core
The pango-query-modules binary gets a multilib prefix and the
postinstall has to call the appropriate binary.
Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
---
meta/recipes-graphics/pango/pango.inc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/meta/recipes-graphics/pango/pango.inc b/meta/recipes-graphics/pango/pango.inc
index f622903..52dd064 100644
--- a/meta/recipes-graphics/pango/pango.inc
+++ b/meta/recipes-graphics/pango/pango.inc
@@ -49,7 +49,7 @@ if ! [ -e $D${sysconfdir}/pango ] ; then
fi
if [ "x$D" != "x" ]; then
- ${@qemu_run_binary(d, '$D','/usr/bin/pango-querymodules')} \
+ ${@qemu_run_binary(d, '$D','${bindir}/${MLPREFIX}pango-querymodules')} \
$D${libdir}/pango/${LIBV}/modules/*.so \
> $D${sysconfdir}/pango/${MLPREFIX}pango.modules 2>/dev/null
--
1.7.9.5
^ permalink raw reply related [flat|nested] 6+ messages in thread* [PATCH v2 3/5] Revert "qemu.bbclass: Use the correct qemu binary in multilib cases"
2013-04-26 8:03 [PATCH v2 0/5] Multilib related postinstall fixes Laurentiu Palcu
2013-04-26 8:03 ` [PATCH v2 1/5] qemuwrapper: use fallback in case the ELF binary is wrong Laurentiu Palcu
2013-04-26 8:03 ` [PATCH v2 2/5] pango: fix postinstall when using multilib Laurentiu Palcu
@ 2013-04-26 8:04 ` Laurentiu Palcu
2013-04-26 8:04 ` [PATCH v2 4/5] scripts/postinst-intercepts: create separete hooks for multilib Laurentiu Palcu
2013-04-26 8:04 ` [PATCH v2 5/5] Pass the mlprefix to postinst_intercept script Laurentiu Palcu
4 siblings, 0 replies; 6+ messages in thread
From: Laurentiu Palcu @ 2013-04-26 8:04 UTC (permalink / raw)
To: openembedded-core
This reverts commit 9f5a6f89d9f4a6c7bed3b163e6eaa764d762f523.
The reason for reverting this is:
* qemuwrapper has now a fallback method;
* when using multilib, calling qemu_target_binary from recipes would
always point to the qemu binary corresponding to the machine
architecture. Hence, postinstalls needing to use qemu would call the
wrong qemu user emulation binary;
Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
---
meta/classes/qemu.bbclass | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/meta/classes/qemu.bbclass b/meta/classes/qemu.bbclass
index 930c6b0..3d437b0 100644
--- a/meta/classes/qemu.bbclass
+++ b/meta/classes/qemu.bbclass
@@ -4,9 +4,7 @@
#
def qemu_target_binary(data):
- target_arch = data.getVar("TARGET_ARCH_MULTILIB_ORIGINAL", True)
- if not target_arch:
- target_arch = data.getVar("TARGET_ARCH", True)
+ target_arch = data.getVar("TARGET_ARCH", True)
if target_arch in ("i486", "i586", "i686"):
target_arch = "i386"
elif target_arch == "powerpc":
--
1.7.9.5
^ permalink raw reply related [flat|nested] 6+ messages in thread* [PATCH v2 4/5] scripts/postinst-intercepts: create separete hooks for multilib
2013-04-26 8:03 [PATCH v2 0/5] Multilib related postinstall fixes Laurentiu Palcu
` (2 preceding siblings ...)
2013-04-26 8:04 ` [PATCH v2 3/5] Revert "qemu.bbclass: Use the correct qemu binary in multilib cases" Laurentiu Palcu
@ 2013-04-26 8:04 ` Laurentiu Palcu
2013-04-26 8:04 ` [PATCH v2 5/5] Pass the mlprefix to postinst_intercept script Laurentiu Palcu
4 siblings, 0 replies; 6+ messages in thread
From: Laurentiu Palcu @ 2013-04-26 8:04 UTC (permalink / raw)
To: openembedded-core
When using multilib, the hooks for lib32/lib64 must be different because
the libdir/base_libdir point to different locations. Postinstalls
calling postint_intercept script must pass the mlprefix in the 3rd
argument.
Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
---
scripts/postinst-intercepts/postinst_intercept | 23 +++++++++++++++++++++--
1 file changed, 21 insertions(+), 2 deletions(-)
diff --git a/scripts/postinst-intercepts/postinst_intercept b/scripts/postinst-intercepts/postinst_intercept
index ed32f27..27c2568 100755
--- a/scripts/postinst-intercepts/postinst_intercept
+++ b/scripts/postinst-intercepts/postinst_intercept
@@ -5,21 +5,40 @@
# is valid. Also, if one wants to pass any variables to the intercept script from
# the postinstall itself, they will be added immediately after the shebang line.
#
-# Usage: postinst_intercept <intercept_script_name> <package_name> <var1=...> ... <varN=...>
+# Usage: postinst_intercept <intercept_script_name> <package_name> <mlprefix=...> <var1=...> ... <varN=...>
# * intercept_script_name - the name of the intercept script we want to change;
# * package_name - add the package_name to list of packages the intercept script
# is used for;
+# * mlprefix=... - this one is needed in order to have separate hooks for multilib.
# * var1=... - var1 will have the value we provide in the intercept script. This
# is useful when we want to pass on variables like ${libdir} to
# the intercept script;
#
-[ $# -lt 2 ] && exit 1
+[ $# -lt 3 ] && exit 1
intercept_script=$INTERCEPT_DIR/$1 && shift
package_name=$1 && shift
+mlprefix=$(echo $1 |sed -ne "s/^mlprefix=\(.*\)-/\1/p") && shift
+# if the hook we want to install does not exist, then there's nothing we can do
[ -f "$intercept_script" ] || exit 1
+# if the postinstall wanting to install the hook belongs to a multilib package,
+# then we'd better have a separate hook for this because the default ${libdir} and
+# ${base_libdir} will point to the wrong locations
+if [ -n "$mlprefix" ]; then
+ ml_intercept_script=$intercept_script-$mlprefix
+ # if the multilib hook does not exist, create it from the default one
+ if [ ! -f "$ml_intercept_script" ]; then
+ cp $intercept_script $ml_intercept_script
+
+ # clear the ##PKGS: line and the already set variables
+ [ -x "$ml_intercept_script" ] && sed -i -e "2,$(($#+1)) {/.*/d}" -e "/^##PKGS: .*/d" $ml_intercept_script
+ fi
+
+ intercept_script=$ml_intercept_script
+fi
+
chmod +x "$intercept_script"
pkgs_line="$(cat $intercept_script|grep "##PKGS:")"
--
1.7.9.5
^ permalink raw reply related [flat|nested] 6+ messages in thread* [PATCH v2 5/5] Pass the mlprefix to postinst_intercept script
2013-04-26 8:03 [PATCH v2 0/5] Multilib related postinstall fixes Laurentiu Palcu
` (3 preceding siblings ...)
2013-04-26 8:04 ` [PATCH v2 4/5] scripts/postinst-intercepts: create separete hooks for multilib Laurentiu Palcu
@ 2013-04-26 8:04 ` Laurentiu Palcu
4 siblings, 0 replies; 6+ messages in thread
From: Laurentiu Palcu @ 2013-04-26 8:04 UTC (permalink / raw)
To: openembedded-core
This is needed in order to have separate multilib intercept hooks.
Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
---
meta/classes/fontcache.bbclass | 2 +-
meta/classes/gtk-icon-cache.bbclass | 4 ++--
meta/classes/pixbufcache.bbclass | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/meta/classes/fontcache.bbclass b/meta/classes/fontcache.bbclass
index 9136c5a..325bcae 100644
--- a/meta/classes/fontcache.bbclass
+++ b/meta/classes/fontcache.bbclass
@@ -10,7 +10,7 @@ FONT_PACKAGES ??= "${PN}"
fontcache_common() {
if [ "x$D" != "x" ] ; then
- $INTERCEPT_DIR/postinst_intercept update_font_cache ${PKG} bindir=${bindir} \
+ $INTERCEPT_DIR/postinst_intercept update_font_cache ${PKG} mlprefix=${MLPREFIX} bindir=${bindir} \
libdir=${libdir} base_libdir=${base_libdir}
else
fc-cache
diff --git a/meta/classes/gtk-icon-cache.bbclass b/meta/classes/gtk-icon-cache.bbclass
index 7f24d49..789fa38 100644
--- a/meta/classes/gtk-icon-cache.bbclass
+++ b/meta/classes/gtk-icon-cache.bbclass
@@ -4,7 +4,7 @@ DEPENDS += "${@['hicolor-icon-theme', '']['${BPN}' == 'hicolor-icon-theme']} gtk
gtk_icon_cache_postinst() {
if [ "x$D" != "x" ]; then
- $INTERCEPT_DIR/postinst_intercept update_icon_cache ${PKG} libdir=${libdir} \
+ $INTERCEPT_DIR/postinst_intercept update_icon_cache ${PKG} mlprefix=${MLPREFIX} libdir=${libdir} \
base_libdir=${base_libdir}
else
@@ -21,7 +21,7 @@ fi
gtk_icon_cache_postrm() {
if [ "x$D" != "x" ]; then
- $INTERCEPT_DIR/postinst_intercept update_icon_cache ${PKG} libdir=${libdir} \
+ $INTERCEPT_DIR/postinst_intercept update_icon_cache ${PKG} mlprefix=${MLPREFIX} libdir=${libdir} \
base_libdir=${base_libdir}
else
for icondir in /usr/share/icons/* ; do
diff --git a/meta/classes/pixbufcache.bbclass b/meta/classes/pixbufcache.bbclass
index 4e0f577..37bf812 100644
--- a/meta/classes/pixbufcache.bbclass
+++ b/meta/classes/pixbufcache.bbclass
@@ -10,7 +10,7 @@ PIXBUF_PACKAGES ??= "${PN}"
pixbufcache_common() {
if [ "x$D" != "x" ]; then
- $INTERCEPT_DIR/postinst_intercept update_pixbuf_cache ${PKG} libdir=${libdir} \
+ $INTERCEPT_DIR/postinst_intercept update_pixbuf_cache ${PKG} mlprefix=${MLPREFIX} libdir=${libdir} \
bindir=${bindir} base_libdir=${base_libdir}
else
--
1.7.9.5
^ permalink raw reply related [flat|nested] 6+ messages in thread