gconf.bbclass 2.7 KB

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