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