Patchwork [1/6] Add pixbufcache class

login
register
mail settings
Submitter Laurentiu Palcu
Date Feb. 6, 2013, 4:36 p.m.
Message ID <4ac0c041b62e5495bff97bd2d7dc5a4e31d7ce5f.1360166922.git.laurentiu.palcu@intel.com>
Download mbox | patch
Permalink /patch/44219/
State New
Headers show

Comments

Laurentiu Palcu - Feb. 6, 2013, 4:36 p.m.
All packages exporting pixbuf loaders should inherit this class in order
to generate the correct postinst/postrm scriptlets.

[YOCTO #3852]

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
---
 meta/classes/pixbufcache.bbclass |   57 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 57 insertions(+)
 create mode 100644 meta/classes/pixbufcache.bbclass
Ross Burton - Feb. 8, 2013, 10:31 a.m.
On 6 February 2013 16:36, Laurentiu Palcu <laurentiu.palcu@intel.com> wrote:
> 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
Laurentiu Palcu - Feb. 8, 2013, 11:43 a.m.
On 02/08/2013 12:31 PM, Burton, Ross wrote:
> On 6 February 2013 16:36, Laurentiu Palcu <laurentiu.palcu@intel.com> wrote:
>> 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

> 
> Ross
>

Patch

diff --git a/meta/classes/pixbufcache.bbclass b/meta/classes/pixbufcache.bbclass
new file mode 100644
index 0000000..575f8c2
--- /dev/null
+++ b/meta/classes/pixbufcache.bbclass
@@ -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)
+}