Patchwork [4/4] gtk-immodules-cache.bbclass:fix support postrm at image creation time

login
register
mail settings
Submitter Hongxu Jia
Date Jan. 17, 2013, 12:56 p.m.
Message ID <e32c29fce3b22061311ae40aa9e9456af3dd64ee.1358427029.git.hongxu.jia@windriver.com>
Download mbox | patch
Permalink /patch/42791/
State Accepted
Commit 44f232f6f8d03fe4e1873fee4cd2f6c61801a510
Headers show

Comments

Hongxu Jia - Jan. 17, 2013, 12:56 p.m.
Let postrm use the same logic as the postinst to run on both build machine
and target

[YOCTO #3633]

Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
---
 meta/classes/gtk-immodules-cache.bbclass |   13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

Patch

diff --git a/meta/classes/gtk-immodules-cache.bbclass b/meta/classes/gtk-immodules-cache.bbclass
index 9ffb03b..a8855af 100644
--- a/meta/classes/gtk-immodules-cache.bbclass
+++ b/meta/classes/gtk-immodules-cache.bbclass
@@ -31,7 +31,18 @@  fi
 
 gtk_immodule_cache_postrm() {
 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