blob: e58e02a64aa200bc85b2e0687cb44a3107f5e800 [file] [log] [blame]
Ratan Guptab92d0ec2017-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 Subhashchandrana03c56d2017-07-12 06:45:14 -05007inherit pythonnative
Matt Spinler3f6fcbe2017-12-14 13:31:55 -06008inherit mrw-xml
Ratan Guptab92d0ec2017-03-06 17:05:11 +05309
10DEPENDS += " \
11 mrw-native \
12 mrw-perl-tools-native \
Brad Bishop96c3b132018-02-14 21:55:54 -050013 phosphor-ipmi-sensor-config-native \
Dhruvaraj Subhashchandrana03c56d2017-07-12 06:45:14 -050014 phosphor-ipmi-sensor-inventory-mrw-config-native \
Brad Bishop9c37a682018-03-09 11:06:11 -050015 python-pyyaml-native \
Ratan Guptab92d0ec2017-03-06 17:05:11 +053016 "
17
18PROVIDES += "virtual/phosphor-ipmi-sensor-inventory"
19
20S = "${WORKDIR}"
Dhruvaraj Subhashchandrana03c56d2017-07-12 06:45:14 -050021SRC_URI += "file://merge_sensor_config.py"
Ratan Guptab92d0ec2017-03-06 17:05:11 +053022
23do_install() {
Ratan Guptab76fa562017-03-17 19:37:28 +053024 DEST=${D}${sensor_datadir}
Ratan Guptab92d0ec2017-03-06 17:05:11 +053025 install -d ${DEST}
26
27 ${bindir}/perl-native/perl \
28 ${bindir}/gen_ipmi_sensor.pl \
Matt Spinler3f6fcbe2017-12-14 13:31:55 -060029 -i ${mrw_datadir}/${MRW_XML} \
Dhruvaraj Subhashchandrana03c56d2017-07-12 06:45:14 -050030 -m ${sensor_yamldir}/config.yaml \
Ratan Guptab92d0ec2017-03-06 17:05:11 +053031 -o ${DEST}/sensor.yaml
32}
Dhruvaraj Subhashchandrana03c56d2017-07-12 06:45:14 -050033
34python do_merge_sensor_config () {
35 import subprocess
36
37 # TODO: Perform the merge in a temporary directory?
38 workdir = d.getVar('WORKDIR', True)
39 nativedir = d.getVar('STAGING_DIR_NATIVE', True)
40 sensoryamldir = d.getVar('sensor_yamldir', True)
41 cmd = []
42 cmd.append(os.path.join(workdir, 'merge_sensor_config.py'))
43 cmd.append(os.path.join(sensoryamldir, 'config.yaml'))
44
45 fetch = os.listdir(sensoryamldir)
Kun Yie6bd58c2017-10-09 23:17:08 -070046 override_urls = [url for url in fetch if url.endswith('-config.yaml')]
Dhruvaraj Subhashchandrana03c56d2017-07-12 06:45:14 -050047 for url in override_urls:
48 bb.debug(2, 'Merging extra configurations: ' + url)
49 filename = os.path.join(sensoryamldir, url)
50 cmd.append(filename)
51
52 # Invoke the script and don't catch any resulting exception.
53 subprocess.check_call(cmd)
54}
55# python-pyyaml-native is installed by do_configure, so put this task after
56addtask merge_sensor_config after do_configure before do_compile