Brad Bishop | fe7871c | 2017-02-22 20:50:13 -0500 | [diff] [blame] | 1 | SUMMARY = "Phosphor hwmon configuration generator" |
| 2 | DESCRIPTION = "Generate phosphor-hwmon configuration from an MRW." |
| 3 | PR = "r1" |
| 4 | |
| 5 | inherit obmc-phosphor-license |
| 6 | inherit allarch |
Matt Spinler | d7e55e4 | 2017-01-16 10:44:58 -0600 | [diff] [blame] | 7 | |
| 8 | DEPENDS += "mrw-perl-tools-native mrw-native" |
| 9 | |
| 10 | do_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 | |
| 16 | def 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 | |
| 29 | python 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 | |
| 45 | do_install[postfuncs] += "install_conf_files" |