summaryrefslogtreecommitdiff
path: root/meta-phosphor/common/recipes-phosphor/ipmi/phosphor-ipmi-host.bb
diff options
context:
space:
mode:
authorDhruvaraj Subhashchandran <dhruvaraj@in.ibm.com>2017-08-05 00:09:15 +0300
committerPatrick Williams <patrick@stwcx.xyz>2017-08-08 17:55:37 +0300
commit1235276ba9b6ecde21437253ec018cc2792625b4 (patch)
tree05afdfc85504dcd840c91b1fe1a76158c7a8bea5 /meta-phosphor/common/recipes-phosphor/ipmi/phosphor-ipmi-host.bb
parente251ef95850a75c73794a5eccbf0930d76f0d182 (diff)
downloadopenbmc-1235276ba9b6ecde21437253ec018cc2792625b4.tar.xz
Merge hardcoded sensor yamls with generated sensor.yaml
This change will enable adding sensors which is not part of the MRW to the MRW bases systems. Change-Id: I0d7d2ff94a668ae77bb8c906e85ef6280dc49830 Signed-off-by: Dhruvaraj Subhashchandran <dhruvaraj@in.ibm.com>
Diffstat (limited to 'meta-phosphor/common/recipes-phosphor/ipmi/phosphor-ipmi-host.bb')
-rw-r--r--meta-phosphor/common/recipes-phosphor/ipmi/phosphor-ipmi-host.bb33
1 files changed, 33 insertions, 0 deletions
diff --git a/meta-phosphor/common/recipes-phosphor/ipmi/phosphor-ipmi-host.bb b/meta-phosphor/common/recipes-phosphor/ipmi/phosphor-ipmi-host.bb
index f2fa39e449..45cb2eed3f 100644
--- a/meta-phosphor/common/recipes-phosphor/ipmi/phosphor-ipmi-host.bb
+++ b/meta-phosphor/common/recipes-phosphor/ipmi/phosphor-ipmi-host.bb
@@ -52,6 +52,8 @@ EXTRA_OECONF = " \
S = "${WORKDIR}/git"
+SRC_URI += "file://merge_yamls.py"
+
HOSTIPMI_PROVIDER_LIBRARY += "libapphandler.so"
HOSTIPMI_PROVIDER_LIBRARY += "libsysintfcmds.so"
@@ -70,3 +72,34 @@ SOFT_SVC = "xyz.openbmc_project.Ipmi.Internal.SoftPowerOff.service"
SOFT_TGTFMT = "obmc-host-shutdown@{0}.target"
SOFT_FMT = "../${SOFT_SVC}:${SOFT_TGTFMT}.requires/${SOFT_SVC}"
SYSTEMD_LINK_${PN} += "${@compose_list_zip(d, 'SOFT_FMT', 'OBMC_HOST_INSTANCES')}"
+
+#Collect all hardcoded sensor yamls from different recipes and
+#merge all of them with sensor.yaml.
+python do_merge_sensors () {
+ import subprocess
+
+ # TODO: Perform the merge in a temporary directory?
+ workdir = d.getVar('WORKDIR', True)
+ nativedir = d.getVar('STAGING_DIR_NATIVE', True)
+ sensorsdir = d.getVar('sensor_datadir', True)
+ sensorsdir = sensorsdir[1:]
+ sensorsdir = os.path.join(nativedir, sensorsdir)
+ cmd = []
+ cmd.append(os.path.join(workdir, 'merge_yamls.py'))
+ cmd.append(os.path.join(sensorsdir, 'sensor.yaml'))
+
+ if os.stat(os.path.join(sensorsdir, 'sensor.yaml')).st_size == 0:
+ return
+ fetch = bb.fetch2.Fetch([], d)
+ override_urls = filter(lambda f: f.endswith('.hardcoded.yaml'), fetch.urls)
+ for url in override_urls:
+ bb.debug(2, 'Overriding with source: ' + url)
+ local_base = os.path.basename(fetch.localpath(url))
+ filename = os.path.join(workdir, local_base)
+ 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_sensors after do_configure before do_compile