All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/3] have input method modules cached at do-rootfs time
@ 2012-12-20 13:15 Laurentiu Palcu
  2012-12-20 13:15 ` [PATCH v2 1/3] qemu.bbclass: add qemu_run_binary() function Laurentiu Palcu
                   ` (3 more replies)
  0 siblings, 4 replies; 11+ messages in thread
From: Laurentiu Palcu @ 2012-12-20 13:15 UTC (permalink / raw)
  To: openembedded-core

changes in v2:
 * added a new qemu.bbclass function that will return a string containing the
   command line needed to run a target binary through qemu at postinstall time;
 * use 'readelf -l' instead of 'readelf -a' for retrieving the dynamic loader
   path;

from v1:
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 (3):
  qemu.bbclass: add qemu_run_binary() function
  gtk-immodules-cache.bbclass: allow for offline cache generation
  matchbox-keyboard: use the gtk-immodules-cache.bbclass

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

-- 
1.7.9.5




^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH v2 1/3] qemu.bbclass: add qemu_run_binary() function
  2012-12-20 13:15 [PATCH v2 0/3] have input method modules cached at do-rootfs time Laurentiu Palcu
@ 2012-12-20 13:15 ` Laurentiu Palcu
  2012-12-20 14:45   ` Burton, Ross
  2012-12-20 13:15 ` [PATCH v2 2/3] gtk-immodules-cache.bbclass: allow for offline cache generation Laurentiu Palcu
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 11+ messages in thread
From: Laurentiu Palcu @ 2012-12-20 13:15 UTC (permalink / raw)
  To: openembedded-core

[YOCTO #3602]

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
---
 meta/classes/qemu.bbclass |   17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/meta/classes/qemu.bbclass b/meta/classes/qemu.bbclass
index aead8e2..13af339 100644
--- a/meta/classes/qemu.bbclass
+++ b/meta/classes/qemu.bbclass
@@ -13,3 +13,20 @@ def qemu_target_binary(data):
         target_arch = "ppc64"
 
     return "qemu-" + target_arch
+#
+# Next function will return a string containing the command that is needed to
+# to run a certain binary through qemu. For example, in order to make a certain
+# postinstall scriptlet run at do_rootfs time and running the postinstall is
+# architecture dependent, we can run it through qemu. For example, in the
+# postinstall scriptlet, we could use the following:
+#
+# ${@qemu_run_binary(d, '$D', '/usr/bin/test_app')} [test_app arguments]
+#
+def qemu_run_binary(data, rootfs_path, binary):
+    dynamic_loader = rootfs_path + '$(readelf -l ' + rootfs_path + \
+                     binary + '| grep "Requesting program interpreter"|sed -e \'s/^.*\[.*: \(.*\)\]/\\1/\')'
+    library_path = rootfs_path + data.getVar("base_libdir", True) + ":" + \
+                   rootfs_path + data.getVar("libdir", True)
+
+    return qemu_target_binary(data) + " " + dynamic_loader + " --library-path " + library_path \
+           + " " + rootfs_path + binary
-- 
1.7.9.5




^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH v2 2/3] gtk-immodules-cache.bbclass: allow for offline cache generation
  2012-12-20 13:15 [PATCH v2 0/3] have input method modules cached at do-rootfs time Laurentiu Palcu
  2012-12-20 13:15 ` [PATCH v2 1/3] qemu.bbclass: add qemu_run_binary() function Laurentiu Palcu
@ 2012-12-20 13:15 ` Laurentiu Palcu
  2012-12-20 14:45   ` Burton, Ross
  2012-12-20 13:15 ` [PATCH v2 3/3] matchbox-keyboard: use the gtk-immodules-cache.bbclass Laurentiu Palcu
  2013-01-09 11:14 ` [PATCH v2 0/3] have input method modules cached at do-rootfs time Laurentiu Palcu
  3 siblings, 1 reply; 11+ messages in thread
From: Laurentiu Palcu @ 2012-12-20 13:15 UTC (permalink / raw)
  To: openembedded-core

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.

