Ratan Gupta | b92d0ec | 2017-03-06 17:05:11 +0530 | [diff] [blame] | 1 | SUMMARY = "sensor config for phosphor-host-ipmid" |
| 2 | PR = "r1" |
Patrick Venture | 2afb868 | 2018-11-04 08:15:39 -0800 | [diff] [blame] | 3 | LICENSE = "Apache-2.0" |
| 4 | LIC_FILES_CHKSUM = "file://${PHOSPHORBASE}/COPYING.apache-2.0;md5=34400b68072d710fecd0a2940a0d1658" |
Ratan Gupta | b92d0ec | 2017-03-06 17:05:11 +0530 | [diff] [blame] | 5 | |
| 6 | inherit native |
Ratan Gupta | b92d0ec | 2017-03-06 17:05:11 +0530 | [diff] [blame] | 7 | inherit phosphor-ipmi-host |
Dhruvaraj Subhashchandran | a03c56d | 2017-07-12 06:45:14 -0500 | [diff] [blame] | 8 | inherit pythonnative |
Matt Spinler | 3f6fcbe | 2017-12-14 13:31:55 -0600 | [diff] [blame] | 9 | inherit mrw-xml |
Ratan Gupta | b92d0ec | 2017-03-06 17:05:11 +0530 | [diff] [blame] | 10 | |
| 11 | DEPENDS += " \ |
| 12 | mrw-native \ |
| 13 | mrw-perl-tools-native \ |
Brad Bishop | 96c3b13 | 2018-02-14 21:55:54 -0500 | [diff] [blame] | 14 | phosphor-ipmi-sensor-config-native \ |
Dhruvaraj Subhashchandran | a03c56d | 2017-07-12 06:45:14 -0500 | [diff] [blame] | 15 | phosphor-ipmi-sensor-inventory-mrw-config-native \ |
Brad Bishop | 9c37a68 | 2018-03-09 11:06:11 -0500 | [diff] [blame] | 16 | python-pyyaml-native \ |
Ratan Gupta | b92d0ec | 2017-03-06 17:05:11 +0530 | [diff] [blame] | 17 | " |
| 18 | |
| 19 | PROVIDES += "virtual/phosphor-ipmi-sensor-inventory" |
| 20 | |
| 21 | S = "${WORKDIR}" |
Dhruvaraj Subhashchandran | a03c56d | 2017-07-12 06:45:14 -0500 | [diff] [blame] | 22 | SRC_URI += "file://merge_sensor_config.py" |
Ratan Gupta | b92d0ec | 2017-03-06 17:05:11 +0530 | [diff] [blame] | 23 | |
| 24 | do_install() { |
Ratan Gupta | b76fa56 | 2017-03-17 19:37:28 +0530 | [diff] [blame] | 25 | DEST=${D}${sensor_datadir} |
Ratan Gupta | b92d0ec | 2017-03-06 17:05:11 +0530 | [diff] [blame] | 26 | install -d ${DEST} |
| 27 | |
| 28 | ${bindir}/perl-native/perl \ |
| 29 | ${bindir}/gen_ipmi_sensor.pl \ |
Matt Spinler | 3f6fcbe | 2017-12-14 13:31:55 -0600 | [diff] [blame] | 30 | -i ${mrw_datadir}/${MRW_XML} \ |
Dhruvaraj Subhashchandran | a03c56d | 2017-07-12 06:45:14 -0500 | [diff] [blame] | 31 | -m ${sensor_yamldir}/config.yaml \ |
Ratan Gupta | b92d0ec | 2017-03-06 17:05:11 +0530 | [diff] [blame] | 32 | -o ${DEST}/sensor.yaml |
| 33 | } |
Dhruvaraj Subhashchandran | a03c56d | 2017-07-12 06:45:14 -0500 | [diff] [blame] | 34 | |
| 35 | python do_merge_sensor_config () { |
| 36 | import subprocess |
| 37 | |
| 38 | # TODO: Perform the merge in a temporary directory? |
| 39 | workdir = d.getVar('WORKDIR', True) |
| 40 | nativedir = d.getVar('STAGING_DIR_NATIVE', True) |
| 41 | sensoryamldir = d.getVar('sensor_yamldir', True) |
| 42 | cmd = [] |
| 43 | cmd.append(os.path.join(workdir, 'merge_sensor_config.py')) |
| 44 | cmd.append(os.path.join(sensoryamldir, 'config.yaml')) |
| 45 | |
| 46 | fetch = os.listdir(sensoryamldir) |
Kun Yi | e6bd58c | 2017-10-09 23:17:08 -0700 | [diff] [blame] | 47 | override_urls = [url for url in fetch if url.endswith('-config.yaml')] |
Dhruvaraj Subhashchandran | a03c56d | 2017-07-12 06:45:14 -0500 | [diff] [blame] | 48 | for url in override_urls: |
| 49 | bb.debug(2, 'Merging extra configurations: ' + url) |
| 50 | filename = os.path.join(sensoryamldir, url) |
| 51 | cmd.append(filename) |
| 52 | |
| 53 | # Invoke the script and don't catch any resulting exception. |
| 54 | subprocess.check_call(cmd) |
| 55 | } |
| 56 | # python-pyyaml-native is installed by do_configure, so put this task after |
| 57 | addtask merge_sensor_config after do_configure before do_compile |