summaryrefslogtreecommitdiffstats
path: root/meta/classes/fontcache.bbclass
diff options
context:
space:
mode:
authorLaurentiu Palcu <laurentiu.palcu@intel.com>2013-01-31 09:59:10 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2013-02-06 09:37:23 +0000
commitc31bf6514bdda951b315f16aa640f9d46232c060 (patch)
tree525a9b55e64df44d5e0e4bb47d493b318a09bd20 /meta/classes/fontcache.bbclass
parent8f262e8b7e867eeb0ed71dab637181a2ce0e1627 (diff)
downloadpoky-c31bf6514bdda951b315f16aa640f9d46232c060.tar.gz
add fontcache.bbclass
All font packages should inherit this class in order to generate the proper postinst/postrm scriptlets. The scriptlets will actually create a host intercept hook that will be executed at the end, at do_rootfs time, after all packages have been installed. This is good when there are many font packages. [YOCTO #2923] (From OE-Core rev: 0c12f7fb3c2c42e5b633682bb1277b943ac19ea6) Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com> Signed-off-by: Saul Wold <sgw@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/fontcache.bbclass')
-rw-r--r--meta/classes/fontcache.bbclass47
1 files changed, 47 insertions, 0 deletions
diff --git a/meta/classes/fontcache.bbclass b/meta/classes/fontcache.bbclass
new file mode 100644
index 0000000000..83817356c3
--- /dev/null
+++ b/meta/classes/fontcache.bbclass
@@ -0,0 +1,47 @@
1#
2# This class will generate the proper postinst/postrm scriptlets for font
3# packages.
4#
5
6DEPENDS += "qemu-native"
7inherit qemu
8
9FONT_PACKAGES ??= "${PN}"
10
11fontcache_common() {
12if [ "x$D" != "x" ] ; then
13 if [ ! -f $INTERCEPT_DIR/update_font_cache ]; then
14 cat << "EOF" > $INTERCEPT_DIR/update_font_cache
15#!/bin/sh
16
17${@qemu_run_binary(d, '$D', '/usr/bin/fc-cache')} --sysroot=$D >/dev/null 2>&1
18
19if [ $? -ne 0 ]; then
20 exit 1
21fi
22
23EOF
24 fi
25 exit 0
26fi
27
28fc-cache
29}
30
31python populate_packages_append() {
32 font_pkgs = d.getVar('FONT_PACKAGES', True).split()
33
34 for pkg in font_pkgs:
35 bb.note("adding fonts postinst and postrm scripts to %s" % pkg)
36 postinst = d.getVar('pkg_postinst_%s' % pkg, True) or d.getVar('pkg_postinst', True)
37 if not postinst:
38 postinst = '#!/bin/sh\n'
39 postinst += d.getVar('fontcache_common', True)
40 d.setVar('pkg_postinst_%s' % pkg, postinst)
41
42 postrm = d.getVar('pkg_postrm_%s' % pkg, True) or d.getVar('pkg_postrm', True)
43 if not postrm:
44 postrm = '#!/bin/sh\n'
45 postrm += d.getVar('fontcache_common', True)
46 d.setVar('pkg_postrm_%s' % pkg, postrm)
47}