[YOCTO #3602]

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
---
 meta/classes/gtk-immodules-cache.bbclass |   17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/meta/classes/gtk-immodules-cache.bbclass b/meta/classes/gtk-immodules-cache.bbclass
index 515d28b..9ffb03b 100644
--- a/meta/classes/gtk-immodules-cache.bbclass
+++ b/meta/classes/gtk-immodules-cache.bbclass
@@ -2,9 +2,24 @@
 #
 # 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)
+            ${@qemu_run_binary(d, '$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




^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH v2 3/3] matchbox-keyboard: use the gtk-immodules-cache.bbclass
  2012-12-20 13:15 [PATCH v2 0/3] have input method modules cached at do-rootfs time Laurentiu Palcu
  2012-12-20 13:15 ` [PATCH v2 1/3] qemu.bbclass: add qemu_run_binary() function Laurentiu Palcu
  2012-12-20 13:15 ` [PATCH v2 2/3] gtk-immodules-cache.bbclass: allow for offline cache generation Laurentiu Palcu
@ 2012-12-20 13:15 ` Laurentiu Palcu
  2012-12-20 14:40   ` Burton, Ross
  2013-01-09 11:14 ` [PATCH v2 0/3] have input method modules cached at do-rootfs time Laurentiu Palcu
  3 siblings, 1 reply; 11+ messages in thread
From: Laurentiu Palcu @ 2012-12-20 13:15 UTC (permalink / raw)
  To: openembedded-core

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 <laurentiu.palcu@intel.com>
---
 .../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




^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH v2 3/3] matchbox-keyboard: use the gtk-immodules-cache.bbclass
  2012-12-20 13:15 ` [PATCH v2 3/3] matchbox-keyboard: use the gtk-immodules-cache.bbclass Laurentiu Palcu
@ 2012-12-20 14:40   ` Burton, Ross
  0 siblings, 0 replies; 11+ messages in thread
From: Burton, Ross @ 2012-12-20 14:40 UTC (permalink / raw)
  To: Laurentiu Palcu; +Cc: openembedded-core

On 20 December 2012 13:15, Laurentiu Palcu <laurentiu.palcu@intel.com> wrote:
> Since the class was already present, use it. Also, this will have the
> postinstalls run on host, at do_rootfs time.

Signed-off-by: Ross Burton <ross.burton@intel.com>

Ross



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v2 1/3] qemu.bbclass: add qemu_run_binary() function
  2012-12-20 13:15 ` [PATCH v2 1/3] qemu.bbclass: add qemu_run_binary() function Laurentiu Palcu
@ 2012-12-20 14:45   ` Burton, Ross
  2012-12-20 14:59     ` Laurentiu Palcu
  0 siblings, 1 reply; 11+ messages in thread
From: Burton, Ross @ 2012-12-20 14:45 UTC (permalink / raw)
  To: Laurentiu Palcu; +Cc: openembedded-core

On 20 December 2012 13:15, Laurentiu Palcu <laurentiu.palcu@intel.com> wrote:
> dynamic_loader = rootfs_path + '$(readelf -l ' + rootfs_path + \
>       binary + '| grep "Requesting program interpreter"|sed -e \'s/^.*\[.*: \(.*\)\]/\\1/\')'

Would it be easier to do the string manipulation in python?  Spawning
grep and sed when Python can do string manipulation seems excessive.

Nice addition to the class though.

Ross



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v2 2/3] gtk-immodules-cache.bbclass: allow for offline cache generation
  2012-12-20 13:15 ` [PATCH v2 2/3] gtk-immodules-cache.bbclass: allow for offline cache generation Laurentiu Palcu
@ 2012-12-20 14:45   ` Burton, Ross
  0 siblings, 0 replies; 11+ messages in thread
From: Burton, Ross @ 2012-12-20 14:45 UTC (permalink / raw)
  To: Laurentiu Palcu; +Cc: openembedded-core

On 20 December 2012 13:15, Laurentiu Palcu <laurentiu.palcu@intel.com> wrote:
> 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: Ross Burton <ross.burton@intel.com>

Ross



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v2 1/3] qemu.bbclass: add qemu_run_binary() function
  2012-12-20 14:45   ` Burton, Ross
@ 2012-12-20 14:59     ` Laurentiu Palcu
  2012-12-20 15:19       ` Burton, Ross
  0 siblings, 1 reply; 11+ messages in thread
From: Laurentiu Palcu @ 2012-12-20 14:59 UTC (permalink / raw)
  To: Burton, Ross; +Cc: openembedded-core


On 12/20/2012 04:45 PM, Burton, Ross wrote:
> On 20 December 2012 13:15, Laurentiu Palcu <laurentiu.palcu@intel.com> wrote:
>> dynamic_loader = rootfs_path + '$(readelf -l ' + rootfs_path + \
>>       binary + '| grep "Requesting program interpreter"|sed -e \'s/^.*\[.*: \(.*\)\]/\\1/\')'
> 
> Would it be easier to do the string manipulation in python?  Spawning
> grep and sed when Python can do string manipulation seems excessive.
Ok, I agree. But how do you call python routines from the postinstall
scriptlets which run in do_rootfs context? readelf needs to run at
postinstall time because the binary we run through qemu does not
necessarily belong to the same package. Let's take, for example, the
current patchset. You can have a recipe that provides an input method
module and call gtk-query-modules-2.0 binary to create the cache.

If you know a method to do it, feel free to share.

Thanks,
Laurentiu

> 
> Nice addition to the class though.
> 
> Ross
> 



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v2 1/3] qemu.bbclass: add qemu_run_binary() function
  2012-12-20 14:59     ` Laurentiu Palcu
