Ratan Gupta | b92d0ec | 2017-03-06 17:05:11 +0530 | [diff] [blame] | 1 | SUMMARY = "sensor config for phosphor-host-ipmid" |
| 2 | PR = "r1" |
| 3 | |
| 4 | inherit native |
| 5 | inherit obmc-phosphor-license |
| 6 | inherit phosphor-ipmi-host |
Dhruvaraj Subhashchandran | a03c56d | 2017-07-12 06:45:14 -0500 | [diff] [blame] | 7 | inherit pythonnative |
Ratan Gupta | b92d0ec | 2017-03-06 17:05:11 +0530 | [diff] [blame] | 8 | |
| 9 | DEPENDS += " \ |
| 10 | mrw-native \ |
| 11 | mrw-perl-tools-native \ |
Dhruvaraj Subhashchandran | a03c56d | 2017-07-12 06:45:14 -0500 | [diff] [blame] | 12 | packagegroup-obmc-ipmi-sensors \ |
| 13 | phosphor-ipmi-sensor-inventory-mrw-config-native \ |
Ratan Gupta | b92d0ec | 2017-03-06 17:05:11 +0530 | [diff] [blame] | 14 | " |
| 15 | |
| 16 | PROVIDES += "virtual/phosphor-ipmi-sensor-inventory" |
| 17 | |
| 18 | S = "${WORKDIR}" |
Dhruvaraj Subhashchandran | a03c56d | 2017-07-12 06:45:14 -0500 | [diff] [blame] | 19 | SRC_URI += "file://merge_sensor_config.py" |
Ratan Gupta | b92d0ec | 2017-03-06 17:05:11 +0530 | [diff] [blame] | 20 | |
| 21 | do_install() { |
Ratan Gupta | b76fa56 | 2017-03-17 19:37:28 +0530 | [diff] [blame] | 22 | DEST=${D}${sensor_datadir} |
Ratan Gupta | b92d0ec | 2017-03-06 17:05:11 +0530 | [diff] [blame] | 23 | install -d ${DEST} |
| 24 | |
| 25 | ${bindir}/perl-native/perl \ |
| 26 | ${bindir}/gen_ipmi_sensor.pl \ |
| 27 | -i ${datadir}/obmc-mrw/${MACHINE}.xml \ |
Dhruvaraj Subhashchandran | a03c56d | 2017-07-12 06:45:14 -0500 | [diff] [blame] | 28 | -m ${sensor_yamldir}/config.yaml \ |
Ratan Gupta | b92d0ec | 2017-03-06 17:05:11 +0530 | [diff] [blame] | 29 | -o ${DEST}/sensor.yaml |
| 30 | } |
Dhruvaraj Subhashchandran | a03c56d | 2017-07-12 06:45:14 -0500 | [diff] [blame] | 31 | |
| 32 | python 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 |
| 54 | addtask merge_sensor_config after do_configure before do_compile |