summaryrefslogtreecommitdiffstats
path: root/meta-phosphor/recipes-phosphor/ipmi/phosphor-ipmi-sensor-inventory-mrw-native.bb
diff options
context:
space:
mode:
Diffstat (limited to 'meta-phosphor/recipes-phosphor/ipmi/phosphor-ipmi-sensor-inventory-mrw-native.bb')
-rw-r--r--meta-phosphor/recipes-phosphor/ipmi/phosphor-ipmi-sensor-inventory-mrw-native.bb56
1 files changed, 56 insertions, 0 deletions
diff --git a/meta-phosphor/recipes-phosphor/ipmi/phosphor-ipmi-sensor-inventory-mrw-native.bb b/meta-phosphor/recipes-phosphor/ipmi/phosphor-ipmi-sensor-inventory-mrw-native.bb
new file mode 100644
index 000000000..e58e02a64
--- /dev/null
+++ b/meta-phosphor/recipes-phosphor/ipmi/phosphor-ipmi-sensor-inventory-mrw-native.bb
@@ -0,0 +1,56 @@
+SUMMARY = "sensor config for phosphor-host-ipmid"
+PR = "r1"
+
+inherit native
+inherit obmc-phosphor-license
+inherit phosphor-ipmi-host
+inherit pythonnative
+inherit mrw-xml
+
+DEPENDS += " \
+ mrw-native \
+ mrw-perl-tools-native \
+ phosphor-ipmi-sensor-config-native \
+ phosphor-ipmi-sensor-inventory-mrw-config-native \
+ python-pyyaml-native \
+ "
+
+PROVIDES += "virtual/phosphor-ipmi-sensor-inventory"
+
+S = "${WORKDIR}"
+SRC_URI += "file://merge_sensor_config.py"
+
+do_install() {
+ DEST=${D}${sensor_datadir}
+ install -d ${DEST}
+
+ ${bindir}/perl-native/perl \
+ ${bindir}/gen_ipmi_sensor.pl \
+ -i ${mrw_datadir}/${MRW_XML} \
+ -m ${sensor_yamldir}/config.yaml \
+ -o ${DEST}/sensor.yaml
+}
+
+python do_merge_sensor_config () {
+ import subprocess
+
+ # TODO: Perform the merge in a temporary directory?
+ workdir = d.getVar('WORKDIR', True)
+ nativedir = d.getVar('STAGING_DIR_NATIVE', True)
+ sensoryamldir = d.getVar('sensor_yamldir', True)
+ cmd = []
+ cmd.append(os.path.join(workdir, 'merge_sensor_config.py'))
+ cmd.append(os.path.join(sensoryamldir, 'config.yaml'))
+
+ fetch = os.listdir(sensoryamldir)
+ override_urls = [url for url in fetch if url.endswith('-config.yaml')]
+ for url in override_urls:
+ bb.debug(2, 'Merging extra configurations: ' + url)
+ filename = os.path.join(sensoryamldir, url)
+ cmd.append(filename)
+
+ # Invoke the script and don't catch any resulting exception.
+ subprocess.check_call(cmd)
+}
+# python-pyyaml-native is installed by do_configure, so put this task after
+addtask merge_sensor_config after do_configure before do_compile
OpenPOWER on IntegriCloud