summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrad Bishop <bradleyb@fuzziesquirrel.com>2016-07-14 00:56:34 +0300
committerBrad Bishop <bradleyb@fuzziesquirrel.com>2016-07-28 21:35:37 +0300
commit8ffb402ac41c87b3b78c72d979168b0a2ada5fb5 (patch)
tree4e14a4815fe80a57ef202d7994f8e841686dbad7
parent49a7698af82650ce5dd87bb4e52d20e0d209d022 (diff)
downloadopenbmc-8ffb402ac41c87b3b78c72d979168b0a2ada5fb5.tar.xz
classes-dbus: General refactoring
Take the more idiomatic approach of iterating on DBUS_PACKAGES to find files. Change-Id: I7656316b839f666bd1b25b757bef2c14a2cee326 Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
-rw-r--r--meta-phosphor/classes/obmc-phosphor-dbus-service.bbclass47
-rw-r--r--meta-phosphor/common/recipes-phosphor/dbus-perms/dbus-perms.bb4
-rw-r--r--meta-phosphor/common/recipes-phosphor/dbus/obmc-mapper.bb2
-rw-r--r--meta-phosphor/common/recipes-phosphor/obmc-phosphor-example-pydbus/obmc-phosphor-example-pydbus.bb4
-rw-r--r--meta-phosphor/common/recipes-phosphor/obmc-phosphor-example-sdbus/obmc-phosphor-example-sdbus.bb4
5 files changed, 40 insertions, 21 deletions
diff --git a/meta-phosphor/classes/obmc-phosphor-dbus-service.bbclass b/meta-phosphor/classes/obmc-phosphor-dbus-service.bbclass
index e6132faa7..3277cdb48 100644
--- a/meta-phosphor/classes/obmc-phosphor-dbus-service.bbclass
+++ b/meta-phosphor/classes/obmc-phosphor-dbus-service.bbclass
@@ -1,20 +1,45 @@
-# Common code for applications providing a D-Bus service.
-
-# Class users should define DBUS_SERVICES prior to including.
+# Utilities and shortcuts for recipes providing D-Bus services.
+# Variables:
+# DBUS_PACKAGES ?= "${PN}"
+# The list of packages to which files should be added.
+#
+# DBUS_SERVICE_${PN} += "org.openbmc.Foo"
+# A list of dbus service names. The class will look for a dbus
+# configuration file with the same name with .conf appended.
+#
+inherit dbus-dir
+inherit obmc-phosphor-utils
RDEPENDS_${PN} += "dbus-perms"
+DBUS_PACKAGES ?= "${PN}"
+
+_INSTALL_DBUS_CONFIGS=""
+
python() {
- services = d.getVar('DBUS_SERVICES', True)
- if services:
- uris = " ".join( [ 'file://' + s + '.conf' for s in services.split() ] )
- d.appendVar('SRC_URI', ' ' + uris + ' ')
+ searchpaths = d.getVar('FILESPATH', True)
+
+ def add_dbus_config(d, service, pkg):
+ set_append(d, 'SRC_URI', 'file://%s.conf' % service)
+ set_append(d, 'FILES_%s' % pkg, '%s%s.conf' \
+ % (d.getVar('dbus_system_confdir', True), service))
+ set_append(d, '_INSTALL_DBUS_CONFIGS', '%s.conf' % service)
+
+
+ for pkg in listvar_to_list(d, 'DBUS_PACKAGES'):
+ services = listvar_to_list(d, 'DBUS_SERVICE_%s' % pkg)
+
+ for service in services:
+ add_dbus_config(d, service, pkg)
}
+
do_install_append() {
- # install the service configuration files
- install -d ${D}${sysconfdir}/dbus-1/system.d
- for s in ${DBUS_SERVICES}; do
- install ${WORKDIR}/$s.conf ${D}${sysconfdir}/dbus-1/system.d/$s.conf
+ # install the dbus configuration files
+ [ -z "${_INSTALL_DBUS_CONFIGS}" ] || \
+ install -d ${D}${dbus_system_confdir}
+ for c in ${_INSTALL_DBUS_CONFIGS}; do
+ install -m 0644 ${WORKDIR}/$c \
+ ${D}${dbus_system_confdir}$c
done
}
diff --git a/meta-phosphor/common/recipes-phosphor/dbus-perms/dbus-perms.bb b/meta-phosphor/common/recipes-phosphor/dbus-perms/dbus-perms.bb
index c7b788426..c929d74b3 100644
--- a/meta-phosphor/common/recipes-phosphor/dbus-perms/dbus-perms.bb
+++ b/meta-phosphor/common/recipes-phosphor/dbus-perms/dbus-perms.bb
@@ -7,6 +7,4 @@ inherit allarch
inherit obmc-phosphor-license
inherit obmc-phosphor-dbus-service
-DBUS_SERVICES += " \
- org.openbmc \
- "
+DBUS_SERVICE_${PN} += "org.openbmc"
diff --git a/meta-phosphor/common/recipes-phosphor/dbus/obmc-mapper.bb b/meta-phosphor/common/recipes-phosphor/dbus/obmc-mapper.bb
index 3c3208d2b..12e54740a 100644
--- a/meta-phosphor/common/recipes-phosphor/dbus/obmc-mapper.bb
+++ b/meta-phosphor/common/recipes-phosphor/dbus/obmc-mapper.bb
@@ -10,7 +10,7 @@ inherit obmc-phosphor-dbus-service
inherit obmc-phosphor-systemd
inherit setuptools
-DBUS_SERVICES += "org.openbmc.ObjectMapper"
+DBUS_SERVICE_${PN} += "org.openbmc.ObjectMapper"
RDEPENDS_${PN} += " \
python-xml \
python-dbus \
diff --git a/meta-phosphor/common/recipes-phosphor/obmc-phosphor-example-pydbus/obmc-phosphor-example-pydbus.bb b/meta-phosphor/common/recipes-phosphor/obmc-phosphor-example-pydbus/obmc-phosphor-example-pydbus.bb
index 57e27cf78..7e3e90713 100644
--- a/meta-phosphor/common/recipes-phosphor/obmc-phosphor-example-pydbus/obmc-phosphor-example-pydbus.bb
+++ b/meta-phosphor/common/recipes-phosphor/obmc-phosphor-example-pydbus/obmc-phosphor-example-pydbus.bb
@@ -2,9 +2,7 @@ SUMMARY = "Phosphor OpenBMC BSP Example Application"
DESCRIPTION = "Phosphor OpenBMC QEMU BSP example implementation."
PR = "r1"
-DBUS_SERVICES = " \
- org.openbmc.examples.PythonService \
- "
+DBUS_SERVICE_${PN} += "org.openbmc.examples.PythonService"
inherit obmc-phosphor-pydbus-service
diff --git a/meta-phosphor/common/recipes-phosphor/obmc-phosphor-example-sdbus/obmc-phosphor-example-sdbus.bb b/meta-phosphor/common/recipes-phosphor/obmc-phosphor-example-sdbus/obmc-phosphor-example-sdbus.bb
index 9a3018d37..541aa7943 100644
--- a/meta-phosphor/common/recipes-phosphor/obmc-phosphor-example-sdbus/obmc-phosphor-example-sdbus.bb
+++ b/meta-phosphor/common/recipes-phosphor/obmc-phosphor-example-sdbus/obmc-phosphor-example-sdbus.bb
@@ -2,9 +2,7 @@ SUMMARY = "Phosphor OpenBMC BSP Example Application"
DESCRIPTION = "Phosphor OpenBMC QEMU BSP example implementation."
PR = "r1"
-DBUS_SERVICES = " \
- org.openbmc.examples.SDBusService \
- "
+DBUS_SERVICE_${PN} += "org.openbmc.examples.SDBusService"
S = "${WORKDIR}"
SRC_URI += "file://Makefile \