sg3-utils: add newer buildable version
[openembedded.git] / classes / gconf.bbclass
1 DEPENDS += "gconf gconf-native"
2
3 gconf_postinst() {
4 if [ "$1" = configure ]; then
5         if [ "x$D" != "x" ]; then
6                 exit 1
7         fi
8         SCHEMA_LOCATION=/etc/gconf/schemas
9         for SCHEMA in ${SCHEMA_FILES}; do
10                 if [ -e $SCHEMA_LOCATION/$SCHEMA ]; then
11                         HOME=/root GCONF_CONFIG_SOURCE=`gconftool-2 --get-default-source` \
12                                 gconftool-2 \
13                                 --makefile-install-rule $SCHEMA_LOCATION/$SCHEMA > /dev/null
14                 fi
15         done
16 fi
17 }
18
19 gconf_prerm() {
20 if [ "$1" = remove ] || [ "$1" = upgrade ]; then
21         SCHEMA_LOCATION=/etc/gconf/schemas
22         for SCHEMA in ${SCHEMA_FILES}; do
23                 if [ -e $SCHEMA_LOCATION/$SCHEMA ]; then
24                         HOME=/root GCONF_CONFIG_SOURCE=`gconftool-2 --get-default-source` \
25                                 gconftool-2 \
26                                         --makefile-uninstall-rule $SCHEMA_LOCATION/$SCHEMA > /dev/null
27                 fi
28         done
29 fi
30 }
31
32 python populate_packages_append () {
33         import os.path, re
34         packages = bb.data.getVar('PACKAGES', d, 1).split()
35         pkgdest =  bb.data.getVar('PKGDEST', d, 1)
36         
37         for pkg in packages:
38                 schema_dir = '%s/%s/etc/gconf/schemas' % (pkgdest, pkg)
39                 schemas = []
40                 schema_re = re.compile(".*\.schemas$")
41                 if os.path.exists(schema_dir):
42                         for f in os.listdir(schema_dir):
43                                 if schema_re.match(f):
44                                         schemas.append(f)
45                 if schemas != []:
46                         bb.note("adding gconf postinst and prerm scripts to %s" % pkg)
47                         bb.data.setVar('SCHEMA_FILES', " ".join(schemas), d)
48                         postinst = '#!/bin/sh\n'
49                         pkgpostinst = bb.data.getVar('pkg_postinst_%s' % pkg, d, 1) or bb.data.getVar('pkg_postinst', d, 1)
50                         if pkgpostinst:
51                                 postinst += pkgpostinst
52                         postinst += bb.data.getVar('gconf_postinst', d, 1)
53                         bb.data.setVar('pkg_postinst_%s' % pkg, postinst, d)
54                         prerm = bb.data.getVar('pkg_prerm_%s' % pkg, d, 1) or bb.data.getVar('pkg_prerm', d, 1)
55                         if not prerm:
56                                 prerm = '#!/bin/sh\n'
57                         prerm += bb.data.getVar('gconf_prerm', d, 1)
58                         bb.data.setVar('pkg_prerm_%s' % pkg, prerm, d)
59
60 }