From 61911b23099c2658186179504ded318c987b5276 Mon Sep 17 00:00:00 2001 From: Martin Jansa Date: Mon, 4 Feb 2013 18:05:04 +0100 Subject: ttf: introduce update-fonts bbclass and change all ttf recipes to use it * without this ttf.inc had to set RRECOMMENDS and postinst/postrm without PN suffix to cover all subpackages created in ttf recipes Signed-off-by: Martin Jansa --- meta-oe/classes/update-fonts.bbclass | 40 ++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 meta-oe/classes/update-fonts.bbclass (limited to 'meta-oe/classes') diff --git a/meta-oe/classes/update-fonts.bbclass b/meta-oe/classes/update-fonts.bbclass new file mode 100644 index 0000000000..db2e814a4f --- /dev/null +++ b/meta-oe/classes/update-fonts.bbclass @@ -0,0 +1,40 @@ + +update_fonts_postinst() { + if [ -z "$D" ]; then + update-fonts + fi +} + +# the same but keep it separate for now +update_fonts_postrm() { + if [ -z "$D" ]; then + update-fonts + fi +} + +python populate_packages_append () { + update_fonts_pkgs = d.getVar('UPDATE_FONTS_PACKAGES', True).split() + + for pkg in update_fonts_pkgs: + postinst = d.getVar('pkg_postinst_%s' % pkg, True) or d.getVar('pkg_postinst', True) + if not postinst: + postinst = '#!/bin/sh\n' + postinst += d.getVar('update_fonts_postinst', True) + d.setVar('pkg_postinst_%s' % pkg, postinst) + + postrm = d.getVar('pkg_postrm_%s' % pkg, True) or d.getVar('pkg_postrm', True) + if not postrm: + postrm = '#!/bin/sh\n' + postrm += d.getVar('update_fonts_postrm', True) + d.setVar('pkg_postrm_%s' % pkg, postrm) + + d.appendVar('RDEPENDS_%s' % pkg, ' font-update-common') +} + +python __anonymous() { + if not bb.data.inherits_class('native', d) and not bb.data.inherits_class('cross', d): + updatefonts_check = d.getVar('UPDATE_FONTS_PACKAGES') + if not updatefonts_check: + bb_filename = d.getVar('FILE') + raise bb.build.FuncFailed, "\n\n\nERROR: %s inherits update-fonts but doesn't set UPDATE_FONTS_PACKAGES" % bb_filename +} -- cgit v1.2.3-54-g00ecf