blob: 3f48a0f34466703e7189e7300a6c432b918e8da5 [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
Patrick Williamsf1e5d692016-03-30 15:21:19 -050018 ${libdir}/gdk-pixbuf-2.0/gdk-pixbuf-query-loaders --update-cache
Patrick Williamsc124f4f2015-09-15 14:41:29 -050019
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() {
Patrick Williamsf1e5d692016-03-30 15:21:19 -050049 GDK_PIXBUF_FATAL_LOADER=1 ${STAGING_LIBDIR_NATIVE}/gdk-pixbuf-2.0/gdk-pixbuf-query-loaders --update-cache || exit 1
Patrick Williamsc124f4f2015-09-15 14:41:29 -050050}
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#
Patrick Williamsc0f7c042017-02-23 20:41:17 -060057DEPENDS_append_class-native = " gdk-pixbuf-native"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050058SSTATEPOSTINSTFUNCS_append_class-native = " pixbufcache_sstate_postinst"
59
60# See base.bbclass for the other half of this
61pixbufcache_sstate_postinst() {
62 if [ "${BB_CURRENTTASK}" = "populate_sysroot" ]; then
63 ${gdkpixbuf_complete}
64 elif [ "${BB_CURRENTTASK}" = "populate_sysroot_setscene" ]; then
Patrick Williamsc0f7c042017-02-23 20:41:17 -060065 if [ -x ${STAGING_LIBDIR_NATIVE}/gdk-pixbuf-2.0/gdk-pixbuf-query-loaders ]; then
66 echo "${gdkpixbuf_complete}" >> ${STAGING_DIR}/sstatecompletions
67 fi
Patrick Williamsc124f4f2015-09-15 14:41:29 -050068 fi
69}