1# A bbclass to handle installed GSettings (glib) schemas, updated the compiled 2# form on package install and remove. 3# 4# The compiled schemas are platform-agnostic, so we can depend on 5# glib-2.0-native for the native tool and run the postinst script when the 6# rootfs builds to save a little time on first boot. 7 8# TODO use a trigger so that this runs once per package operation run 9 10GSETTINGS_PACKAGE ?= "${PN}" 11 12python __anonymous() { 13 pkg = d.getVar("GSETTINGS_PACKAGE") 14 if pkg: 15 d.appendVar("PACKAGE_WRITE_DEPS", " glib-2.0-native") 16 d.appendVar("RDEPENDS:" + pkg, " ${MLPREFIX}glib-2.0-utils") 17 d.appendVar("FILES:" + pkg, " ${datadir}/glib-2.0/schemas") 18} 19 20gsettings_postinstrm () { 21 glib-compile-schemas $D${datadir}/glib-2.0/schemas 22} 23 24python populate_packages:append () { 25 pkg = d.getVar('GSETTINGS_PACKAGE') 26 if pkg: 27 bb.note("adding gsettings postinst scripts to %s" % pkg) 28 29 postinst = d.getVar('pkg_postinst:%s' % pkg) or d.getVar('pkg_postinst') 30 if not postinst: 31 postinst = '#!/bin/sh\n' 32 postinst += d.getVar('gsettings_postinstrm') 33 d.setVar('pkg_postinst:%s' % pkg, postinst) 34 35 bb.note("adding gsettings postrm scripts to %s" % pkg) 36 37 postrm = d.getVar('pkg_postrm:%s' % pkg) or d.getVar('pkg_postrm') 38 if not postrm: 39 postrm = '#!/bin/sh\n' 40 postrm += d.getVar('gsettings_postinstrm') 41 d.setVar('pkg_postrm:%s' % pkg, postrm) 42} 43