Skip to contentSkip to conversation

Yet another patchset with postinstall fixes

PATCH In review Laurentiu Palcu 2 participants 9 messages Feb 6, 2013 – Feb 8, 2013

lore
Share & tools
lore
#0 lore raw

cover Yet another patchset with postinstall fixes

Hi all,

This patchset contains postinstall fixes for:
* gtk+ immodules packages
* librsvg
* gnome-keyring

Thanks,
Laurentiu

The following changes since commit 2180cc32b9a6d434c319292c1a636fb8e4d23899:

initiscripts: Fix populate-volatiles.sh whitespace (2013-02-06 14:44:49 +0000)

are available in the git repository at:

git://git.yoctoproject.org/poky-contrib lpalcu/postinst_fixes
http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=lpalcu/postinst_fixes

Laurentiu Palcu (6):
Add pixbufcache class
gdk-pixbuf: use the new pixbufcache class
librsvg: use the new pixbufcache class
gtk-immodules-cache: add weak asignment for GTKIMMODULES_PACKAGES gtk+: use gtk-immodules-cache class
gnome-keyring: compile schemas on host

 meta/classes/gtk-immodules-cache.bbclass           |    2 +
 meta/classes/pixbufcache.bbclass                   |   57 ++++++++++++++++++++
 meta/recipes-gnome/gdk-pixbuf/gdk-pixbuf_2.26.5.bb |   48 ++---------------
 meta/recipes-gnome/gnome/gnome-keyring_2.32.1.bb   |   12 +----
 meta/recipes-gnome/gtk+/gtk+.inc                   |    8 +--
 meta/recipes-gnome/gtk+/gtk+3_3.4.4.bb             |   12 +----
 meta/recipes-gnome/gtk+/gtk+_2.24.14.bb            |    4 +-
 meta/recipes-gnome/librsvg/librsvg_2.32.1.bb       |   21 ++------
 8 files changed, 72 insertions(+), 92 deletions(-)
 create mode 100644 meta/classes/pixbufcache.bbclass
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH 1/6 Add pixbufcache class

All packages exporting pixbuf loaders should inherit this class in order to generate the correct postinst/postrm scriptlets.

