blob: 0821a2240fb9c0cd72566b1376de5b5f90f1b491 [file] [log] [blame]
Matt Spinlerd7e55e42017-01-16 10:44:58 -06001#Common code to generate the hwmon conf files from the MRW.
2#Can be pulled in on a per system basis.
3
4DEPENDS += "mrw-perl-tools-native mrw-native"
5
6do_compile_append() {
7 ${STAGING_BINDIR_NATIVE}/perl-native/perl \
8 ${STAGING_BINDIR_NATIVE}/hwmon.pl \
9 -x ${STAGING_DATADIR_NATIVE}/obmc-mrw/${MACHINE}.xml
10}
11
12def find_conf_files():
13 from fnmatch import fnmatch
14 myfiles = []
15
16 #These conf files generated by hwmon.pl are in
17 #subdirectories which we need to preserve the path to.
18 for root, dirs, files in os.walk("./"):
19 for name in files:
20 if fnmatch(name, "*.conf"):
21 myfiles.append(os.path.join(root, name))
22
23 return myfiles
24
25python install_conf_files() {
26 from shutil import copy
27
28 files = find_conf_files()
29
30 install_dir = os.path.join(d.getVar("D", True),
31 "etc", "default", "obmc", "hwmon")
32 for f in files:
33 dest = os.path.join(install_dir, f)
34 parent = os.path.dirname(dest)
35 if not os.path.exists(parent):
36 os.makedirs(parent)
37
38 copy(f, dest)
39}
40
41do_install[postfuncs] += "install_conf_files"