1SUMMARY = "Phosphor hwmon configuration generator" 2DESCRIPTION = "Generate phosphor-hwmon configuration from an MRW." 3PR = "r1" 4LICENSE = "Apache-2.0" 5LIC_FILES_CHKSUM = "file://${PHOSPHORBASE}/COPYING.apache-2.0;md5=34400b68072d710fecd0a2940a0d1658" 6 7inherit allarch 8inherit mrw-xml 9 10DEPENDS += "mrw-perl-tools-native mrw-native" 11 12do_compile_append() { 13 ${STAGING_BINDIR_NATIVE}/perl-native/perl \ 14 ${STAGING_BINDIR_NATIVE}/hwmon.pl \ 15 -x ${mrw_datadir}/${MRW_XML} \ 16 -d ${WORKDIR}/mrw-config-files 17} 18 19def find_conf_files(dir): 20 from fnmatch import fnmatch 21 myfiles = [] 22 23 #These conf files generated by hwmon.pl are in 24 #subdirectories which we need to preserve the path to. 25 for root, dirs, files in os.walk(dir): 26 for name in files: 27 if fnmatch(name, "*.conf"): 28 myfiles.append(os.path.join(root, name)) 29 30 return myfiles 31 32python install_conf_files() { 33 from shutil import copy 34 35 conf_file_dir = os.path.join( 36 d.getVar("WORKDIR", True), 37 'mrw-config-files') 38 files = find_conf_files(conf_file_dir) 39 40 install_dir = os.path.join(d.getVar("D", True), 41 "etc", "default", "obmc", "hwmon") 42 43 dir_len = len(conf_file_dir) 44 45 for f in files: 46 dest = os.path.join(install_dir, f[dir_len + 1:]) 47 parent = os.path.dirname(dest) 48 if not os.path.exists(parent): 49 os.makedirs(parent) 50 51 copy(f, dest) 52} 53 54do_install[postfuncs] += "install_conf_files" 55