[YOCTO #3852]

---
 meta/classes/pixbufcache.bbclass |   57 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 57 insertions(+)
 create mode 100644 meta/classes/pixbufcache.bbclass
meta/classes/pixbufcache.bbclass new file +57 -0
new file mode 100644
index 0000000..575f8c2
@@ -0,0 +1,57 @@
+#
+# This class will generate the proper postinst/postrm scriptlets for pixbuf
+# packages.
+#
+
+DEPENDS += "qemu-native"
+inherit qemu
+
+PIXBUF_PACKAGES ??= "${PN}"
+
+pixbufcache_common() {
+
+if [ "x$D" != "x" ]; then
+	if [ ! -f $INTERCEPT_DIR/update_pixbuf_cache ]; then
+		cat << "EOF" >$INTERCEPT_DIR/update_pixbuf_cache
+#!/bin/sh
+
+export GDK_PIXBUF_MODULEDIR=$D${libdir}/gdk-pixbuf-2.0/2.10.0/loaders
+
+${@qemu_run_binary(d, '$D', '/usr/bin/gdk-pixbuf-query-loaders')} \
+	>$GDK_PIXBUF_MODULEDIR/../loaders.cache 2>/dev/null
+
+sed -i -e "s:$D::g" $GDK_PIXBUF_MODULEDIR/../loaders.cache
+EOF
+	fi
+	exit 0
+fi
+
+# Update the pixbuf loaders in case they haven't been registered yet
+GDK_PIXBUF_MODULEDIR=${libdir}/gdk-pixbuf-2.0/2.10.0/loaders gdk-pixbuf-query-loaders --update-cache
+
+if [ -x ${bindir}/gtk-update-icon-cache ] && [ -d ${datadir}/icons ]; then
+    for icondir in /usr/share/icons/*; do
+        if [ -d ${icondir} ]; then
+            gtk-update-icon-cache -t -q ${icondir}
+        fi
+    done
+fi
+}
+
+python populate_packages_append() {
+    pixbuf_pkgs = d.getVar('PIXBUF_PACKAGES', True).split()
+
+    for pkg in pixbuf_pkgs:
+        bb.note("adding pixbuf postinst and postrm scripts to %s" % pkg)
+        postinst = d.getVar('pkg_postinst_%s' % pkg, True) or d.getVar('pkg_postinst', True)
+        if not postinst:
+            postinst = '#!/bin/sh\n'
+        postinst += d.getVar('pixbufcache_common', True)
+        d.setVar('pkg_postinst_%s' % pkg, postinst)
+
+        postrm = d.getVar('pkg_postrm_%s' % pkg, True) or d.getVar('pkg_postrm', True)
+        if not postrm:
+            postrm = '#!/bin/sh\n'
+        postrm += d.getVar('pixbufcache_common', True)
+        d.setVar('pkg_postrm_%s' % pkg, postrm)
+}
Signature · 1 line
1.7.9.5
#2 lore raw

Re: [PATCH 1/6] Add pixbufcache class

Quoted 4 lines · Laurentiu Palcu

All packages exporting pixbuf loaders should inherit this class in order to generate the correct postinst/postrm scriptlets.

[YOCTO #3852]

Presumably this means that the gtk-icon-cache package can drop the pixbuf loader calls now? Also as the gtk icon cache only handles built-in modules, we don't need to update the icon cache when registering pixbuf loaders.

Ross

#3 lore raw

Re: [PATCH 1/6] Add pixbufcache class

Quoted 10 lines · Ross
Quoted 4 lines · Laurentiu Palcu

All packages exporting pixbuf loaders should inherit this class in order to generate the correct postinst/postrm scriptlets.

[YOCTO #3852]

Presumably this means that the gtk-icon-cache package can drop the pixbuf loader calls now? Also as the gtk icon cache only handles built-in modules, we don't need to update the icon cache when registering pixbuf loaders.

This patchset addresses the postinstall issues only, that is: make them run on host at do_rootfs. As much as possible, the previous functionality was left intact. We could do the changes you suggest in subsequent patches. And that's because, in case of any failures, it would be easier to know where the problem came from.

Laurentiu

Quoted 3 lines

Ross

#4 lore raw

PATCH 2/6 gdk-pixbuf: use the new pixbufcache class

In reply to Laurentiu Palcu

[YOCTO #3582]

---
 meta/recipes-gnome/gdk-pixbuf/gdk-pixbuf_2.26.5.bb |   48 ++------------------
 1 file changed, 3 insertions(+), 45 deletions(-)
meta/recipes-gnome/gdk-pixbuf/gdk-pixbuf_2.26.5.bb +3 -45
index 64f1450..cc2ea50 100644
@@ -20,9 +20,9 @@ SRC_URI = "http://ftp.acc.umu.se/pub/GNOME/sources/gdk-pixbuf/2.26/gdk-pixbuf-${
 SRC_URI[md5sum] = "339329e6d619ee3e1cb93979111b04c0"
 SRC_URI[sha256sum] = "77696fd163bca95a130a1883dbd78d0ae4d782de2fc85a9a38556d13681f5c84"
 
-PR = "r0"
+PR = "r1"
 
-inherit autotools pkgconfig gettext
+inherit autotools pkgconfig gettext pixbufcache
 
 LIBV = "2.10.0"
 
@@ -56,48 +56,6 @@ FILES_${PN}-dbg += " \
 	${libdir}/gdk-pixbuf-2.0/${LIBV}/loaders/.debug/* \
 "
 
-postinst_pixbufloader () {
-if [ "x$D" != "x" ]; then
-# Update the target's pixbuf loader's cache. Since the native binary will
-# throw an error if the shared objects do not belong to the same ELF class,
-# we trick the gdk-pixbuf-query-loaders into scanning the native shared
-# objects and then we remove the NATIVE_ROOT prefix from the paths in
-# loaders.cache.
-gdk-pixbuf-query-loaders $(ls -d -1 $D/${libdir}/gdk-pixbuf-2.0/${LIBV}/loaders/*.so |\
-        sed -e "s:$D:$NATIVE_ROOT:g") > \
-        $D/${libdir}/gdk-pixbuf-2.0/${LIBV}/loaders.cache \
-        2>$D/${libdir}/gdk-pixbuf-2.0/${LIBV}/loaders.err
-
-# gdk-pixbuf-query-loaders always returns 0, so we need to check if loaders.err
-# has anything in it
-if [ -s $D/${libdir}/gdk-pixbuf-2.0/${LIBV}/loaders.err ]; then
-	echo "${PN} postinstall scriptlet failed:"
-	cat $D/${libdir}/gdk-pixbuf-2.0/${LIBV}/loaders.err
-	rm $D/${libdir}/gdk-pixbuf-2.0/${LIBV}/loaders.err
-	# we've got errors, postpone postinstall for first boot
-	exit 1
-fi
-
-sed -i -e "s:$NATIVE_ROOT:/:g" $D/${libdir}/gdk-pixbuf-2.0/${LIBV}/loaders.cache
-
-# remove the empty loaders.err
-rm $D/${libdir}/gdk-pixbuf-2.0/${LIBV}/loaders.err
-
-exit 0
-fi
-
-# Update the pixbuf loaders in case they haven't been registered yet
-GDK_PIXBUF_MODULEDIR=${libdir}/gdk-pixbuf-2.0/${LIBV}/loaders gdk-pixbuf-query-loaders --update-cache
-
-if [ -x ${bindir}/gtk-update-icon-cache ] && [ -d ${datadir}/icons ]; then
-    for icondir in /usr/share/icons/*; do
-        if [ -d ${icondir} ]; then
-            gtk-update-icon-cache -t -q ${icondir}
-        fi
-    done
-fi
-}
-
 PACKAGES_DYNAMIC += "^gdk-pixbuf-loader-.*"
 PACKAGES_DYNAMIC_class-native = ""
 
@@ -106,7 +64,7 @@ python populate_packages_prepend () {
 
     loaders_root = d.expand('${libdir}/gdk-pixbuf-2.0/${LIBV}/loaders')
 
-    do_split_packages(d, loaders_root, '^libpixbufloader-(.*)\.so$', 'gdk-pixbuf-loader-%s', 'GDK pixbuf loader for %s', postinst_pixbufloader)
+    d.setVar('PIXBUF_PACKAGES', ' '.join(do_split_packages(d, loaders_root, '^libpixbufloader-(.*)\.so$', 'gdk-pixbuf-loader-%s', 'GDK pixbuf loader for %s')))
 }
 
 do_install_append_class-native() {
Signature · 1 line
1.7.9.5
#5 lore raw

PATCH 3/6 librsvg: use the new pixbufcache class

In reply to Laurentiu Palcu

Also, fix the GDK_PIXBUF_QUERYLOADERS path.

[YOCTO #3582]

---
 meta/recipes-gnome/librsvg/librsvg_2.32.1.bb |   21 ++++-----------------
 1 file changed, 4 insertions(+), 17 deletions(-)
meta/recipes-gnome/librsvg/librsvg_2.32.1.bb +4 -17
index 3621045..ff17cf7 100644
@@ -11,9 +11,9 @@ DEPENDS = "gtk+ cairo libxml2"
 DEPENDS_class-native = "cairo-native pango-native gdk-pixbuf-native"
 BBCLASSEXTEND = "native"
 
-PR = "r11"
+PR = "r12"
 
-inherit autotools pkgconfig gnome gtk-doc
+inherit autotools pkgconfig gnome gtk-doc pixbufcache
 
 EXTRA_OECONF = "--disable-mozilla-plugin --without-svgz"
 
@@ -31,7 +31,7 @@ SRC_URI[archive.md5sum] = "4b00d0fee130c936644892c152f42db7"
 SRC_URI[archive.sha256sum] = "91b98051f352fab8a6257688d6b2fd665b4648ed66144861f2f853ccf876d334"
 
 do_configure_prepend () {
-	export GDK_PIXBUF_QUERYLOADERS="${libdir}/gtk-2.0/version/loaders"
+	export GDK_PIXBUF_QUERYLOADERS="${libdir}/gdk-pixbuf-2.0/2.10.0/loaders"
 }
 
 PACKAGES =+ "librsvg-gtk librsvg-gtk-dbg librsvg-gtk-dev rsvg"
@@ -53,18 +53,5 @@ FILES_librsvg-gtk-dbg += "${libdir}/gdk-pixbuf-2.0/.debug \
                           ${libdir}/gtk-2.0/.debug \
                           ${libdir}/gtk-2.0/*/*/.debug"
 
-pkg_postinst_librsvg-gtk() {
-if [ "x$D" != "x" ]; then
-  exit 1
-fi
-
-if [ -d ${libdir}/gtk-2.0/2.10.0/loaders ] ; then
-	export GDK_PIXBUF_MODULEDIR=${libdir}/gtk-2.0/2.10.0/loaders
-else
-	export GDK_PIXBUF_MODULEDIR=${libdir}/gdk-pixbuf-2.0/2.10.0/loaders
-fi
-
-test -x ${bindir}/gdk-pixbuf-query-loaders && gdk-pixbuf-query-loaders > ${sysconfdir}/gtk-2.0/gdk-pixbuf.loaders
-test -x ${bindir}/gtk-update-icon-cache && gtk-update-icon-cache  -q ${datadir}/icons/hicolor
-}
+PIXBUF_PACKAGES = "librsvg-gtk"
 PARALLEL_MAKE = ""
Signature · 1 line
1.7.9.5
#6 lore raw

PATCH 4/6 gtk-immodules-cache: add weak asignment for GTKIMMODULES_PACKAGES

In reply to Laurentiu Palcu

This is needed if the GTKIMMODULES_PACKAGES is changed later, in do_populate_packages for example. This way, we don't have to add another dumb asignment in the recipe inheriting this.

[YOCTO #3853]

---
 meta/classes/gtk-immodules-cache.bbclass |    2 ++
 1 file changed, 2 insertions(+)
meta/classes/gtk-immodules-cache.bbclass +2 -0
index a8855af..6a5bc19 100644
@@ -6,6 +6,8 @@ DEPENDS =+ "qemu-native"
 
 inherit qemu
 
+GTKIMMODULES_PACKAGES ?= "${PN}"
+
 gtk_immodule_cache_postinst() {
 if [ "x$D" != "x" ]; then
     for maj_ver in 2 3; do
Signature · 1 line
1.7.9.5
#7 lore raw

PATCH 5/6 gtk+: use gtk-immodules-cache class

In reply to Laurentiu Palcu

In order to have the proper postinst/postrm scriptlets generated for gtk+ immodules packages, use the already existing class.

[YOCTO #3853]

---
 meta/recipes-gnome/gtk+/gtk+.inc        |    8 +-------
 meta/recipes-gnome/gtk+/gtk+3_3.4.4.bb  |   12 ++----------
 meta/recipes-gnome/gtk+/gtk+_2.24.14.bb |    4 +---
 3 files changed, 4 insertions(+), 20 deletions(-)
meta/recipes-gnome/gtk+/gtk+.inc +1 -7
index d8adc11..8c2b977 100644
@@ -18,7 +18,7 @@ PACKAGECONFIG ??= "${@base_contains('DISTRO_FEATURES', 'x11', 'x11', '', d)}"
 
 PACKAGECONFIG[x11] = "--with-x=yes --with-gdktarget=x11,--with-x=no,${X11DEPENDS}"
 
-inherit autotools gtk-doc pkgconfig update-alternatives
+inherit autotools gtk-doc pkgconfig update-alternatives gtk-immodules-cache
 
 PACKAGES += "libgail gtk-demo"
 
@@ -94,9 +94,3 @@ gtk_sysroot_preprocess () {
 	fi
 }
 
-postinst_prologue() {
-if [ "x$D" != "x" ]; then
-  exit 1
-fi
-
-}
meta/recipes-gnome/gtk+/gtk+3_3.4.4.bb +2 -10
index e624387..e2a7ef7 100644
@@ -21,7 +21,7 @@ SRC_URI = "http://download.gnome.org/sources/gtk+/3.4/gtk+-${PV}.tar.xz \
 SRC_URI[md5sum] = "1b2cf29502a6394e8d4b30f7f5bb9131"
 SRC_URI[sha256sum] = "f154e460075034da4c0ce89c320025dcd459da2a1fdf32d92a09522eaca242c7"
 
-inherit autotools pkgconfig gtk-doc update-alternatives
+inherit autotools pkgconfig gtk-doc update-alternatives gtk-immodules-cache
 
 S = "${WORKDIR}/gtk+-${PV}"
 
@@ -90,22 +90,14 @@ ALTERNATIVE_TARGET[gtk-update-icon-cache] = "${bindir}/gtk-update-icon-cache-3.0
 python populate_packages_prepend () {
     import os.path
 
-    prologue = d.getVar("postinst_prologue", 1)
-
     gtk_libdir = d.expand('${libdir}/gtk-3.0/${LIBV}')
     immodules_root = os.path.join(gtk_libdir, 'immodules')
     printmodules_root = os.path.join(gtk_libdir, 'printbackends');
 
-    do_split_packages(d, immodules_root, '^im-(.*)\.so$', 'gtk3-immodule-%s', 'GTK input module for %s', prologue + 'gtk-query-immodules-3.0 > /etc/gtk-3.0/gtk.immodules')
+    d.setVar('GTKIMMODULES_PACKAGES', ' '.join(do_split_packages(d, immodules_root, '^im-(.*)\.so$', 'gtk3-immodule-%s', 'GTK input module for %s')))
     do_split_packages(d, printmodules_root, '^libprintbackend-(.*)\.so$', 'gtk3-printbackend-%s', 'GTK printbackend module for %s')
 
     if (d.getVar('DEBIAN_NAMES', 1)):
         d.setVar('PKG_${PN}', 'libgtk-3.0')
 }
 
-postinst_prologue() {
-if [ "x$D" != "x" ]; then
-  exit 1
-fi
-
-}
meta/recipes-gnome/gtk+/gtk+_2.24.14.bb +1 -3
index fab360d..1520720 100644
@@ -49,13 +49,11 @@ do_install_append_class-native () {
 }
 
 python populate_packages_prepend () {
-    prologue = d.getVar("postinst_prologue", True)
-
     gtk_libdir = d.expand('${libdir}/gtk-2.0/${LIBV}')
     immodules_root = os.path.join(gtk_libdir, 'immodules')
     printmodules_root = os.path.join(gtk_libdir, 'printbackends');
 
-    do_split_packages(d, immodules_root, '^im-(.*)\.so$', 'gtk-immodule-%s', 'GTK input module for %s', prologue + 'gtk-query-immodules-2.0 > /etc/gtk-2.0/gtk.immodules')
+    d.setVar('GTKIMMODULES_PACKAGES', ' '.join(do_split_packages(d, immodules_root, '^im-(.*)\.so$', 'gtk-immodule-%s', 'GTK input module for %s')))
     do_split_packages(d, printmodules_root, '^libprintbackend-(.*)\.so$', 'gtk-printbackend-%s', 'GTK printbackend module for %s')
 
     if (d.getVar('DEBIAN_NAMES', True)):
Signature · 1 line
1.7.9.5
#8 lore raw

PATCH 6/6 gnome-keyring: compile schemas on host

In reply to Laurentiu Palcu

gsettings.bbclass offers just that.

[YOCTO #3854]

---
 meta/recipes-gnome/gnome/gnome-keyring_2.32.1.bb |   12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)
meta/recipes-gnome/gnome/gnome-keyring_2.32.1.bb +2 -10
index 92e0e1b..a1cd8f9 100644
@@ -11,9 +11,9 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=94d55d512a9ba36caa9b7df079bae19f \
 
 SECTION = "x11/gnome"
 
-PR = "r10"
+PR = "r11"
 
-inherit autotools gnome gtk-doc pkgconfig
+inherit autotools gnome gtk-doc pkgconfig gsettings
 
 DEPENDS = "gtk+ libgcrypt libtasn1 libtasn1-native gconf ${@base_contains('DISTRO_FEATURES', 'pam', 'libpam', '', d)}"
 RDEPENDS_${PN} = "libgnome-keyring glib-2.0-utils"
@@ -30,14 +30,6 @@ do_install_append () {
 	install -m 0644 ${WORKDIR}/org.gnome.keyring.service ${D}${datadir}/dbus-1/services
 }
 
-pkg_postinst_${PN} () {
-	if [ "x$D" != "x" ]; then
-		exit 1
-	fi
-
-	test -x ${bindir}/glib-compile-schemas && glib-compile-schemas  ${datadir}/glib-2.0/schemas
-}
-
 FILES_${PN} += "${datadir}/dbus-1/services ${datadir}/gcr"
                 
 
Signature · 1 line
1.7.9.5