diff options
| -rw-r--r-- | meta/classes/pixbufcache.bbclass | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/meta/classes/pixbufcache.bbclass b/meta/classes/pixbufcache.bbclass new file mode 100644 index 0000000000..fc749dee50 --- /dev/null +++ b/meta/classes/pixbufcache.bbclass | |||
| @@ -0,0 +1,50 @@ | |||
| 1 | # | ||
| 2 | # This class will generate the proper postinst/postrm scriptlets for pixbuf | ||
| 3 | # packages. | ||
| 4 | # | ||
| 5 | |||
| 6 | DEPENDS += "qemu-native" | ||
| 7 | inherit qemu | ||
| 8 | |||
| 9 | PIXBUF_PACKAGES ??= "${PN}" | ||
| 10 | |||
| 11 | # | ||
| 12 | # On host, the postinstall MUST return 1 because we do not know if the intercept | ||
| 13 | # hook will succeed. If it does succeed, than the packages will be marked as | ||
| 14 | # installed. | ||
| 15 | # | ||
| 16 | pixbufcache_common() { | ||
| 17 | if [ "x$D" != "x" ]; then | ||
| 18 | $INTERCEPT_DIR/postinst_intercept update_pixbuf_cache ${PKG} libdir=${libdir} bindir=${bindir} | ||
| 19 | exit 1 | ||
| 20 | fi | ||
| 21 | |||
| 22 | # Update the pixbuf loaders in case they haven't been registered yet | ||
| 23 | GDK_PIXBUF_MODULEDIR=${libdir}/gdk-pixbuf-2.0/2.10.0/loaders gdk-pixbuf-query-loaders --update-cache | ||
| 24 | |||
| 25 | if [ -x ${bindir}/gtk-update-icon-cache ] && [ -d ${datadir}/icons ]; then | ||
| 26 | for icondir in /usr/share/icons/*; do | ||
| 27 | if [ -d ${icondir} ]; then | ||
| 28 | gtk-update-icon-cache -t -q ${icondir} | ||
| 29 | fi | ||
| 30 | done | ||
| 31 | fi | ||
| 32 | } | ||
| 33 | |||
| 34 | python populate_packages_append() { | ||
| 35 | pixbuf_pkgs = d.getVar('PIXBUF_PACKAGES', True).split() | ||
| 36 | |||
| 37 | for pkg in pixbuf_pkgs: | ||
| 38 | bb.note("adding pixbuf postinst and postrm scripts to %s" % pkg) | ||
| 39 | postinst = d.getVar('pkg_postinst_%s' % pkg, True) or d.getVar('pkg_postinst', True) | ||
| 40 | if not postinst: | ||
| 41 | postinst = '#!/bin/sh\n' | ||
| 42 | postinst += d.getVar('pixbufcache_common', True) | ||
| 43 | d.setVar('pkg_postinst_%s' % pkg, postinst) | ||
| 44 | |||
| 45 | postrm = d.getVar('pkg_postrm_%s' % pkg, True) or d.getVar('pkg_postrm', True) | ||
| 46 | if not postrm: | ||
| 47 | postrm = '#!/bin/sh\n' | ||
| 48 | postrm += d.getVar('pixbufcache_common', True) | ||
| 49 | d.setVar('pkg_postrm_%s' % pkg, postrm) | ||
| 50 | } | ||
