blob: 3277cdb489c8ae871ada0c0fd2533e280859fd40 [file] [log] [blame]
Brad Bishopff7dc1d2016-07-13 17:56:34 -04001# 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#
10inherit dbus-dir
11inherit obmc-phosphor-utils
Brad Bishop9ee75e12015-09-17 16:39:49 -040012
Brad Bishop065a1be2015-09-25 10:23:09 -040013RDEPENDS_${PN} += "dbus-perms"
Brad Bishopff7dc1d2016-07-13 17:56:34 -040014DBUS_PACKAGES ?= "${PN}"
15
16_INSTALL_DBUS_CONFIGS=""
17
Brad Bishop065a1be2015-09-25 10:23:09 -040018
Brad Bishop9ee75e12015-09-17 16:39:49 -040019python() {
Brad Bishopff7dc1d2016-07-13 17:56:34 -040020 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 Bishop9ee75e12015-09-17 16:39:49 -040034}
35
Brad Bishopff7dc1d2016-07-13 17:56:34 -040036
Brad Bishop9ee75e12015-09-17 16:39:49 -040037do_install_append() {
Brad Bishopff7dc1d2016-07-13 17:56:34 -040038 # 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 Bishop9ee75e12015-09-17 16:39:49 -040044 done
45}