blob: e667a7a9c6fa25eb3b9cc49c5eada1b896e9e4ae [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 \
Matt Spinler6fb9ddb2017-03-29 12:34:40 -050013 -x ${STAGING_DATADIR_NATIVE}/obmc-mrw/${MACHINE}.xml \
14 -d ${WORKDIR}
Matt Spinler6d2fda52017-01-16 10:44:58 -060015}
16
Matt Spinler6fb9ddb2017-03-29 12:34:40 -050017def find_conf_files(dir):
Matt Spinler6d2fda52017-01-16 10:44:58 -060018 from fnmatch import fnmatch
19 myfiles = []
20
21 #These conf files generated by hwmon.pl are in
22 #subdirectories which we need to preserve the path to.
Matt Spinler6fb9ddb2017-03-29 12:34:40 -050023 for root, dirs, files in os.walk(dir):
Matt Spinler6d2fda52017-01-16 10:44:58 -060024 for name in files:
25 if fnmatch(name, "*.conf"):
26 myfiles.append(os.path.join(root, name))
27
28 return myfiles
29
30python install_conf_files() {
31 from shutil import copy
32
Matt Spinler6fb9ddb2017-03-29 12:34:40 -050033 files = find_conf_files(d.getVar("WORKDIR", True))
Matt Spinler6d2fda52017-01-16 10:44:58 -060034
35 install_dir = os.path.join(d.getVar("D", True),
36 "etc", "default", "obmc", "hwmon")
Matt Spinler6fb9ddb2017-03-29 12:34:40 -050037
38 dir_len = len(d.getVar("WORKDIR", True))
39
Matt Spinler6d2fda52017-01-16 10:44:58 -060040 for f in files:
Matt Spinler6fb9ddb2017-03-29 12:34:40 -050041 dest = os.path.join(install_dir, f[dir_len + 1:])
Matt Spinler6d2fda52017-01-16 10:44:58 -060042 parent = os.path.dirname(dest)
43 if not os.path.exists(parent):
44 os.makedirs(parent)
45
46 copy(f, dest)
47}
48
49do_install[postfuncs] += "install_conf_files"