summaryrefslogtreecommitdiffstats
path: root/meta/classes-recipe/pixbufcache.bbclass
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2022-08-10 14:35:29 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-08-12 15:27:17 +0100
commitfd1517e2b51a170f2427122c6b95396db251d827 (patch)
treedabfe3e631339c2fc99a9ee7febb0f9c128e325e /meta/classes-recipe/pixbufcache.bbclass
parent10317912ee319ccf7f83605d438b5cbf9663f296 (diff)
downloadpoky-fd1517e2b51a170f2427122c6b95396db251d827.tar.gz
classes: Update classes to match new bitbake class scope functionality
Move classes to classes-global or classes-recipe as appropriate to take advantage of new bitbake functionality to check class scope/usage. (From OE-Core rev: f5c128008365e141082c129417eb72d2751e8045) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes-recipe/pixbufcache.bbclass')
-rw-r--r--meta/classes-recipe/pixbufcache.bbclass69
1 files changed, 69 insertions, 0 deletions
diff --git a/meta/classes-recipe/pixbufcache.bbclass b/meta/classes-recipe/pixbufcache.bbclass
new file mode 100644
index 0000000000..107e38885e
--- /dev/null
+++ b/meta/classes-recipe/pixbufcache.bbclass
@@ -0,0 +1,69 @@
1#
2# Copyright OpenEmbedded Contributors
3#
4# SPDX-License-Identifier: MIT
5#
6
7#
8# This class will generate the proper postinst/postrm scriptlets for pixbuf
9# packages.
10#
11
12DEPENDS:append:class-target = " qemu-native"
13inherit qemu
14
15PIXBUF_PACKAGES ??= "${PN}"
16
17PACKAGE_WRITE_DEPS += "qemu-native gdk-pixbuf-native"
18
19pixbufcache_common() {
20if [ "x$D" != "x" ]; then
21 $INTERCEPT_DIR/postinst_intercept update_pixbuf_cache ${PKG} mlprefix=${MLPREFIX} binprefix=${MLPREFIX} libdir=${libdir} \
22 bindir=${bindir} base_libdir=${base_libdir}
23else
24
25 # Update the pixbuf loaders in case they haven't been registered yet
26 ${libdir}/gdk-pixbuf-2.0/gdk-pixbuf-query-loaders --update-cache
27
28 if [ -x ${bindir}/gtk-update-icon-cache ] && [ -d ${datadir}/icons ]; then
29 for icondir in /usr/share/icons/*; do
30 if [ -d ${icondir} ]; then
31 gtk-update-icon-cache -t -q ${icondir}
32 fi
33 done
34 fi
35fi
36}
37
38python populate_packages:append() {
39 pixbuf_pkgs = d.getVar('PIXBUF_PACKAGES').split()
40
41 for pkg in pixbuf_pkgs:
42 bb.note("adding pixbuf postinst and postrm scripts to %s" % pkg)
43 postinst = d.getVar('pkg_postinst:%s' % pkg) or d.getVar('pkg_postinst')
44 if not postinst:
45 postinst = '#!/bin/sh\n'
46 postinst += d.getVar('pixbufcache_common')
47 d.setVar('pkg_postinst:%s' % pkg, postinst)
48
49 postrm = d.getVar('pkg_postrm:%s' % pkg) or d.getVar('pkg_postrm')
50 if not postrm:
51 postrm = '#!/bin/sh\n'
52 postrm += d.getVar('pixbufcache_common')
53 d.setVar('pkg_postrm:%s' % pkg, postrm)
54}
55
56gdkpixbuf_complete() {
57GDK_PIXBUF_FATAL_LOADER=1 ${STAGING_LIBDIR_NATIVE}/gdk-pixbuf-2.0/gdk-pixbuf-query-loaders --update-cache || exit 1
58}
59
60DEPENDS:append:class-native = " gdk-pixbuf-native"
61SYSROOT_PREPROCESS_FUNCS:append:class-native = " pixbufcache_sstate_postinst"
62
63pixbufcache_sstate_postinst() {
64 mkdir -p ${SYSROOT_DESTDIR}${bindir}
65 dest=${SYSROOT_DESTDIR}${bindir}/postinst-${PN}
66 echo '#!/bin/sh' > $dest
67 echo "${gdkpixbuf_complete}" >> $dest
68 chmod 0755 $dest
69}