Patchwork [2/4] rootfs.py, sdk.py: adjust/create the wrappers for creating installed packages list

login
register
mail settings
Submitter Laurentiu Palcu
Date March 18, 2014, 11:38 a.m.
Message ID <6ef8a3c6d9bc6ffaaa3ba9e542ef1e5858fedfe7.1395142153.git.laurentiu.palcu@intel.com>
Download mbox | patch
Permalink /patch/68813/
State Accepted
Commit 483d5a4f3101e51ae495f8473b494a94cefa1a0f
Headers show

Comments

Laurentiu Palcu - March 18, 2014, 11:38 a.m.
Since we created a new PkgsList object that will deal with listing the
installed packages in a rootfs, use the new class both for images and
SDKs in the wrapper functions.

The old list_installed_packages() wrapper listed only the packages inside
an image rootfs. It didn't deal with target/host SDK rootfs's.

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
---
 meta/lib/oe/rootfs.py |   19 ++++---------------
 meta/lib/oe/sdk.py    |   18 ++++++++++++++++++
 2 files changed, 22 insertions(+), 15 deletions(-)

Patch

diff --git a/meta/lib/oe/rootfs.py b/meta/lib/oe/rootfs.py
index 30a1321..0e6c8bc 100644
--- a/meta/lib/oe/rootfs.py
+++ b/meta/lib/oe/rootfs.py
@@ -709,28 +709,17 @@  def create_rootfs(d, manifest_dir=None):
     os.environ.update(env_bkp)
 
 
-def list_installed_packages(d, format=None, rootfs_dir=None):
+def image_list_installed_packages(d, format=None, rootfs_dir=None):
     if not rootfs_dir:
         rootfs_dir = d.getVar('IMAGE_ROOTFS', True)
 
     img_type = d.getVar('IMAGE_PKGTYPE', True)
     if img_type == "rpm":
-        return RpmPM(d,
-                     rootfs_dir,
-                     d.getVar('TARGET_VENDOR', True)
-                     ).list_installed(format)
+        return RpmPkgsList(d, rootfs_dir).list(format)
     elif img_type == "ipk":
-        return OpkgPM(d,
-                      rootfs_dir,
-                      d.getVar("IPKGCONF_TARGET", True),
-                      d.getVar("ALL_MULTILIB_PACKAGE_ARCHS", True)
-                      ).list_installed(format)
+        return OpkgPkgsList(d, rootfs_dir, d.getVar("IPKGCONF_TARGET", True)).list(format)
     elif img_type == "deb":
-        return DpkgPM(d,
-                      rootfs_dir,
-                      d.getVar('PACKAGE_ARCHS', True),
-                      d.getVar('DPKG_ARCH', True)
-                      ).list_installed(format)
+        return DpkgPkgsList(d, rootfs_dir).list(format)
 
 if __name__ == "__main__":
     """
diff --git a/meta/lib/oe/sdk.py b/meta/lib/oe/sdk.py
index 01a1807..5643199 100644
--- a/meta/lib/oe/sdk.py
+++ b/meta/lib/oe/sdk.py
@@ -289,6 +289,24 @@  class DpkgSdk(Sdk):
         bb.utils.remove(os.path.join(self.sdk_output, "var"), True)
 
 
+def sdk_list_installed_packages(d, target, format=None, rootfs_dir=None):
+    if rootfs_dir is None:
+        sdk_output = d.getVar('SDK_OUTPUT', True)
+        target_path = d.getVar('SDKTARGETSYSROOT', True).strip('/')
+
+        rootfs_dir = [sdk_output, os.path.join(sdk_output, target_path)][target is True]
+
+    img_type = d.getVar('IMAGE_PKGTYPE', True)
+    if img_type == "rpm":
+        arch_var = ["SDK_PACKAGE_ARCHS", None][target is True]
+        os_var = ["SDK_OS", None][target is True]
+        return RpmPkgsList(d, rootfs_dir, arch_var, os_var).list(format)
+    elif img_type == "ipk":
+        conf_file_var = ["IPKGCONF_SDK", "IPKGCONF_Target"][target is True]
+        return OpkgPkgsList(d, rootfs_dir, d.getVar(conf_file_var, True)).list(format)
+    elif img_type == "deb":
+        return DpkgPkgsList(d, rootfs_dir).list(format)
+
 def populate_sdk(d, manifest_dir=None):
     env_bkp = os.environ.copy()