blob: 349967d74ba078da7c67c4cc56087267eeaf4fce [file] [log] [blame]
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001#
2# This class will generate the proper postinst/postrm scriptlets for pixbuf
3# packages.
4#
5
6DEPENDS += "qemu-native"
7inherit qemu
8
9PIXBUF_PACKAGES ??= "${PN}"
10
11pixbufcache_common() {
12if [ "x$D" != "x" ]; then
13 $INTERCEPT_DIR/postinst_intercept update_pixbuf_cache ${PKG} mlprefix=${MLPREFIX} libdir=${libdir} \
14 bindir=${bindir} base_libdir=${base_libdir}
15else
16
17 # Update the pixbuf loaders in case they haven't been registered yet
18 GDK_PIXBUF_MODULEDIR=${libdir}/gdk-pixbuf-2.0/2.10.0/loaders gdk-pixbuf-query-loaders --update-cache
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
27fi
28}
29
30python 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
48gdkpixbuf_complete() {
49 GDK_PIXBUF_FATAL_LOADER=1 ${STAGING_BINDIR_NATIVE}/gdk-pixbuf-query-loaders --update-cache || exit 1
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#
57SSTATEPOSTINSTFUNCS_append_class-native = " pixbufcache_sstate_postinst"
58
59# See base.bbclass for the other half of this
60pixbufcache_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