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