| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 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 | pixbufcache_common() { | 
|  | 12 | if [ "x$D" != "x" ]; then | 
|  | 13 | $INTERCEPT_DIR/postinst_intercept update_pixbuf_cache ${PKG} mlprefix=${MLPREFIX} libdir=${libdir} \ | 
|  | 14 | bindir=${bindir} base_libdir=${base_libdir} | 
|  | 15 | else | 
|  | 16 |  | 
|  | 17 | # Update the pixbuf loaders in case they haven't been registered yet | 
| Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame] | 18 | ${libdir}/gdk-pixbuf-2.0/gdk-pixbuf-query-loaders --update-cache | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 19 |  | 
|  | 20 | if [ -x ${bindir}/gtk-update-icon-cache ] && [ -d ${datadir}/icons ]; then | 
|  | 21 | for icondir in /usr/share/icons/*; do | 
|  | 22 | if [ -d ${icondir} ]; then | 
|  | 23 | gtk-update-icon-cache -t -q ${icondir} | 
|  | 24 | fi | 
|  | 25 | done | 
|  | 26 | fi | 
|  | 27 | fi | 
|  | 28 | } | 
|  | 29 |  | 
|  | 30 | python populate_packages_append() { | 
|  | 31 | pixbuf_pkgs = d.getVar('PIXBUF_PACKAGES', True).split() | 
|  | 32 |  | 
|  | 33 | for pkg in pixbuf_pkgs: | 
|  | 34 | bb.note("adding pixbuf postinst and postrm scripts to %s" % pkg) | 
|  | 35 | postinst = d.getVar('pkg_postinst_%s' % pkg, True) or d.getVar('pkg_postinst', True) | 
|  | 36 | if not postinst: | 
|  | 37 | postinst = '#!/bin/sh\n' | 
|  | 38 | postinst += d.getVar('pixbufcache_common', True) | 
|  | 39 | d.setVar('pkg_postinst_%s' % pkg, postinst) | 
|  | 40 |  | 
|  | 41 | postrm = d.getVar('pkg_postrm_%s' % pkg, True) or d.getVar('pkg_postrm', True) | 
|  | 42 | if not postrm: | 
|  | 43 | postrm = '#!/bin/sh\n' | 
|  | 44 | postrm += d.getVar('pixbufcache_common', True) | 
|  | 45 | d.setVar('pkg_postrm_%s' % pkg, postrm) | 
|  | 46 | } | 
|  | 47 |  | 
|  | 48 | gdkpixbuf_complete() { | 
| Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame] | 49 | GDK_PIXBUF_FATAL_LOADER=1 ${STAGING_LIBDIR_NATIVE}/gdk-pixbuf-2.0/gdk-pixbuf-query-loaders --update-cache || exit 1 | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 50 | } | 
|  | 51 |  | 
|  | 52 | # | 
|  | 53 | # Add an sstate postinst hook to update the cache for native packages. | 
|  | 54 | # An error exit during populate_sysroot_setscene allows bitbake to | 
|  | 55 | # try to recover by re-building the package. | 
|  | 56 | # | 
|  | 57 | SSTATEPOSTINSTFUNCS_append_class-native = " pixbufcache_sstate_postinst" | 
|  | 58 |  | 
|  | 59 | # See base.bbclass for the other half of this | 
|  | 60 | pixbufcache_sstate_postinst() { | 
|  | 61 | if [ "${BB_CURRENTTASK}" = "populate_sysroot" ]; then | 
|  | 62 | ${gdkpixbuf_complete} | 
|  | 63 | elif [ "${BB_CURRENTTASK}" = "populate_sysroot_setscene" ]; then | 
|  | 64 | echo "${gdkpixbuf_complete}" >> ${STAGING_DIR}/sstatecompletions | 
|  | 65 | fi | 
|  | 66 | } | 
|  | 67 |  |