summaryrefslogtreecommitdiffstats
path: root/meta-phosphor/common/recipes-phosphor/dbus/phosphor-mapper.bb
diff options
context:
space:
mode:
authorBrad Bishop <bradleyb@fuzziesquirrel.com>2017-07-09 23:41:49 -0400
committerPatrick Williams <patrick@stwcx.xyz>2017-07-18 01:05:16 +0000
commit2ad7ce334819f2f2d1e8bd06b160126b41591d07 (patch)
treebda977018f73bbbf78a87668bef46f4807ab0a5a /meta-phosphor/common/recipes-phosphor/dbus/phosphor-mapper.bb
parent0ead07ae105a71b1ab7140bf2ecbdcfb0e66f2c6 (diff)
downloadtalos-openbmc-2ad7ce334819f2f2d1e8bd06b160126b41591d07.tar.gz
talos-openbmc-2ad7ce334819f2f2d1e8bd06b160126b41591d07.zip
mapper: Generate an environment file
Mapper will soon consume four command line arguments that limit the scope of watched path and interface namespaces. Add tooling to generate this environment file based on a new bitbake variables. Add xyz-openbmc_project and org-openbmc by default in the Phosphor layer and other layers can add additional namespaces as needed. Change-Id: I1c03aa91b75d03652a8a8fb80737553fef224fdf Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
Diffstat (limited to 'meta-phosphor/common/recipes-phosphor/dbus/phosphor-mapper.bb')
-rw-r--r--meta-phosphor/common/recipes-phosphor/dbus/phosphor-mapper.bb52
1 files changed, 52 insertions, 0 deletions
diff --git a/meta-phosphor/common/recipes-phosphor/dbus/phosphor-mapper.bb b/meta-phosphor/common/recipes-phosphor/dbus/phosphor-mapper.bb
index ba9f15641..c515a099a 100644
--- a/meta-phosphor/common/recipes-phosphor/dbus/phosphor-mapper.bb
+++ b/meta-phosphor/common/recipes-phosphor/dbus/phosphor-mapper.bb
@@ -9,11 +9,13 @@ inherit autotools pkgconfig
inherit obmc-phosphor-python-autotools
inherit obmc-phosphor-dbus-service
inherit obmc-phosphor-systemd
+inherit phosphor-mapperdir
DEPENDS += "systemd"
DEPENDS += "autoconf-archive-native"
DEPENDS += "sdbusplus"
DEPENDS += "phosphor-logging"
+DEPENDS += "${PN}-config-native"
DBUS_SERVICE_${PN} += "xyz.openbmc_project.ObjectMapper.service"
SYSTEMD_SERVICE_${PN} += " \
@@ -22,6 +24,7 @@ SYSTEMD_SERVICE_${PN} += " \
"
RDEPENDS_libmapper += "libsystemd"
RDEPENDS_${PN} += " \
+ python-argparse \
python-xml \
python-dbus \
python-pygobject \
@@ -41,3 +44,52 @@ python populate_packages_prepend () {
}
PACKAGES_DYNAMIC += "^libmapper.*"
FILES_${PN}_remove = "${libdir}/lib*.so.* ${libdir}/*"
+
+# Construct a systemd environment file with mapper commandline
+# from the native sysroot /usr/share/phosphor-mapper filesystem.
+python do_emit_env() {
+ path = d.getVar('STAGING_DIR_NATIVE', True) + \
+ d.getVar('namespace_dir', True)
+ paths = []
+ for p in os.listdir(path):
+ paths.append(os.sep + os.sep.join(p.split('-')))
+
+ path = d.getVar('STAGING_DIR_NATIVE', True) + \
+ d.getVar('interface_dir', True)
+ interfaces = []
+ for i in os.listdir(path):
+ interfaces.append('.'.join(i.split('-')))
+
+ path = d.getVar('STAGING_DIR_NATIVE', True) + \
+ d.getVar('blacklist_dir', True)
+ blacklists = []
+ for b in os.listdir(path):
+ blacklists.append(os.sep + os.sep.join(b.split('-')))
+
+ path = d.getVar('STAGING_DIR_NATIVE', True) + \
+ d.getVar('interfaceblacklist_dir', True)
+ interface_blacklists = []
+ for ib in os.listdir(path):
+ interface_blacklists.append('.'.join(ib.split('-')))
+
+ path = [d.getVar('D', True) + d.getVar('envfiledir', True)]
+ path.append('obmc')
+ path.append('mapper')
+ parent = os.path.join(*path[:-1])
+ path = os.path.join(*path)
+
+ if not os.path.exists(parent):
+ os.makedirs(parent)
+ with open(path, 'w+') as fd:
+ fd.write('MAPPER_NAMESPACES="{}"'.format(' '.join(paths)))
+ fd.write('\n')
+ fd.write('MAPPER_INTERFACES="{}"'.format(' '.join(interfaces)))
+ fd.write('\n')
+ fd.write('MAPPER_BLACKLISTS="{}"'.format(' '.join(blacklists)))
+ fd.write('\n')
+ fd.write('MAPPER_INTERFACEBLACKLISTS="{}"'.format(' '.join(interface_blacklists)))
+ fd.write('\n')
+}
+
+do_install[postfuncs] += "do_emit_env"
+do_install[vardeps] += "PHOSPHOR_MAPPER_NAMESPACES"
OpenPOWER on IntegriCloud