gconf.bbclass 2.7 KB

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