blob: 169b54772e4e9d4f232d23d6cdc1523056d151f0 [file] [log] [blame]
Ratan Gupta3aa591f2017-03-06 17:05:11 +05301SUMMARY = "sensor config for phosphor-host-ipmid"
2PR = "r1"
3
4inherit native
5inherit obmc-phosphor-license
6inherit phosphor-ipmi-host
Dhruvaraj Subhashchandrane251ef92017-07-12 06:45:14 -05007inherit pythonnative
Ratan Gupta3aa591f2017-03-06 17:05:11 +05308
9DEPENDS += " \
10 mrw-native \
11 mrw-perl-tools-native \
Dhruvaraj Subhashchandrane251ef92017-07-12 06:45:14 -050012 packagegroup-obmc-ipmi-sensors \
13 phosphor-ipmi-sensor-inventory-mrw-config-native \
Ratan Gupta3aa591f2017-03-06 17:05:11 +053014 "
15
16PROVIDES += "virtual/phosphor-ipmi-sensor-inventory"
17
18S = "${WORKDIR}"
Dhruvaraj Subhashchandrane251ef92017-07-12 06:45:14 -050019SRC_URI += "file://merge_sensor_config.py"
Ratan Gupta3aa591f2017-03-06 17:05:11 +053020
21do_install() {
Ratan Gupta65e6e472017-03-17 19:37:28 +053022 DEST=${D}${sensor_datadir}
Ratan Gupta3aa591f2017-03-06 17:05:11 +053023 install -d ${DEST}
24
25 ${bindir}/perl-native/perl \
26 ${bindir}/gen_ipmi_sensor.pl \
27 -i ${datadir}/obmc-mrw/${MACHINE}.xml \
Dhruvaraj Subhashchandrane251ef92017-07-12 06:45:14 -050028 -m ${sensor_yamldir}/config.yaml \
Ratan Gupta3aa591f2017-03-06 17:05:11 +053029 -o ${DEST}/sensor.yaml
30}
Dhruvaraj Subhashchandrane251ef92017-07-12 06:45:14 -050031
32python do_merge_sensor_config () {
33 import subprocess
34
35 # TODO: Perform the merge in a temporary directory?
36 workdir = d.getVar('WORKDIR', True)
37 nativedir = d.getVar('STAGING_DIR_NATIVE', True)
38 sensoryamldir = d.getVar('sensor_yamldir', True)
39 cmd = []
40 cmd.append(os.path.join(workdir, 'merge_sensor_config.py'))
41 cmd.append(os.path.join(sensoryamldir, 'config.yaml'))
42
43 fetch = os.listdir(sensoryamldir)
44 override_urls = filter(lambda f: f.endswith('-config.yaml'), fetch)
45 for url in override_urls:
46 bb.debug(2, 'Merging extra configurations: ' + url)
47 filename = os.path.join(sensoryamldir, url)
48 cmd.append(filename)
49
50 # Invoke the script and don't catch any resulting exception.
51 subprocess.check_call(cmd)
52}
53# python-pyyaml-native is installed by do_configure, so put this task after
54addtask merge_sensor_config after do_configure before do_compile