@ 2012-12-20 15:19       ` Burton, Ross
  0 siblings, 0 replies; 11+ messages in thread
From: Burton, Ross @ 2012-12-20 15:19 UTC (permalink / raw)
  To: Laurentiu Palcu; +Cc: openembedded-core

On 20 December 2012 14:59, Laurentiu Palcu <laurentiu.palcu@intel.com> wrote:
> Ok, I agree. But how do you call python routines from the postinstall
> scriptlets which run in do_rootfs context? readelf needs to run at
> postinstall time because the binary we run through qemu does not
> necessarily belong to the same package. Let's take, for example, the
> current patchset. You can have a recipe that provides an input method
> module and call gtk-query-modules-2.0 binary to create the cache.

Right, of course.  awk might be clearer than grep/sed but only marginally...

Ross



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v2 0/3] have input method modules cached at do-rootfs time
  2012-12-20 13:15 [PATCH v2 0/3] have input method modules cached at do-rootfs time Laurentiu Palcu
                   ` (2 preceding siblings ...)
  2012-12-20 13:15 ` [PATCH v2 3/3] matchbox-keyboard: use the gtk-immodules-cache.bbclass Laurentiu Palcu
@ 2013-01-09 11:14 ` Laurentiu Palcu
  2013-01-09 18:35   ` Saul Wold
  3 siblings, 1 reply; 11+ messages in thread
From: Laurentiu Palcu @ 2013-01-09 11:14 UTC (permalink / raw)
  To: openembedded-core, Saul Wold

Hi Saul,

Any reason for not merging this patchset?

Thanks,
Laurentiu

On 12/20/2012 03:15 PM, Laurentiu Palcu wrote:
> changes in v2:
>  * added a new qemu.bbclass function that will return a string containing the
>    command line needed to run a target binary through qemu at postinstall time;
>  * use 'readelf -l' instead of 'readelf -a' for retrieving the dynamic loader
>    path;
> 
> from v1:
> 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 (3):
>   qemu.bbclass: add qemu_run_binary() function
>   gtk-immodules-cache.bbclass: allow for offline cache generation
>   matchbox-keyboard: use the gtk-immodules-cache.bbclass
> 
>  meta/classes/gtk-immodules-cache.bbclass           |   17 ++++++++++++++++-
>  meta/classes/qemu.bbclass                          |   17 +++++++++++++++++
>  .../matchbox-keyboard/matchbox-keyboard_git.bb     |   18 ++----------------
>  3 files changed, 35 insertions(+), 17 deletions(-)
> 



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v2 0/3] have input method modules cached at do-rootfs time
  2013-01-09 11:14 ` [PATCH v2 0/3] have input method modules cached at do-rootfs time Laurentiu Palcu
@ 2013-01-09 18:35   ` Saul Wold
  0 siblings, 0 replies; 11+ messages in thread
From: Saul Wold @ 2013-01-09 18:35 UTC (permalink / raw)
  To: Laurentiu Palcu; +Cc: openembedded-core

On 01/09/2013 03:14 AM, Laurentiu Palcu wrote:
> Hi Saul,
>
> Any reason for not merging this patchset?
>
I thought there was a pending re-work of the grep/sed to awk per Ross's 
last email on the qemu.bbclass patch.  I will pull it into a MUT and test.

Sau!

> Thanks,
> Laurentiu
>
> On 12/20/2012 03:15 PM, Laurentiu Palcu wrote:
>> changes in v2:
>>   * added a new qemu.bbclass function that will return a string containing the
>>     command line needed to run a target binary through qemu at postinstall time;
>>   * use 'readelf -l' instead of 'readelf -a' for retrieving the dynamic loader
>>     path;
>>
>> from v1:
>> 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 (3):
>>    qemu.bbclass: add qemu_run_binary() function
>>    gtk-immodules-cache.bbclass: allow for offline cache generation
>>    matchbox-keyboard: use the gtk-immodules-cache.bbclass
>>
>>   meta/classes/gtk-immodules-cache.bbclass           |   17 ++++++++++++++++-
>>   meta/classes/qemu.bbclass                          |   17 +++++++++++++++++
>>   .../matchbox-keyboard/matchbox-keyboard_git.bb     |   18 ++----------------
>>   3 files changed, 35 insertions(+), 17 deletions(-)
>>
>
>



^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2013-01-09 18:51 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-20 13:15 [PATCH v2 0/3] have input method modules cached at do-rootfs time Laurentiu Palcu
2012-12-20 13:15 ` [PATCH v2 1/3] qemu.bbclass: add qemu_run_binary() function Laurentiu Palcu
2012-12-20 14:45   ` Burton, Ross
2012-12-20 14:59     ` Laurentiu Palcu
2012-12-20 15:19       ` Burton, Ross
2012-12-20 13:15 ` [PATCH v2 2/3] gtk-immodules-cache.bbclass: allow for offline cache generation Laurentiu Palcu
2012-12-20 14:45   ` Burton, Ross
2012-12-20 13:15 ` [PATCH v2 3/3] matchbox-keyboard: use the gtk-immodules-cache.bbclass Laurentiu Palcu
2012-12-20 14:40   ` Burton, Ross
2013-01-09 11:14 ` [PATCH v2 0/3] have input method modules cached at do-rootfs time Laurentiu Palcu
2013-01-09 18:35   ` Saul Wold

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.