blob: 67c6996db774a3601bcdfc94b47d71a78311e137 [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 \
Dhruvaraj Subhashchandrana03c56d2017-07-12 06:45:14 -050013 packagegroup-obmc-ipmi-sensors \
14 phosphor-ipmi-sensor-inventory-mrw-config-native \
Ratan Guptab92d0ec2017-03-06 17:05:11 +053015 "
16
17PROVIDES += "virtual/phosphor-ipmi-sensor-inventory"
18
19S = "${WORKDIR}"
Dhruvaraj Subhashchandrana03c56d2017-07-12 06:45:14 -050020SRC_URI += "file://merge_sensor_config.py"
Ratan Guptab92d0ec2017-03-06 17:05:11 +053021
22do_install() {
Ratan Guptab76fa562017-03-17 19:37:28 +053023 DEST=${D}${sensor_datadir}
Ratan Guptab92d0ec2017-03-06 17:05:11 +053024 install -d ${DEST}
25
26 ${bindir}/perl-native/perl \
27 ${bindir}/gen_ipmi_sensor.pl \
Matt Spinler3f6fcbe2017-12-14 13:31:55 -060028 -i ${mrw_datadir}/${MRW_XML} \
Dhruvaraj Subhashchandrana03c56d2017-07-12 06:45:14 -050029 -m ${sensor_yamldir}/config.yaml \
Ratan Guptab92d0ec2017-03-06 17:05:11 +053030 -o ${DEST}/sensor.yaml
31}
Dhruvaraj Subhashchandrana03c56d2017-07-12 06:45:14 -050032
33python do_merge_sensor_config () {
34 import subprocess
35
36 # TODO: Perform the merge in a temporary directory?
37 workdir = d.getVar('WORKDIR', True)
38 nativedir = d.getVar('STAGING_DIR_NATIVE', True)
39 sensoryamldir = d.getVar('sensor_yamldir', True)
40 cmd = []
41 cmd.append(os.path.join(workdir, 'merge_sensor_config.py'))
42 cmd.append(os.path.join(sensoryamldir, 'config.yaml'))
43
44 fetch = os.listdir(sensoryamldir)
Kun Yie6bd58c2017-10-09 23:17:08 -070045 override_urls = [url for url in fetch if url.endswith('-config.yaml')]
Dhruvaraj Subhashchandrana03c56d2017-07-12 06:45:14 -050046 for url in override_urls:
47 bb.debug(2, 'Merging extra configurations: ' + url)
48 filename = os.path.join(sensoryamldir, url)
49 cmd.append(filename)
50
51 # Invoke the script and don't catch any resulting exception.
52 subprocess.check_call(cmd)
53}
54# python-pyyaml-native is installed by do_configure, so put this task after
55addtask merge_sensor_config after do_configure before do_compile