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 |
Matt Spinler | 3f6fcbe | 2017-12-14 13:31:55 -0600 | [diff] [blame] | 8 | inherit mrw-xml |
Ratan Gupta | b92d0ec | 2017-03-06 17:05:11 +0530 | [diff] [blame] | 9 | |
| 10 | DEPENDS += " \ |
| 11 | mrw-native \ |
| 12 | mrw-perl-tools-native \ |
Dhruvaraj Subhashchandran | a03c56d | 2017-07-12 06:45:14 -0500 | [diff] [blame] | 13 | packagegroup-obmc-ipmi-sensors \ |
| 14 | phosphor-ipmi-sensor-inventory-mrw-config-native \ |
Ratan Gupta | b92d0ec | 2017-03-06 17:05:11 +0530 | [diff] [blame] | 15 | " |
| 16 | |
| 17 | PROVIDES += "virtual/phosphor-ipmi-sensor-inventory" |
| 18 | |
| 19 | S = "${WORKDIR}" |
Dhruvaraj Subhashchandran | a03c56d | 2017-07-12 06:45:14 -0500 | [diff] [blame] | 20 | SRC_URI += "file://merge_sensor_config.py" |
Ratan Gupta | b92d0ec | 2017-03-06 17:05:11 +0530 | [diff] [blame] | 21 | |
| 22 | do_install() { |
Ratan Gupta | b76fa56 | 2017-03-17 19:37:28 +0530 | [diff] [blame] | 23 | DEST=${D}${sensor_datadir} |
Ratan Gupta | b92d0ec | 2017-03-06 17:05:11 +0530 | [diff] [blame] | 24 | install -d ${DEST} |
| 25 | |
| 26 | ${bindir}/perl-native/perl \ |
| 27 | ${bindir}/gen_ipmi_sensor.pl \ |
Matt Spinler | 3f6fcbe | 2017-12-14 13:31:55 -0600 | [diff] [blame] | 28 | -i ${mrw_datadir}/${MRW_XML} \ |
Dhruvaraj Subhashchandran | a03c56d | 2017-07-12 06:45:14 -0500 | [diff] [blame] | 29 | -m ${sensor_yamldir}/config.yaml \ |
Ratan Gupta | b92d0ec | 2017-03-06 17:05:11 +0530 | [diff] [blame] | 30 | -o ${DEST}/sensor.yaml |
| 31 | } |
Dhruvaraj Subhashchandran | a03c56d | 2017-07-12 06:45:14 -0500 | [diff] [blame] | 32 | |
| 33 | python 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 Yi | e6bd58c | 2017-10-09 23:17:08 -0700 | [diff] [blame] | 45 | override_urls = [url for url in fetch if url.endswith('-config.yaml')] |
Dhruvaraj Subhashchandran | a03c56d | 2017-07-12 06:45:14 -0500 | [diff] [blame] | 46 | 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 |
| 55 | addtask merge_sensor_config after do_configure before do_compile |