[OE-core] [PATCH 03/10] oeqa/utils/package_manager.py: Add get_package_manager()

mariano.lopez at linux.intel.com mariano.lopez at linux.intel.com
Tue May 24 12:44:12 UTC 2016


From: Mariano Lopez <mariano.lopez at linux.intel.com>

This new file just contain one function to return an OE package
manager, this depends in the current packaging method.

[YOCTO #8694]

Signed-off-by: Mariano Lopez <mariano.lopez at linux.intel.com>
---
 meta/lib/oeqa/utils/package_manager.py | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)
 create mode 100644 meta/lib/oeqa/utils/package_manager.py

diff --git a/meta/lib/oeqa/utils/package_manager.py b/meta/lib/oeqa/utils/package_manager.py
new file mode 100644
index 0000000..099ecc9
--- /dev/null
+++ b/meta/lib/oeqa/utils/package_manager.py
@@ -0,0 +1,29 @@
+def get_package_manager(d, root_path):
+    """
+    Returns an OE package manager that can install packages in root_path.
+    """
+    from oe.package_manager import RpmPM, OpkgPM, DpkgPM
+
+    pkg_class = d.getVar("IMAGE_PKGTYPE", True)
+    if pkg_class == "rpm":
+        pm = RpmPM(d,
+                   root_path,
+                   d.getVar('TARGET_VENDOR', True))
+        pm.create_configs()
+
+    elif pkg_class == "ipk":
+        pm = OpkgPM(d,
+                    root_path,
+                    d.getVar("IPKGCONF_TARGET", True),
+                    d.getVar("ALL_MULTILIB_PACKAGE_ARCHS", True))
+
+    elif pkg_class == "deb":
+        pm = DpkgPM(d,
+                    root_path,
+                    d.getVar('PACKAGE_ARCHS', True),
+                    d.getVar('DPKG_ARCH', True))
+
+    pm.write_index()
+    pm.update()
+
+    return pm
-- 
2.6.6




More information about the Openembedded-core mailing list