Matt Spinler | d7e55e4 | 2017-01-16 10:44:58 -0600 | [diff] [blame^] | 1 | #Common code to generate the hwmon conf files from the MRW. |
| 2 | #Can be pulled in on a per system basis. |
| 3 | |
| 4 | DEPENDS += "mrw-perl-tools-native mrw-native" |
| 5 | |
| 6 | do_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 | |
| 12 | def 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 | |
| 25 | python 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 | |
| 41 | do_install[postfuncs] += "install_conf_files" |