| 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 |  | 
| Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 11 | PACKAGE_WRITE_DEPS += "qemu-native gdk-pixbuf-native" | 
|  | 12 |  | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 13 | pixbufcache_common() { | 
|  | 14 | if [ "x$D" != "x" ]; then | 
|  | 15 | $INTERCEPT_DIR/postinst_intercept update_pixbuf_cache ${PKG} mlprefix=${MLPREFIX} libdir=${libdir} \ | 
|  | 16 | bindir=${bindir} base_libdir=${base_libdir} | 
|  | 17 | else | 
|  | 18 |  | 
|  | 19 | # Update the pixbuf loaders in case they haven't been registered yet | 
| Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame] | 20 | ${libdir}/gdk-pixbuf-2.0/gdk-pixbuf-query-loaders --update-cache | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 21 |  | 
|  | 22 | if [ -x ${bindir}/gtk-update-icon-cache ] && [ -d ${datadir}/icons ]; then | 
|  | 23 | for icondir in /usr/share/icons/*; do | 
|  | 24 | if [ -d ${icondir} ]; then | 
|  | 25 | gtk-update-icon-cache -t -q ${icondir} | 
|  | 26 | fi | 
|  | 27 | done | 
|  | 28 | fi | 
|  | 29 | fi | 
|  | 30 | } | 
|  | 31 |  | 
|  | 32 | python populate_packages_append() { | 
| Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 33 | pixbuf_pkgs = d.getVar('PIXBUF_PACKAGES').split() | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 34 |  | 
|  | 35 | for pkg in pixbuf_pkgs: | 
|  | 36 | bb.note("adding pixbuf postinst and postrm scripts to %s" % pkg) | 
| Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 37 | postinst = d.getVar('pkg_postinst_%s' % pkg) or d.getVar('pkg_postinst') | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 38 | if not postinst: | 
|  | 39 | postinst = '#!/bin/sh\n' | 
| Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 40 | postinst += d.getVar('pixbufcache_common') | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 41 | d.setVar('pkg_postinst_%s' % pkg, postinst) | 
|  | 42 |  | 
| Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 43 | postrm = d.getVar('pkg_postrm_%s' % pkg) or d.getVar('pkg_postrm') | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 44 | if not postrm: | 
|  | 45 | postrm = '#!/bin/sh\n' | 
| Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 46 | postrm += d.getVar('pixbufcache_common') | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 47 | d.setVar('pkg_postrm_%s' % pkg, postrm) | 
|  | 48 | } | 
|  | 49 |  | 
|  | 50 | gdkpixbuf_complete() { | 
| Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 51 | 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] | 52 | } | 
|  | 53 |  | 
| Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 54 | DEPENDS_append_class-native = " gdk-pixbuf-native" | 
| Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 55 | SYSROOT_PREPROCESS_FUNCS_append_class-native = " pixbufcache_sstate_postinst" | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 56 |  | 
|  | 57 | # See base.bbclass for the other half of this | 
|  | 58 | pixbufcache_sstate_postinst() { | 
| Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 59 | mkdir -p ${SYSROOT_DESTDIR}${bindir} | 
|  | 60 | dest=${SYSROOT_DESTDIR}${bindir}/postinst-${PN} | 
|  | 61 | echo '#!/bin/sh' > $dest | 
|  | 62 | echo "${gdkpixbuf_complete}" >> $dest | 
|  | 63 | chmod 0755 $dest | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 64 | } |