1SUMMARY = "sensor config for phosphor-host-ipmid" 2PR = "r1" 3LICENSE = "Apache-2.0" 4LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10" 5 6inherit phosphor-ipmi-host 7inherit python3native 8inherit mrw-xml 9inherit native 10 11DEPENDS += " \ 12 mrw-native \ 13 mrw-perl-tools-native \ 14 phosphor-ipmi-sensor-config-native \ 15 phosphor-ipmi-sensor-inventory-mrw-config-native \ 16 ${PYTHON_PN}-pyyaml-native \ 17 " 18 19PROVIDES += "virtual/phosphor-ipmi-sensor-inventory" 20 21S = "${WORKDIR}" 22SRC_URI += "file://merge_sensor_config.py" 23 24do_install() { 25 DEST=${D}${sensor_datadir} 26 install -d ${DEST} 27 28 ${bindir}/perl-native/perl \ 29 ${bindir}/gen_ipmi_sensor.pl \ 30 -i ${mrw_datadir}/${MRW_XML} \ 31 -m ${sensor_yamldir}/config.yaml \ 32 -o ${DEST}/sensor.yaml 33} 34 35python 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) 47 override_urls = [url for url in fetch if url.endswith('-config.yaml')] 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 57addtask merge_sensor_config after do_configure before do_compile 58