Brad Bishop | ff7dc1d | 2016-07-13 17:56:34 -0400 | [diff] [blame^] | 1 | # Utilities and shortcuts for recipes providing D-Bus services. |
| 2 | # Variables: |
| 3 | # DBUS_PACKAGES ?= "${PN}" |
| 4 | # The list of packages to which files should be added. |
| 5 | # |
| 6 | # DBUS_SERVICE_${PN} += "org.openbmc.Foo" |
| 7 | # A list of dbus service names. The class will look for a dbus |
| 8 | # configuration file with the same name with .conf appended. |
| 9 | # |
| 10 | inherit dbus-dir |
| 11 | inherit obmc-phosphor-utils |
Brad Bishop | 9ee75e1 | 2015-09-17 16:39:49 -0400 | [diff] [blame] | 12 | |
Brad Bishop | 065a1be | 2015-09-25 10:23:09 -0400 | [diff] [blame] | 13 | RDEPENDS_${PN} += "dbus-perms" |
Brad Bishop | ff7dc1d | 2016-07-13 17:56:34 -0400 | [diff] [blame^] | 14 | DBUS_PACKAGES ?= "${PN}" |
| 15 | |
| 16 | _INSTALL_DBUS_CONFIGS="" |
| 17 | |
Brad Bishop | 065a1be | 2015-09-25 10:23:09 -0400 | [diff] [blame] | 18 | |
Brad Bishop | 9ee75e1 | 2015-09-17 16:39:49 -0400 | [diff] [blame] | 19 | python() { |
Brad Bishop | ff7dc1d | 2016-07-13 17:56:34 -0400 | [diff] [blame^] | 20 | searchpaths = d.getVar('FILESPATH', True) |
| 21 | |
| 22 | def add_dbus_config(d, service, pkg): |
| 23 | set_append(d, 'SRC_URI', 'file://%s.conf' % service) |
| 24 | set_append(d, 'FILES_%s' % pkg, '%s%s.conf' \ |
| 25 | % (d.getVar('dbus_system_confdir', True), service)) |
| 26 | set_append(d, '_INSTALL_DBUS_CONFIGS', '%s.conf' % service) |
| 27 | |
| 28 | |
| 29 | for pkg in listvar_to_list(d, 'DBUS_PACKAGES'): |
| 30 | services = listvar_to_list(d, 'DBUS_SERVICE_%s' % pkg) |
| 31 | |
| 32 | for service in services: |
| 33 | add_dbus_config(d, service, pkg) |
Brad Bishop | 9ee75e1 | 2015-09-17 16:39:49 -0400 | [diff] [blame] | 34 | } |
| 35 | |
Brad Bishop | ff7dc1d | 2016-07-13 17:56:34 -0400 | [diff] [blame^] | 36 | |
Brad Bishop | 9ee75e1 | 2015-09-17 16:39:49 -0400 | [diff] [blame] | 37 | do_install_append() { |
Brad Bishop | ff7dc1d | 2016-07-13 17:56:34 -0400 | [diff] [blame^] | 38 | # install the dbus configuration files |
| 39 | [ -z "${_INSTALL_DBUS_CONFIGS}" ] || \ |
| 40 | install -d ${D}${dbus_system_confdir} |
| 41 | for c in ${_INSTALL_DBUS_CONFIGS}; do |
| 42 | install -m 0644 ${WORKDIR}/$c \ |
| 43 | ${D}${dbus_system_confdir}$c |
Brad Bishop | 9ee75e1 | 2015-09-17 16:39:49 -0400 | [diff] [blame] | 44 | done |
| 45 | } |