blob: 67c6996db774a3601bcdfc94b47d71a78311e137 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
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 \
packagegroup-obmc-ipmi-sensors \
phosphor-ipmi-sensor-inventory-mrw-config-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
|