xref: /OK3568_Linux_fs/yocto/poky/meta/classes/gconf.bbclass (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1DEPENDS += "gconf"
2PACKAGE_WRITE_DEPS += "gconf-native"
3
4# These are for when gconftool is used natively and the prefix isn't necessarily
5# the sysroot.  TODO: replicate the postinst logic for -native packages going
6# into sysroot as they won't be running their own install-time schema
7# registration (disabled below) nor the postinst script (as they don't happen).
8export GCONF_SCHEMA_INSTALL_SOURCE = "xml:merged:${STAGING_DIR_NATIVE}${sysconfdir}/gconf/gconf.xml.defaults"
9export GCONF_BACKEND_DIR = "${STAGING_LIBDIR_NATIVE}/GConf/2"
10
11# Disable install-time schema registration as we're a packaging system so this
12# happens in the postinst script, not at install time.  Set both the configure
13# script option and the traditional envionment variable just to make sure.
14EXTRA_OECONF += "--disable-schemas-install"
15export GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL = "1"
16
17gconf_postinst() {
18if [ "x$D" != "x" ]; then
19	export GCONF_CONFIG_SOURCE="xml::$D${sysconfdir}/gconf/gconf.xml.defaults"
20else
21	export GCONF_CONFIG_SOURCE=`gconftool-2 --get-default-source`
22fi
23
24SCHEMA_LOCATION=$D/etc/gconf/schemas
25for SCHEMA in ${SCHEMA_FILES}; do
26	if [ -e $SCHEMA_LOCATION/$SCHEMA ]; then
27		HOME=$D/root gconftool-2 \
28			--makefile-install-rule $SCHEMA_LOCATION/$SCHEMA > /dev/null
29	fi
30done
31}
32
33gconf_prerm() {
34SCHEMA_LOCATION=/etc/gconf/schemas
35for SCHEMA in ${SCHEMA_FILES}; do
36	if [ -e $SCHEMA_LOCATION/$SCHEMA ]; then
37		HOME=/root GCONF_CONFIG_SOURCE=`gconftool-2 --get-default-source` \
38			gconftool-2 \
39			--makefile-uninstall-rule $SCHEMA_LOCATION/$SCHEMA > /dev/null
40	fi
41done
42}
43
44python populate_packages:append () {
45    import re
46    packages = d.getVar('PACKAGES').split()
47    pkgdest =  d.getVar('PKGDEST')
48
49    for pkg in packages:
50        schema_dir = '%s/%s/etc/gconf/schemas' % (pkgdest, pkg)
51        schemas = []
52        schema_re = re.compile(r".*\.schemas$")
53        if os.path.exists(schema_dir):
54            for f in os.listdir(schema_dir):
55                if schema_re.match(f):
56                    schemas.append(f)
57        if schemas != []:
58            bb.note("adding gconf postinst and prerm scripts to %s" % pkg)
59            d.setVar('SCHEMA_FILES', " ".join(schemas))
60            postinst = d.getVar('pkg_postinst:%s' % pkg)
61            if not postinst:
62                postinst = '#!/bin/sh\n'
63            postinst += d.getVar('gconf_postinst')
64            d.setVar('pkg_postinst:%s' % pkg, postinst)
65            prerm = d.getVar('pkg_prerm:%s' % pkg)
66            if not prerm:
67                prerm = '#!/bin/sh\n'
68            prerm += d.getVar('gconf_prerm')
69            d.setVar('pkg_prerm:%s' % pkg, prerm)
70            d.appendVar("RDEPENDS:%s" % pkg, ' ' + d.getVar('MLPREFIX', False) + 'gconf')
71}
72