Multilib related postinstall fixes
v2 cover Multilib related postinstall fixes
Changes in v2:
* addressed Mark's comment
There is still work to do on the multilib postinstalls running on host front. This is a first patchset trying to address some of the issues.
Thanks,
Laurentiu
The following changes since commit addcfcda84ed6b43b00f569a6060e3b78196ef52:
glib-2.0: disable tests for native builds, and respect ptest for LSB (2013-04-23 13:00:43 +0100)
are available in the git repository at:
git://git.yoctoproject.org/poky-contrib lpalcu/ml_postinstall_fixes
http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=lpalcu/ml_postinstall_fixes
Laurentiu Palcu (5):
qemuwrapper: use fallback in case the ELF binary is wrong
pango: fix postinstall when using multilib
Revert "qemu.bbclass: Use the correct qemu binary in multilib cases" scripts/postinst-intercepts: create separete hooks for multilib Pass the mlprefix to postinst_intercept script
meta/classes/fontcache.bbclass | 2 +- meta/classes/gtk-icon-cache.bbclass | 4 +-- meta/classes/pixbufcache.bbclass | 2 +- meta/classes/qemu.bbclass | 4 +-- .../recipes-devtools/qemu/qemuwrapper-cross_1.0.bb | 28 +++++++++++++++++++- meta/recipes-graphics/pango/pango.inc | 2 +- scripts/postinst-intercepts/postinst_intercept | 23 ++++++++++++++-- 7 files changed, 54 insertions(+), 11 deletions(-)
Signature · 1 line
1.7.9.5
PATCH v2 1/5 qemuwrapper: use fallback in case the ELF binary is wrong
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.
--- .../recipes-devtools/qemu/qemuwrapper-cross_1.0.bb | 28 +++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-)
meta/recipes-devtools/qemu/qemuwrapper-cross_1.0.bb +27 -1
@@ -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 }
Signature · 1 line
1.7.9.5
PATCH v2 2/5 pango: fix postinstall when using multilib
In reply to Laurentiu PalcuThe pango-query-modules binary gets a multilib prefix and the postinstall has to call the appropriate binary.
--- meta/recipes-graphics/pango/pango.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
meta/recipes-graphics/pango/pango.inc +1 -1
@@ -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
Signature · 1 line
1.7.9.5
PATCH v2 3/5 Revert "qemu.bbclass: Use the correct qemu binary in multilib cases"
In reply to Laurentiu PalcuThis 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;
--- meta/classes/qemu.bbclass | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
meta/classes/qemu.bbclass +1 -3
@@ -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":
Signature · 1 line
1.7.9.5
PATCH v2 4/5 scripts/postinst-intercepts: create separete hooks for multilib
In reply to Laurentiu PalcuWhen 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.
--- scripts/postinst-intercepts/postinst_intercept | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-)
scripts/postinst-intercepts/postinst_intercept +21 -2
@@ -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:")"
Signature · 1 line
1.7.9.5
PATCH v2 5/5 Pass the mlprefix to postinst_intercept script
In reply to Laurentiu PalcuThis is needed in order to have separate multilib intercept hooks.
--- meta/classes/fontcache.bbclass | 2 +- meta/classes/gtk-icon-cache.bbclass | 4 ++-- meta/classes/pixbufcache.bbclass | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-)
meta/classes/fontcache.bbclass +1 -1
@@ -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
meta/classes/gtk-icon-cache.bbclass +2 -2
@@ -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
meta/classes/pixbufcache.bbclass +1 -1
@@ -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
Signature · 1 line
1.7.9.5