blob: d72d5036b960f79daffd65bb6e2c1b08ec73bc74 [file] [log] [blame]
Brad Bishop3217b272017-02-22 20:50:13 -05001SUMMARY = "Phosphor hwmon configuration generator"
2DESCRIPTION = "Generate phosphor-hwmon configuration from an MRW."
3PR = "r1"
4
5inherit obmc-phosphor-license
6inherit allarch
Matt Spinler6d2fda52017-01-16 10:44:58 -06007
8DEPENDS += "mrw-perl-tools-native mrw-native"
9
10do_compile_append() {
11 ${STAGING_BINDIR_NATIVE}/perl-native/perl \
12 ${STAGING_BINDIR_NATIVE}/hwmon.pl \
13 -x ${STAGING_DATADIR_NATIVE}/obmc-mrw/${MACHINE}.xml
14}
15
16def find_conf_files():
17 from fnmatch import fnmatch
18 myfiles = []
19
20 #These conf files generated by hwmon.pl are in
21 #subdirectories which we need to preserve the path to.
22 for root, dirs, files in os.walk("./"):
23 for name in files:
24 if fnmatch(name, "*.conf"):
25 myfiles.append(os.path.join(root, name))
26
27 return myfiles
28
29python install_conf_files() {
30 from shutil import copy
31
32 files = find_conf_files()
33
34 install_dir = os.path.join(d.getVar("D", True),
35 "etc", "default", "obmc", "hwmon")
36 for f in files:
37 dest = os.path.join(install_dir, f)
38 parent = os.path.dirname(dest)
39 if not os.path.exists(parent):
40 os.makedirs(parent)
41
42 copy(f, dest)
43}
44
45do_install[postfuncs] += "install_conf_files"