[PATCH 0/2] have input method modules cached at do-rootfs time

STALE5047d SUPERSEDED

Revision v1 of 2 in this series.

7 messages, 3 authors, 2012-12-19 · open the first message on its own page

[PATCH 0/2] have input method modules cached at do-rootfs time

From: Laurentiu Palcu <hidden>
Date: 2012-12-19 16:17:40

Hi,

This patchset will change the postinstall routine in gtk-immodules-cache.bbclass,
so it can run at do_rootfs time, and changes matchbox-keyboard recipe to use
the class.

Thanks,
Laurentiu

Laurentiu Palcu (2):
  gtk-immodules-cache.bbclass: allow for offline cache generation
  matchbox-keyboard: use the gtk-immodules-cache.bbclass

 meta/classes/gtk-immodules-cache.bbclass           |   22 +++++++++++++++++++-
 .../matchbox-keyboard/matchbox-keyboard_git.bb     |   18 ++--------------
 2 files changed, 23 insertions(+), 17 deletions(-)

-- 
1.7.9.5


[PATCH 1/2] gtk-immodules-cache.bbclass: allow for offline cache generation

From: Laurentiu Palcu <hidden>
Date: 2012-12-19 16:17:41

In order to support a RO rootfs, the cache generation during postinstall
has to be done on host. However, gtk-query-immodules application will
only be able to parse shared objects from the same ELF class.
In order not to have a native package for all the recipes providing
an input method, so we can generate the cache file natively, run
gtk-query-immodules through qemu emulator.

Signed-off-by: Laurentiu Palcu <redacted>
---
 meta/classes/gtk-immodules-cache.bbclass |   22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)
diff --git a/meta/classes/gtk-immodules-cache.bbclass b/meta/classes/gtk-immodules-cache.bbclass
index 515d28b..d57dcae 100644
--- a/meta/classes/gtk-immodules-cache.bbclass
+++ b/meta/classes/gtk-immodules-cache.bbclass
@@ -2,9 +2,29 @@
 #
 # Usage: Set GTKIMMODULES_PACKAGES to the packages that needs to update the inputmethod modules
 
