Tom Joseph | dcdc8ea | 2017-02-01 19:47:27 +0530 | [diff] [blame] | 1 | # Common code for recipes that create IPMI provider libraries |
| 2 | |
Brad Bishop | 02f9a52 | 2018-03-09 16:51:57 -0500 | [diff] [blame] | 3 | inherit obmc-phosphor-utils |
| 4 | |
Tom Joseph | dcdc8ea | 2017-02-01 19:47:27 +0530 | [diff] [blame] | 5 | LIBDIR = "${D}/${libdir}/ipmid-providers/" |
| 6 | HOSTIPMI_LIBDIR = "${D}/${libdir}/host-ipmid/" |
| 7 | NETIPMI_LIBDIR = "${D}/${libdir}/net-ipmid/" |
| 8 | |
| 9 | python symlink_create_postinstall() { |
| 10 | def install_symlink(d, libname, install_dir): |
| 11 | import glob; |
| 12 | |
| 13 | if not os.path.exists(install_dir): |
| 14 | os.makedirs(install_dir) |
| 15 | |
| 16 | lib_dir = d.getVar('LIBDIR', True) |
| 17 | |
| 18 | # find the library extension libxxx.so.? |
| 19 | install_file = lib_dir + libname + ".?" |
| 20 | |
| 21 | filelist = glob.glob(install_file); |
| 22 | |
| 23 | # get the library name |
| 24 | path, file = os.path.split(filelist[0]) |
Tom Joseph | dcdc8ea | 2017-02-01 19:47:27 +0530 | [diff] [blame] | 25 | source = "../ipmid-providers/" + file |
| 26 | |
| 27 | # create the symlink |
Brad Bishop | 66f1f9f | 2018-02-14 22:24:55 -0500 | [diff] [blame] | 28 | os.symlink(source, os.path.join(install_dir, file)) |
Tom Joseph | dcdc8ea | 2017-02-01 19:47:27 +0530 | [diff] [blame] | 29 | |
| 30 | for libname in listvar_to_list(d, 'HOSTIPMI_PROVIDER_LIBRARY'): |
| 31 | install_dir = d.getVar('HOSTIPMI_LIBDIR', True) |
| 32 | install_symlink(d, libname, install_dir) |
| 33 | |
| 34 | for libname in listvar_to_list(d, 'NETIPMI_PROVIDER_LIBRARY'): |
| 35 | install_dir = d.getVar('NETIPMI_LIBDIR', True) |
| 36 | install_symlink(d, libname, install_dir) |
| 37 | } |
Brad Bishop | 8e5d45b | 2018-02-14 22:24:02 -0500 | [diff] [blame] | 38 | do_install[postfuncs] += "symlink_create_postinstall" |