blob: 099ecc97288cb86341ab9ccb50f99c4c5051bc57 [file] [log] [blame]
Patrick Williamsc0f7c042017-02-23 20:41:17 -06001def get_package_manager(d, root_path):
2 """
3 Returns an OE package manager that can install packages in root_path.
4 """
5 from oe.package_manager import RpmPM, OpkgPM, DpkgPM
6
7 pkg_class = d.getVar("IMAGE_PKGTYPE", True)
8 if pkg_class == "rpm":
9 pm = RpmPM(d,
10 root_path,
11 d.getVar('TARGET_VENDOR', True))
12 pm.create_configs()
13
14 elif pkg_class == "ipk":
15 pm = OpkgPM(d,
16 root_path,
17 d.getVar("IPKGCONF_TARGET", True),
18 d.getVar("ALL_MULTILIB_PACKAGE_ARCHS", True))
19
20 elif pkg_class == "deb":
21 pm = DpkgPM(d,
22 root_path,
23 d.getVar('PACKAGE_ARCHS', True),
24 d.getVar('DPKG_ARCH', True))
25
26 pm.write_index()
27 pm.update()
28
29 return pm