+DEPENDS =+ "qemu-native"
+
 gtk_immodule_cache_postinst() {
 if [ "x$D" != "x" ]; then
-    exit 1
+EMULATOR=qemu-$(echo ${TARGET_ARCH}| \
+    sed -e 's/i[3-6]86/i386/' -e 's/x86[_-]64/x86_64/' \
+        -e 's/powerpc/ppc/')
+
+for maj_ver in 2 3; do
+    if [ -x $D${bindir}/gtk-query-immodules-$maj_ver.0 ]; then
+        IMFILES=$(ls $D${libdir}/gtk-$maj_ver.0/*/immodules/*.so)
+        DYNAMIC_LOADER=$D$(readelf -a $D${bindir}/gtk-query-immodules-$maj_ver.0 |\
+            grep "Requesting program interpreter"|sed -e 's/^.*\[.*: \(.*\)\]/\1/')
+        LIBRARY_PATH=$D${base_libdir}:$D${libdir}
+        $EMULATOR $DYNAMIC_LOADER --library-path $LIBRARY_PATH \
+            $D${bindir}/gtk-query-immodules-$maj_ver.0 $IMFILES > $D/etc/gtk-$maj_ver.0/gtk.immodules 2>/dev/null && \
+            sed -i -e "s:$D::" $D/etc/gtk-$maj_ver.0/gtk.immodules
+
+        [ $? -ne 0 ] && exit 1
+    fi
+done
+
+exit 0
 fi
 if [ ! -z `which gtk-query-immodules-2.0` ]; then
     gtk-query-immodules-2.0 > /etc/gtk-2.0/gtk.immodules
-- 
1.7.9.5


[PATCH 2/2] matchbox-keyboard: use the gtk-immodules-cache.bbclass

From: Laurentiu Palcu <hidden>
Date: 2012-12-19 16:18:06

Since the class was already present, use it. Also, this will have the
postinstalls run on host, at do_rootfs time.

[YOCTO #3602]

Signed-off-by: Laurentiu Palcu <redacted>
---
 .../matchbox-keyboard/matchbox-keyboard_git.bb     |   18 ++----------------
 1 file changed, 2 insertions(+), 16 deletions(-)
diff --git a/meta/recipes-sato/matchbox-keyboard/matchbox-keyboard_git.bb b/meta/recipes-sato/matchbox-keyboard/matchbox-keyboard_git.bb
index adde25b..a7091d2 100644
--- a/meta/recipes-sato/matchbox-keyboard/matchbox-keyboard_git.bb
+++ b/meta/recipes-sato/matchbox-keyboard/matchbox-keyboard_git.bb
@@ -22,7 +22,7 @@ SRC_URI = "git://git.yoctoproject.org/${BPN};protocol=git \
 
 S = "${WORKDIR}/git"
 
-inherit autotools pkgconfig gettext
+inherit autotools pkgconfig gettext gtk-immodules-cache
 
 EXTRA_OECONF = "--disable-cairo --enable-gtk-im --enable-applet"
 
@@ -49,18 +49,4 @@ do_install_append () {
 	rm -f ${D}${libdir}/matchbox-panel/*.la
 }
 
-pkg_postinst_matchbox-keyboard-im () {
-if [ "x$D" != "x" ]; then
-  exit 1
-fi
-
-gtk-query-immodules-2.0 > /etc/gtk-2.0/gtk.immodules
-}
-
-pkg_postrm_matchbox-keyboard-im () {
-if [ "x$D" != "x" ]; then
-  exit 1
-fi
-
-gtk-query-immodules-2.0 > /etc/gtk-2.0/gtk.immodules
-}
+GTKIMMODULES_PACKAGES = "${PN}-im"
-- 
1.7.9.5


Re: [PATCH 1/2] gtk-immodules-cache.bbclass: allow for offline cache generation

From: Phil Blundell <philb@gnu.org>
Date: 2012-12-19 16:21:16

On Wed, 2012-12-19 at 18:02 +0200, Laurentiu Palcu wrote:
quoted hunk
+EMULATOR=qemu-$(echo ${TARGET_ARCH}| \
+    sed -e 's/i[3-6]86/i386/' -e 's/x86[_-]64/x86_64/' \
+        -e 's/powerpc/ppc/')
Maybe you could use ${@qemu_target_binary()} for that.

p.



Re: [PATCH 2/2] matchbox-keyboard: use the gtk-immodules-cache.bbclass

From: Burton, Ross <hidden>
Date: 2012-12-19 17:51:12

On 19 December 2012 16:02, Laurentiu Palcu [off-list ref] wrote:
Since the class was already present, use it. Also, this will have the
postinstalls run on host, at do_rootfs time.

[YOCTO #3602]

Signed-off-by: Laurentiu Palcu <redacted>
Signed-off-by: Ross Burton <redacted>

Ross

Re: [PATCH 1/2] gtk-immodules-cache.bbclass: allow for offline cache generation

From: Burton, Ross <hidden>
Date: 2012-12-19 17:55:19

On 19 December 2012 16:02, Laurentiu Palcu [off-list ref] wrote:
+        DYNAMIC_LOADER=$D$(readelf -a $D${bindir}/gtk-query-immodules-$maj_ver.0 |\
"readelf -l" means less output which is always good.

I'd like to see some of that logic separated out into a bbclass so it
can be easily re-used.

Ross

[PATCH v2] gtk-immodules-cache.bbclass: allow for offline cache generation

From: Laurentiu Palcu <hidden>
Date: 2012-12-19 19:24:34

In order to support a RO rootfs, the cache generation during postinstall
has to be done on host. However, gtk-query-immodules application will
only be able to parse shared objects from the same ELF class.
In order not to have a native package for all the recipes providing
an input method, so we can generate the cache file natively, run
gtk-query-immodules through qemu emulator.

Signed-off-by: Laurentiu Palcu <redacted>
---

Changes in v2:
 * Used qemu_target_binary() function, in order to obtain the qemu binary
   corresponding to the current target, as suggested by Phil (thank you,
   I didn't know that function existed);

Thanks,
Laurentiu

 meta/classes/gtk-immodules-cache.bbclass |   21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)
diff --git a/meta/classes/gtk-immodules-cache.bbclass b/meta/classes/gtk-immodules-cache.bbclass
index 515d28b..72595ee 100644
--- a/meta/classes/gtk-immodules-cache.bbclass
+++ b/meta/classes/gtk-immodules-cache.bbclass
@@ -2,9 +2,28 @@
 #
 # Usage: Set GTKIMMODULES_PACKAGES to the packages that needs to update the inputmethod modules
 
+DEPENDS =+ "qemu-native"
+
+inherit qemu
+
 gtk_immodule_cache_postinst() {
 if [ "x$D" != "x" ]; then
-    exit 1
+
+for maj_ver in 2 3; do
+    if [ -x $D${bindir}/gtk-query-immodules-$maj_ver.0 ]; then
+        IMFILES=$(ls $D${libdir}/gtk-$maj_ver.0/*/immodules/*.so)
+        DYNAMIC_LOADER=$D$(readelf -a $D${bindir}/gtk-query-immodules-$maj_ver.0 |\
+            grep "Requesting program interpreter"|sed -e 's/^.*\[.*: \(.*\)\]/\1/')
+        LIBRARY_PATH=$D${base_libdir}:$D${libdir}
+        ${@qemu_target_binary(d)} $DYNAMIC_LOADER --library-path $LIBRARY_PATH \
+            $D${bindir}/gtk-query-immodules-$maj_ver.0 $IMFILES > $D/etc/gtk-$maj_ver.0/gtk.immodules 2>/dev/null && \
+            sed -i -e "s:$D::" $D/etc/gtk-$maj_ver.0/gtk.immodules
+
+        [ $? -ne 0 ] && exit 1
+    fi
+done
+
+exit 0
 fi
 if [ ! -z `which gtk-query-immodules-2.0` ]; then
     gtk-query-immodules-2.0 > /etc/gtk-2.0/gtk.immodules
-- 
1.7.9.5


Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help