Skip to contentSkip to conversation

fix support postrm/prerm at image creation time

PATCH Superseded Hongxu Jia 4 participants 14 messages Jan 17, 2013

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Hongxu Jia

author
#0 lore raw

cover fix support postrm/prerm at image creation time

There are defects to support prerm/postrm at image creation time:
1) gtk-icon-cache.bbclass:support postrm at image creation time
2) update-rc.d:support postrm at image creation time
3) libnss-mdns:support prerm at image creation time
4) gtk-immodules-cache.bbclass:fix support postrm at image creation time

[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                       |    9 +++++++++
 meta/classes/gtk-immodules-cache.bbclass                  |    2 +-
 meta/classes/update-rc.d.bbclass                          |    6 +++++-
 meta/recipes-connectivity/libnss-mdns/libnss-mdns_0.10.bb |   11 +++++++++--
 4 files changed, 24 insertions(+), 4 deletions(-)
Signature · 1 line
1.7.10.4
author
#1 lore raw

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

The gtk_icon_cache_postrm failed at image creation time because ${D} is not assigned as the prefix of icondir.

[YOCTO #3633]

---
 meta/classes/gtk-icon-cache.bbclass |    9 +++++++++
 1 file changed, 9 insertions(+)
meta/classes/gtk-icon-cache.bbclass +9 -0
index 7c7dd78..4499782 100644
@@ -32,6 +32,15 @@ done
 }
 
 gtk_icon_cache_postrm() {
+if [ "$D" != "" ]; then
+    for icondir in $D/usr/share/icons/* ; do
+        if [ -d $icondir ] ; then
+            gtk-update-icon-cache -qt  $icondir
+        fi
+    done
+    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
#2 lore raw

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

meta/classes/gtk-icon-cache.bbclass done · line 42

Quoted 9 lines · Hongxu Jia

gtk_icon_cache_postrm() {

meta/classes/gtk-icon-cache.bbclass +8 -0
+if [ "$D" != "" ]; then
+    for icondir in $D/usr/share/icons/* ; do
+        if [ -d $icondir ] ; then
+            gtk-update-icon-cache -qt  $icondir
+        fi
+    done
+    exit 0
+fi

I think you can just exit 0 here and let the hook in intercept-scripts directory do the rest. The hook was added in the postinst and it will properly call gtk-update-icon-cache. If you look in the log.do_rootfs you'll see that the intercept scripts are run at the end (just look for "Running intercept scripts"). So, I don't think you need to do this loop here. Besides, it will be called for every postrm and running gtk-update-icon-cache is not cheap...

Thanks,
Laurentiu

author
#3 lore raw

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

Quoted 19 lines · Laurentiu Palcu

meta/classes/gtk-icon-cache.bbclass done · line 42

Quoted 9 lines · Hongxu Jia
  gtk_icon_cache_postrm() {
meta/classes/gtk-icon-cache.bbclass +8 -0
+if [ "$D" != "" ]; then
+    for icondir in $D/usr/share/icons/* ; do
+        if [ -d $icondir ] ; then
+            gtk-update-icon-cache -qt  $icondir
+        fi
+    done
+    exit 0
+fi

I think you can just exit 0 here and let the hook in intercept-scripts directory do the rest. The hook was added in the postinst and it will properly call gtk-update-icon-cache. If you look in the log.do_rootfs you'll see that the intercept scripts are run at the end (just look for "Running intercept scripts"). So, I don't think you need to do this loop here. Besides, it will be called for every postrm and running gtk-update-icon-cache is not cheap...

Quoted 2 lines

Thanks,
Laurentiu

Ok, I will work on it to let the hook in intercept-scripts do the rest.

Thanks,
Hongxu

#4 lore raw

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

Quoted 20 lines · Hongxu Jia
Quoted 19 lines · Laurentiu Palcu

meta/classes/gtk-icon-cache.bbclass done · line 42

Quoted 9 lines · Hongxu Jia
  gtk_icon_cache_postrm() {
meta/classes/gtk-icon-cache.bbclass +8 -0
+if [ "$D" != "" ]; then
+    for icondir in $D/usr/share/icons/* ; do
+        if [ -d $icondir ] ; then
+            gtk-update-icon-cache -qt  $icondir
+        fi
+    done
+    exit 0
+fi

I think you can just exit 0 here and let the hook in intercept-scripts directory do the rest. The hook was added in the postinst and it will properly call gtk-update-icon-cache. If you look in the log.do_rootfs you'll see that the intercept scripts are run at the end (just look for "Running intercept scripts"). So, I don't think you need to do this loop here. Besides, it will be called for every postrm and running gtk-update-icon-cache is not cheap...

Quoted 3 lines
Quoted 2 lines

Thanks,
Laurentiu

Ok, I will work on it to let the hook in intercept-scripts do the rest.

I just realized that, in order for the hook to be installed, the postint scriptlet has to be run in the same do_rootfs session, otherwise the hook will not be installed... In which case you might want to do that in the postrm itself (like it was done for postinst).

Thanks,
Laurentiu

Quoted 4 lines

Thanks,
Hongxu

#5 lore raw

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

In reply to Hongxu Jia
Quoted 2 lines · Hongxu Jia

The gtk_icon_cache_postrm failed at image creation time because ${D} is not assigned as the prefix of icondir.

Some packages are removed at image creation time? Why is postrm executed?

And why don't use use $D in both cases (when empty and not empty) those 2 for cycles look the same.

Cheers,

Quoted 35 lines

[YOCTO #3633]

---
 meta/classes/gtk-icon-cache.bbclass |    9 +++++++++
 1 file changed, 9 insertions(+)
meta/classes/gtk-icon-cache.bbclass +9 -0
index 7c7dd78..4499782 100644
@@ -32,6 +32,15 @@ done
 }
 
 gtk_icon_cache_postrm() {
+if [ "$D" != "" ]; then
+    for icondir in $D/usr/share/icons/* ; do
+        if [ -d $icondir ] ; then
+            gtk-update-icon-cache -qt  $icondir
+        fi
+    done
+    exit 0
+fi
+
 for icondir in /usr/share/icons/* ; do
     if [ -d $icondir ] ; then
         gtk-update-icon-cache -qt  $icondir
Signature · 7 lines
1.7.10.4


_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core
Signature · 1 line
Martin 'JaMa' Jansa     jabber: [email protected]
author
#6 lore raw

PATCH 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
#7 lore raw

PATCH 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 |   11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
meta/recipes-connectivity/libnss-mdns/libnss-mdns_0.10.bb +9 -2
index f7356e4..e9a4128 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"
 
@@ -30,7 +30,14 @@ pkg_postinst_${PN} () {
 }
 
 pkg_prerm_${PN} () {
+if [ "$D" != "" ]; then
 	sed -e '/^hosts:/s/\s*\<mdns4\>//' \
 		-e '/^hosts:/s/\s*mdns4_minimal\s\+\[NOTFOUND=return\]//' \
-		-i /etc/nsswitch.conf
+		-i $D/etc/nsswitch.conf
+	exit 0
+fi
+
+sed -e '/^hosts:/s/\s*\<mdns4\>//' \
+	-e '/^hosts:/s/\s*mdns4_minimal\s\+\[NOTFOUND=return\]//' \
+	-i /etc/nsswitch.conf
 }
Signature · 1 line
1.7.10.4
#8 lore raw

Re: [PATCH 3/4] libnss-mdns:fix support prerm at image creation time

Quoted 2 lines · Hongxu Jia

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

Again looks the same why not use $D/etc/nsswitch.conf in both cases?

Quoted 45 lines

[YOCTO #3633]

---
 meta/recipes-connectivity/libnss-mdns/libnss-mdns_0.10.bb |   11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
meta/recipes-connectivity/libnss-mdns/libnss-mdns_0.10.bb +9 -2
index f7356e4..e9a4128 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"
 
@@ -30,7 +30,14 @@ pkg_postinst_${PN} () {
 }
 
 pkg_prerm_${PN} () {
+if [ "$D" != "" ]; then
 	sed -e '/^hosts:/s/\s*\<mdns4\>//' \
 		-e '/^hosts:/s/\s*mdns4_minimal\s\+\[NOTFOUND=return\]//' \
-		-i /etc/nsswitch.conf
+		-i $D/etc/nsswitch.conf
+	exit 0
+fi
+
+sed -e '/^hosts:/s/\s*\<mdns4\>//' \
+	-e '/^hosts:/s/\s*mdns4_minimal\s\+\[NOTFOUND=return\]//' \
+	-i /etc/nsswitch.conf
 }
Signature · 7 lines
1.7.10.4


_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core
Signature · 1 line
Martin 'JaMa' Jansa     jabber: [email protected]
author
#9 lore raw

Re: [PATCH 3/4] libnss-mdns:fix support prerm at image creation time

Quoted 4 lines · Martin Jansa
Quoted 2 lines · Hongxu Jia

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

Again looks the same why not use $D/etc/nsswitch.conf in both cases?

I think that test $D to explicitly make a distinction between the build time and run time, it's better for others to notice the difference.

Thanks,
Hongxu

Quoted 44 lines
Quoted 44 lines

[YOCTO #3633]

---
  meta/recipes-connectivity/libnss-mdns/libnss-mdns_0.10.bb |   11 +++++++++--
  1 file changed, 9 insertions(+), 2 deletions(-)
meta/recipes-connectivity/libnss-mdns/libnss-mdns_0.10.bb +9 -2
index f7356e4..e9a4128 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"
 
@@ -30,7 +30,14 @@ pkg_postinst_${PN} () {
  }
 
  pkg_prerm_${PN} () {
+if [ "$D" != "" ]; then
  	sed -e '/^hosts:/s/\s*\<mdns4\>//' \
  		-e '/^hosts:/s/\s*mdns4_minimal\s\+\[NOTFOUND=return\]//' \
-		-i /etc/nsswitch.conf
+		-i $D/etc/nsswitch.conf
+	exit 0
+fi
+
+sed -e '/^hosts:/s/\s*\<mdns4\>//' \
+	-e '/^hosts:/s/\s*mdns4_minimal\s\+\[NOTFOUND=return\]//' \
+	-i /etc/nsswitch.conf
  }
Signature · 7 lines
1.7.10.4


_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core
#10 lore raw

Re: [PATCH 3/4] libnss-mdns:fix support prerm at image creation time

Quoted 8 lines · Hongxu Jia
Quoted 4 lines · Martin Jansa
Quoted 2 lines · Hongxu Jia

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

Again looks the same why not use $D/etc/nsswitch.conf in both cases?

I think that test $D to explicitly make a distinction between the build time
and run time, it's better for others to notice the difference.

But there isn't any difference if I'm looking correctly.

Cheers,

Quoted 47 lines

Thanks,
Hongxu

Quoted 44 lines
Quoted 44 lines

[YOCTO #3633]

---
  meta/recipes-connectivity/libnss-mdns/libnss-mdns_0.10.bb |   11 +++++++++--
  1 file changed, 9 insertions(+), 2 deletions(-)
meta/recipes-connectivity/libnss-mdns/libnss-mdns_0.10.bb +9 -2
index f7356e4..e9a4128 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"
 
@@ -30,7 +30,14 @@ pkg_postinst_${PN} () {
  }
 
  pkg_prerm_${PN} () {
+if [ "$D" != "" ]; then
  	sed -e '/^hosts:/s/\s*\<mdns4\>//' \
  		-e '/^hosts:/s/\s*mdns4_minimal\s\+\[NOTFOUND=return\]//' \
-		-i /etc/nsswitch.conf
+		-i $D/etc/nsswitch.conf
+	exit 0
+fi
+
+sed -e '/^hosts:/s/\s*\<mdns4\>//' \
+	-e '/^hosts:/s/\s*mdns4_minimal\s\+\[NOTFOUND=return\]//' \
+	-i /etc/nsswitch.conf
  }
Signature · 7 lines
1.7.10.4


_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core
Signature · 1 line
Martin 'JaMa' Jansa     jabber: [email protected]
author
#11 lore raw

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

In reply to Hongxu Jia

Let gtk_immodule_cache_postrm exit with ok at image creation time

[YOCTO #3633]

---
 meta/classes/gtk-immodules-cache.bbclass |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/classes/gtk-immodules-cache.bbclass +1 -1
index 9ffb03b..6e1f5ef 100644
@@ -31,7 +31,7 @@ fi
 
 gtk_immodule_cache_postrm() {
 if [ "x$D" != "x" ]; then
-    exit 1
+    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
#12 lore raw

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

Quoted 14 lines · Hongxu Jia

Let gtk_immodule_cache_postrm exit with ok at image creation time

[YOCTO #3633]

---
 meta/classes/gtk-immodules-cache.bbclass |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/classes/gtk-immodules-cache.bbclass +0 -0
index 9ffb03b..6e1f5ef 100644

meta/classes/gtk-immodules-cache.bbclass fi · line 37

Quoted 8 lines
meta/classes/gtk-immodules-cache.bbclass +1 -1
@@ -31,7 +31,7 @@ fi
 
 gtk_immodule_cache_postrm() {
 if [ "x$D" != "x" ]; then
-    exit 1
+    exit 0
 fi
 if [ ! -z `which gtk-query-immodules-2.0` ]; then
     gtk-query-immodules-2.0 > /etc/gtk-2.0/gtk.immodules

Surely you still want to run the postrm, and by exiting with 0 you're not deferring it. Can't this use the same logic as the postinst to run on both build machine and target?

Ross

author
#13 lore raw

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

Quoted 27 lines · Ross
Quoted 14 lines · Hongxu Jia

Let gtk_immodule_cache_postrm exit with ok at image creation time

[YOCTO #3633]

---
  meta/classes/gtk-immodules-cache.bbclass |    2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
meta/classes/gtk-immodules-cache.bbclass +0 -0
index 9ffb03b..6e1f5ef 100644

meta/classes/gtk-immodules-cache.bbclass fi · line 37

Quoted 8 lines
meta/classes/gtk-immodules-cache.bbclass +1 -1
@@ -31,7 +31,7 @@ fi
 
  gtk_immodule_cache_postrm() {
  if [ "x$D" != "x" ]; then
-    exit 1
+    exit 0
  fi
  if [ ! -z `which gtk-query-immodules-2.0` ]; then
      gtk-query-immodules-2.0 > /etc/gtk-2.0/gtk.immodules

Surely you still want to run the postrm, and by exiting with 0 you're not deferring it. Can't this use the same logic as the postinst to run on both build machine and target?

Quoted 1 line

Ross

No problem, I will use the same logic as the postinst to do that.

Thanks,
Hongxu