diff options
author | Mariano Lopez <mariano.lopez@linux.intel.com> | 2016-01-18 14:33:06 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-01-20 17:07:15 +0000 |
commit | 6ebda8e659f678a0f4fe1e970d6f38e5e273f5f7 (patch) | |
tree | 3f3a48a5798b58defdfc9c812705da0bf7fd40fb /meta/lib | |
parent | 03075f671c5425f08669f10f30330c4880c0d60a (diff) | |
download | poky-6ebda8e659f678a0f4fe1e970d6f38e5e273f5f7.tar.gz |
lib/oe/rootfs: Use list_pkgs() instead of list()
This patch changes the use list_pkgs() instead of list()
from class RpmPkgsList. The change is in two functions,
image_list_installed_packages from rootfs.py and
sdk_list_installed_packages from sdk.py.
With this change the functions calling the functions
listed above, must format the output as they required.
The formatting can be done using format_pkg_list() from
oe.utils.
The classes calling the afected functions are changed too
with this patch, to keep the same functionality using the
new data structure.
[YOCTO #7427]
(From OE-Core rev: 983ea373362514e5888bd1d7d9c4f136c94b00f2)
Signed-off-by: Mariano Lopez <mariano.lopez@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib')
-rw-r--r-- | meta/lib/oe/package_manager.py | 18 | ||||
-rw-r--r-- | meta/lib/oe/rootfs.py | 10 | ||||
-rw-r--r-- | meta/lib/oe/sdk.py | 8 |
3 files changed, 19 insertions, 17 deletions
diff --git a/meta/lib/oe/package_manager.py b/meta/lib/oe/package_manager.py index 79cadda682..6d026307f5 100644 --- a/meta/lib/oe/package_manager.py +++ b/meta/lib/oe/package_manager.py | |||
@@ -708,7 +708,7 @@ class PackageManager(object): | |||
708 | pass | 708 | pass |
709 | 709 | ||
710 | @abstractmethod | 710 | @abstractmethod |
711 | def list_installed(self, format=None): | 711 | def list_installed(self): |
712 | pass | 712 | pass |
713 | 713 | ||
714 | @abstractmethod | 714 | @abstractmethod |
@@ -728,7 +728,9 @@ class PackageManager(object): | |||
728 | installed_pkgs_file = os.path.join(self.d.getVar('WORKDIR', True), | 728 | installed_pkgs_file = os.path.join(self.d.getVar('WORKDIR', True), |
729 | "installed_pkgs.txt") | 729 | "installed_pkgs.txt") |
730 | with open(installed_pkgs_file, "w+") as installed_pkgs: | 730 | with open(installed_pkgs_file, "w+") as installed_pkgs: |
731 | installed_pkgs.write(self.list_installed("arch")) | 731 | pkgs = self.list_installed() |
732 | output = oe.utils.format_pkg_list(pkgs, "arch") | ||
733 | installed_pkgs.write(output) | ||
732 | 734 | ||
733 | if globs is None: | 735 | if globs is None: |
734 | globs = self.d.getVar('IMAGE_INSTALL_COMPLEMENTARY', True) | 736 | globs = self.d.getVar('IMAGE_INSTALL_COMPLEMENTARY', True) |
@@ -1432,8 +1434,8 @@ class RpmPM(PackageManager): | |||
1432 | self.image_rpmlib, | 1434 | self.image_rpmlib, |
1433 | symlinks=True) | 1435 | symlinks=True) |
1434 | 1436 | ||
1435 | def list_installed(self, format=None): | 1437 | def list_installed(self): |
1436 | return self.pkgs_list.list(format) | 1438 | return self.pkgs_list.list_pkgs() |
1437 | 1439 | ||
1438 | ''' | 1440 | ''' |
1439 | If incremental install, we need to determine what we've got, | 1441 | If incremental install, we need to determine what we've got, |
@@ -1797,8 +1799,8 @@ class OpkgPM(PackageManager): | |||
1797 | # create the directory back, it's needed by PM lock | 1799 | # create the directory back, it's needed by PM lock |
1798 | bb.utils.mkdirhier(self.opkg_dir) | 1800 | bb.utils.mkdirhier(self.opkg_dir) |
1799 | 1801 | ||
1800 | def list_installed(self, format=None): | 1802 | def list_installed(self): |
1801 | return OpkgPkgsList(self.d, self.target_rootfs, self.config_file).list(format) | 1803 | return OpkgPkgsList(self.d, self.target_rootfs, self.config_file).list_pkgs() |
1802 | 1804 | ||
1803 | def handle_bad_recommendations(self): | 1805 | def handle_bad_recommendations(self): |
1804 | bad_recommendations = self.d.getVar("BAD_RECOMMENDATIONS", True) or "" | 1806 | bad_recommendations = self.d.getVar("BAD_RECOMMENDATIONS", True) or "" |
@@ -2186,8 +2188,8 @@ class DpkgPM(PackageManager): | |||
2186 | bb.fatal("Cannot fix broken dependencies. Command '%s' " | 2188 | bb.fatal("Cannot fix broken dependencies. Command '%s' " |
2187 | "returned %d:\n%s" % (cmd, e.returncode, e.output)) | 2189 | "returned %d:\n%s" % (cmd, e.returncode, e.output)) |
2188 | 2190 | ||
2189 | def list_installed(self, format=None): | 2191 | def list_installed(self): |
2190 | return DpkgPkgsList(self.d, self.target_rootfs).list() | 2192 | return DpkgPkgsList(self.d, self.target_rootfs).list_pkgs() |
2191 | 2193 | ||
2192 | 2194 | ||
2193 | def generate_index_files(d): | 2195 | def generate_index_files(d): |
diff --git a/meta/lib/oe/rootfs.py b/meta/lib/oe/rootfs.py index f677d03a12..0e901c2405 100644 --- a/meta/lib/oe/rootfs.py +++ b/meta/lib/oe/rootfs.py | |||
@@ -252,7 +252,7 @@ class Rootfs(object): | |||
252 | # Remove components that we don't need if it's a read-only rootfs | 252 | # Remove components that we don't need if it's a read-only rootfs |
253 | pkgs_installed = image_list_installed_packages(self.d) | 253 | pkgs_installed = image_list_installed_packages(self.d) |
254 | pkgs_to_remove = list() | 254 | pkgs_to_remove = list() |
255 | for pkg in pkgs_installed.split(): | 255 | for pkg in pkgs_installed: |
256 | if pkg in ["update-rc.d", | 256 | if pkg in ["update-rc.d", |
257 | "base-passwd", | 257 | "base-passwd", |
258 | "shadow", | 258 | "shadow", |
@@ -976,17 +976,17 @@ def create_rootfs(d, manifest_dir=None): | |||
976 | os.environ.update(env_bkp) | 976 | os.environ.update(env_bkp) |
977 | 977 | ||
978 | 978 | ||
979 | def image_list_installed_packages(d, format=None, rootfs_dir=None): | 979 | def image_list_installed_packages(d, rootfs_dir=None): |
980 | if not rootfs_dir: | 980 | if not rootfs_dir: |
981 | rootfs_dir = d.getVar('IMAGE_ROOTFS', True) | 981 | rootfs_dir = d.getVar('IMAGE_ROOTFS', True) |
982 | 982 | ||
983 | img_type = d.getVar('IMAGE_PKGTYPE', True) | 983 | img_type = d.getVar('IMAGE_PKGTYPE', True) |
984 | if img_type == "rpm": | 984 | if img_type == "rpm": |
985 | return RpmPkgsList(d, rootfs_dir).list(format) | 985 | return RpmPkgsList(d, rootfs_dir).list_pkgs() |
986 | elif img_type == "ipk": | 986 | elif img_type == "ipk": |
987 | return OpkgPkgsList(d, rootfs_dir, d.getVar("IPKGCONF_TARGET", True)).list(format) | 987 | return OpkgPkgsList(d, rootfs_dir, d.getVar("IPKGCONF_TARGET", True)).list_pkgs() |
988 | elif img_type == "deb": | 988 | elif img_type == "deb": |
989 | return DpkgPkgsList(d, rootfs_dir).list(format) | 989 | return DpkgPkgsList(d, rootfs_dir).list_pkgs() |
990 | 990 | ||
991 | if __name__ == "__main__": | 991 | if __name__ == "__main__": |
992 | """ | 992 | """ |
diff --git a/meta/lib/oe/sdk.py b/meta/lib/oe/sdk.py index 6affa4079b..b308aea252 100644 --- a/meta/lib/oe/sdk.py +++ b/meta/lib/oe/sdk.py | |||
@@ -345,7 +345,7 @@ class DpkgSdk(Sdk): | |||
345 | 345 | ||
346 | 346 | ||
347 | 347 | ||
348 | def sdk_list_installed_packages(d, target, format=None, rootfs_dir=None): | 348 | def sdk_list_installed_packages(d, target, rootfs_dir=None): |
349 | if rootfs_dir is None: | 349 | if rootfs_dir is None: |
350 | sdk_output = d.getVar('SDK_OUTPUT', True) | 350 | sdk_output = d.getVar('SDK_OUTPUT', True) |
351 | target_path = d.getVar('SDKTARGETSYSROOT', True).strip('/') | 351 | target_path = d.getVar('SDKTARGETSYSROOT', True).strip('/') |
@@ -356,12 +356,12 @@ def sdk_list_installed_packages(d, target, format=None, rootfs_dir=None): | |||
356 | if img_type == "rpm": | 356 | if img_type == "rpm": |
357 | arch_var = ["SDK_PACKAGE_ARCHS", None][target is True] | 357 | arch_var = ["SDK_PACKAGE_ARCHS", None][target is True] |
358 | os_var = ["SDK_OS", None][target is True] | 358 | os_var = ["SDK_OS", None][target is True] |
359 | return RpmPkgsList(d, rootfs_dir, arch_var, os_var).list(format) | 359 | return RpmPkgsList(d, rootfs_dir, arch_var, os_var).list_pkgs() |
360 | elif img_type == "ipk": | 360 | elif img_type == "ipk": |
361 | conf_file_var = ["IPKGCONF_SDK", "IPKGCONF_TARGET"][target is True] | 361 | conf_file_var = ["IPKGCONF_SDK", "IPKGCONF_TARGET"][target is True] |
362 | return OpkgPkgsList(d, rootfs_dir, d.getVar(conf_file_var, True)).list(format) | 362 | return OpkgPkgsList(d, rootfs_dir, d.getVar(conf_file_var, True)).list_pkgs() |
363 | elif img_type == "deb": | 363 | elif img_type == "deb": |
364 | return DpkgPkgsList(d, rootfs_dir).list(format) | 364 | return DpkgPkgsList(d, rootfs_dir).list_pkgs() |
365 | 365 | ||
366 | def populate_sdk(d, manifest_dir=None): | 366 | def populate_sdk(d, manifest_dir=None): |
367 | env_bkp = os.environ.copy() | 367 | env_bkp = os.environ.copy() |