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 | |
| 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>
| -rw-r--r-- | meta/classes/buildhistory.bbclass | 11 | ||||
| -rw-r--r-- | meta/classes/license.bbclass | 8 | ||||
| -rw-r--r-- | meta/classes/populate_sdk_base.bbclass | 8 | ||||
| -rw-r--r-- | meta/classes/rootfs-postcommands.bbclass | 4 | ||||
| -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 |
7 files changed, 41 insertions, 26 deletions
diff --git a/meta/classes/buildhistory.bbclass b/meta/classes/buildhistory.bbclass index 2c144abb97..9f1744293a 100644 --- a/meta/classes/buildhistory.bbclass +++ b/meta/classes/buildhistory.bbclass | |||
| @@ -337,18 +337,21 @@ def write_pkghistory(pkginfo, d): | |||
| 337 | def buildhistory_list_installed(d, rootfs_type="image"): | 337 | def buildhistory_list_installed(d, rootfs_type="image"): |
| 338 | from oe.rootfs import image_list_installed_packages | 338 | from oe.rootfs import image_list_installed_packages |
| 339 | from oe.sdk import sdk_list_installed_packages | 339 | from oe.sdk import sdk_list_installed_packages |
| 340 | from oe.utils import format_pkg_list | ||
| 340 | 341 | ||
| 341 | process_list = [('file', 'bh_installed_pkgs.txt'),\ | 342 | process_list = [('file', 'bh_installed_pkgs.txt'),\ |
| 342 | ('deps', 'bh_installed_pkgs_deps.txt')] | 343 | ('deps', 'bh_installed_pkgs_deps.txt')] |
| 343 | 344 | ||
| 345 | if rootfs_type == "image": | ||
| 346 | pkgs = image_list_installed_packages(d) | ||
| 347 | else: | ||
| 348 | pkgs = sdk_list_installed_packages(d, rootfs_type == "sdk_target") | ||
| 349 | |||
| 344 | for output_type, output_file in process_list: | 350 | for output_type, output_file in process_list: |
| 345 | output_file_full = os.path.join(d.getVar('WORKDIR', True), output_file) | 351 | output_file_full = os.path.join(d.getVar('WORKDIR', True), output_file) |
| 346 | 352 | ||
| 347 | with open(output_file_full, 'w') as output: | 353 | with open(output_file_full, 'w') as output: |
| 348 | if rootfs_type == "image": | 354 | output.write(format_pkg_list(pkgs, output_type)) |
| 349 | output.write(image_list_installed_packages(d, output_type)) | ||
| 350 | else: | ||
| 351 | output.write(sdk_list_installed_packages(d, rootfs_type == "sdk_target", output_type)) | ||
| 352 | 355 | ||
| 353 | python buildhistory_list_installed_image() { | 356 | python buildhistory_list_installed_image() { |
| 354 | buildhistory_list_installed(d) | 357 | buildhistory_list_installed(d) |
diff --git a/meta/classes/license.bbclass b/meta/classes/license.bbclass index 8a42874600..301216d5d6 100644 --- a/meta/classes/license.bbclass +++ b/meta/classes/license.bbclass | |||
| @@ -21,8 +21,12 @@ python write_package_manifest() { | |||
| 21 | license_image_dir = d.expand('${LICENSE_DIRECTORY}/${IMAGE_NAME}') | 21 | license_image_dir = d.expand('${LICENSE_DIRECTORY}/${IMAGE_NAME}') |
| 22 | bb.utils.mkdirhier(license_image_dir) | 22 | bb.utils.mkdirhier(license_image_dir) |
| 23 | from oe.rootfs import image_list_installed_packages | 23 | from oe.rootfs import image_list_installed_packages |
| 24 | from oe.utils import format_pkg_list | ||
| 25 | |||
| 26 | pkgs = image_list_installed_packages(d) | ||
| 27 | output = format_pkg_list(pkgs) | ||
| 24 | open(os.path.join(license_image_dir, 'package.manifest'), | 28 | open(os.path.join(license_image_dir, 'package.manifest'), |
| 25 | 'w+').write(image_list_installed_packages(d)) | 29 | 'w+').write(output) |
| 26 | } | 30 | } |
| 27 | 31 | ||
| 28 | python write_deploy_manifest() { | 32 | python write_deploy_manifest() { |
| @@ -38,7 +42,7 @@ python license_create_manifest() { | |||
| 38 | return 0 | 42 | return 0 |
| 39 | 43 | ||
| 40 | pkg_dic = {} | 44 | pkg_dic = {} |
| 41 | for pkg in image_list_installed_packages(d).splitlines(): | 45 | for pkg in sorted(image_list_installed_packages(d)): |
| 42 | pkg_info = os.path.join(d.getVar('PKGDATA_DIR', True), | 46 | pkg_info = os.path.join(d.getVar('PKGDATA_DIR', True), |
| 43 | 'runtime-reverse', pkg) | 47 | 'runtime-reverse', pkg) |
| 44 | pkg_name = os.path.basename(os.readlink(pkg_info)) | 48 | pkg_name = os.path.basename(os.readlink(pkg_info)) |
diff --git a/meta/classes/populate_sdk_base.bbclass b/meta/classes/populate_sdk_base.bbclass index 7ca1df67a2..99b64f7429 100644 --- a/meta/classes/populate_sdk_base.bbclass +++ b/meta/classes/populate_sdk_base.bbclass | |||
| @@ -62,20 +62,24 @@ SDK_TARGET_MANIFEST = "${SDK_DEPLOY}/${TOOLCHAIN_OUTPUTNAME}.target.manifest" | |||
| 62 | SDK_HOST_MANIFEST = "${SDK_DEPLOY}/${TOOLCHAIN_OUTPUTNAME}.host.manifest" | 62 | SDK_HOST_MANIFEST = "${SDK_DEPLOY}/${TOOLCHAIN_OUTPUTNAME}.host.manifest" |
| 63 | python write_target_sdk_manifest () { | 63 | python write_target_sdk_manifest () { |
| 64 | from oe.sdk import sdk_list_installed_packages | 64 | from oe.sdk import sdk_list_installed_packages |
| 65 | from oe.utils import format_pkg_list | ||
| 65 | sdkmanifestdir = os.path.dirname(d.getVar("SDK_TARGET_MANIFEST", True)) | 66 | sdkmanifestdir = os.path.dirname(d.getVar("SDK_TARGET_MANIFEST", True)) |
| 67 | pkgs = sdk_list_installed_packages(d, True) | ||
| 66 | if not os.path.exists(sdkmanifestdir): | 68 | if not os.path.exists(sdkmanifestdir): |
| 67 | bb.utils.mkdirhier(sdkmanifestdir) | 69 | bb.utils.mkdirhier(sdkmanifestdir) |
| 68 | with open(d.getVar('SDK_TARGET_MANIFEST', True), 'w') as output: | 70 | with open(d.getVar('SDK_TARGET_MANIFEST', True), 'w') as output: |
| 69 | output.write(sdk_list_installed_packages(d, True, 'ver')) | 71 | output.write(format_pkg_list(pkgs, 'ver')) |
| 70 | } | 72 | } |
| 71 | 73 | ||
| 72 | python write_host_sdk_manifest () { | 74 | python write_host_sdk_manifest () { |
| 73 | from oe.sdk import sdk_list_installed_packages | 75 | from oe.sdk import sdk_list_installed_packages |
| 76 | from oe.utils import format_pkg_list | ||
| 74 | sdkmanifestdir = os.path.dirname(d.getVar("SDK_HOST_MANIFEST", True)) | 77 | sdkmanifestdir = os.path.dirname(d.getVar("SDK_HOST_MANIFEST", True)) |
| 78 | pkgs = sdk_list_installed_packages(d, False) | ||
| 75 | if not os.path.exists(sdkmanifestdir): | 79 | if not os.path.exists(sdkmanifestdir): |
| 76 | bb.utils.mkdirhier(sdkmanifestdir) | 80 | bb.utils.mkdirhier(sdkmanifestdir) |
| 77 | with open(d.getVar('SDK_HOST_MANIFEST', True), 'w') as output: | 81 | with open(d.getVar('SDK_HOST_MANIFEST', True), 'w') as output: |
| 78 | output.write(sdk_list_installed_packages(d, False, 'ver')) | 82 | output.write(format_pkg_list(pkgs, 'ver')) |
| 79 | } | 83 | } |
| 80 | 84 | ||
| 81 | POPULATE_SDK_POST_TARGET_COMMAND_append = " write_target_sdk_manifest ; " | 85 | POPULATE_SDK_POST_TARGET_COMMAND_append = " write_target_sdk_manifest ; " |
diff --git a/meta/classes/rootfs-postcommands.bbclass b/meta/classes/rootfs-postcommands.bbclass index 970e9f34b1..0736d6c533 100644 --- a/meta/classes/rootfs-postcommands.bbclass +++ b/meta/classes/rootfs-postcommands.bbclass | |||
| @@ -207,13 +207,15 @@ insert_feed_uris () { | |||
| 207 | 207 | ||
| 208 | python write_image_manifest () { | 208 | python write_image_manifest () { |
| 209 | from oe.rootfs import image_list_installed_packages | 209 | from oe.rootfs import image_list_installed_packages |
| 210 | from oe.utils import format_pkg_list | ||
| 210 | 211 | ||
| 211 | deploy_dir = d.getVar('DEPLOY_DIR_IMAGE', True) | 212 | deploy_dir = d.getVar('DEPLOY_DIR_IMAGE', True) |
| 212 | link_name = d.getVar('IMAGE_LINK_NAME', True) | 213 | link_name = d.getVar('IMAGE_LINK_NAME', True) |
| 213 | manifest_name = d.getVar('IMAGE_MANIFEST', True) | 214 | manifest_name = d.getVar('IMAGE_MANIFEST', True) |
| 214 | 215 | ||
| 216 | pkgs = image_list_installed_packages(d) | ||
| 215 | with open(manifest_name, 'w+') as image_manifest: | 217 | with open(manifest_name, 'w+') as image_manifest: |
| 216 | image_manifest.write(image_list_installed_packages(d, 'ver')) | 218 | image_manifest.write(format_pkg_list(pkgs, "ver")) |
| 217 | image_manifest.write("\n") | 219 | image_manifest.write("\n") |
| 218 | 220 | ||
| 219 | if manifest_name is not None and os.path.exists(manifest_name): | 221 | if manifest_name is not None and os.path.exists(manifest_name): |
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() |
