Skip to contentSkip to conversation

fix support postrm/prerm at image creation time

PATCH New Hongxu Jia 1 participant 5 messages Jan 17, 2013

lore
Share & tools
lore

Hongxu Jia

author
#0 lore raw

v2 cover fix support postrm/prerm at image creation time

There are defects to support prerm/postrm at image creation time. Change with V1:
1) gtk-icon-cache.bbclass: install hook instead of calling gtk-update-icon-cache directly.
2) libnss-mdns: delete test $D, directly use $D/etc/nsswitch.conf.
3) gtk-immodules-cache.bbclass: postrm use the same logic as the postinst.

[YOCTO #3633] is about 1) gtk-icon-cache.bbclass

The following changes since commit 9f263a60e3521b800121a6f527a7b30dc9b62432:

oprofile: add AArch64 support (2013-01-16 16:10:39 +0000)

are available in the git repository at:

git://git.pokylinux.org/poky-contrib hongxu/fix-postrm
http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=hongxu/fix-postrm

Hongxu Jia (4):
gtk-icon-cache.bbclass:fix support postrm at image creation time update-rc.d:fix support postrm at image creation time libnss-mdns:fix support prerm at image creation time gtk-immodules-cache.bbclass:fix support postrm at image creation time

 meta/classes/gtk-icon-cache.bbclass                  |   18 ++++++++++++++++++
 meta/classes/gtk-immodules-cache.bbclass             |   13 ++++++++++++-
 meta/classes/update-rc.d.bbclass                     |    6 +++++-
 .../libnss-mdns/libnss-mdns_0.10.bb                  |    4 ++--
 4 files changed, 37 insertions(+), 4 deletions(-)
Signature · 1 line
1.7.10.4
author
#1 lore raw

PATCH v2 1/4 gtk-icon-cache.bbclass:fix support postrm at image creation time

When use postrm on the build machine, it installs the hook in intercept-scripts directory and exit 0, the hook will be later invoked and it will properly call gtk-update-icon-cache.

[YOCTO #3633]

---
 meta/classes/gtk-icon-cache.bbclass |   18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
meta/classes/gtk-icon-cache.bbclass +18 -0
index 7c7dd78..d5fdcd5 100644
@@ -32,6 +32,24 @@ done
 }
 
 gtk_icon_cache_postrm() {
+if [ "x$D" != "x" ]; then
+    if [ ! -f $INTERCEPT_DIR/update_icon_cache ]; then
+        cat << "EOF" > $INTERCEPT_DIR/update_icon_cache
+#!/bin/sh
+
+# update native pixbuf loaders
+gdk-pixbuf-query-loaders --update-cache
+
+for icondir in $D/usr/share/icons/*/ ; do
+    if [ -d $icondir ] ; then
+        gtk-update-icon-cache -fqt  $icondir
+    fi
+done
+EOF
+    fi
+    exit 0
+fi
+
 for icondir in /usr/share/icons/* ; do
     if [ -d $icondir ] ; then
         gtk-update-icon-cache -qt  $icondir
Signature · 1 line
1.7.10.4
author
#2 lore raw

PATCH v2 2/4 update-rc.d:fix support postrm at image creation time

In reply to Hongxu Jia

updatercd_postrm failed at image creation time because "-f -r ${D}" is not used as update-rc.d's option.

[YOCTO #3633]

---
 meta/classes/update-rc.d.bbclass |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
meta/classes/update-rc.d.bbclass +5 -1
index 3364269..83816d6 100644
@@ -28,7 +28,11 @@ fi
 }
 
 updatercd_postrm() {
-update-rc.d $D ${INITSCRIPT_NAME} remove
+if [ "$D" != "" ]; then
+	update-rc.d -f -r $D ${INITSCRIPT_NAME} remove
+else
+	update-rc.d ${INITSCRIPT_NAME} remove
+fi
 }
 
 
Signature · 1 line
1.7.10.4
author
#3 lore raw

PATCH v2 3/4 libnss-mdns:fix support prerm at image creation time

In reply to Hongxu Jia

The pkg_prerm_${PN} failed at image creation time because $D is not assigned as the prefix of "/etc/nsswitch.conf"

[YOCTO #3633]

---
 meta/recipes-connectivity/libnss-mdns/libnss-mdns_0.10.bb |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
meta/recipes-connectivity/libnss-mdns/libnss-mdns_0.10.bb +2 -2
index f7356e4..a2712c9 100644
@@ -7,7 +7,7 @@ LIC_FILES_CHKSUM = "file://LICENSE;md5=2d5025d4aa3495befef8f17206a5b0a1"
 
 DEPENDS = "avahi"
 RDEPENDS_${PN} = "avahi-daemon"
-PR = "r6"
+PR = "r7"
 
 SRC_URI = "http://0pointer.de/lennart/projects/nss-mdns/nss-mdns-${PV}.tar.gz"
 
@@ -32,5 +32,5 @@ pkg_postinst_${PN} () {
 pkg_prerm_${PN} () {
 	sed -e '/^hosts:/s/\s*\<mdns4\>//' \
 		-e '/^hosts:/s/\s*mdns4_minimal\s\+\[NOTFOUND=return\]//' \
-		-i /etc/nsswitch.conf
+		-i $D/etc/nsswitch.conf
 }
Signature · 1 line
1.7.10.4
author
#4 lore raw

PATCH v2 4/4 gtk-immodules-cache.bbclass:fix support postrm at image creation time

In reply to Hongxu Jia

Let postrm use the same logic as the postinst to run on both build machine and target

[YOCTO #3633]

---
 meta/classes/gtk-immodules-cache.bbclass |   13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)
meta/classes/gtk-immodules-cache.bbclass +12 -1
index 9ffb03b..a8855af 100644
@@ -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
Signature · 1 line
1.7.10.4