diff options
author | Hongxu Jia <hongxu.jia@windriver.com> | 2014-02-21 14:20:40 +0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2014-02-21 16:13:54 +0000 |
commit | adf587e55c0f9bc74f0bef415273c937401baebb (patch) | |
tree | 7b4f9f1f2cbf06a340ae905e937c2cbbdbada1ff /meta | |
parent | 5df18065e267a7e55a990ac3728414bb6e28a723 (diff) | |
download | openembedded-core-adf587e55c0f9bc74f0bef415273c937401baebb.tar.gz openembedded-core-adf587e55c0f9bc74f0bef415273c937401baebb.tar.bz2 openembedded-core-adf587e55c0f9bc74f0bef415273c937401baebb.zip |
rootfs.py: support ipk incremental image generation
The incremental image generation is based on the previous existing
image, adds new packages, upgrades existing packages, and removes unused
packages.
[YOCTO #1894]
Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
Diffstat (limited to 'meta')
-rw-r--r-- | meta/lib/oe/rootfs.py | 50 |
1 files changed, 47 insertions, 3 deletions
diff --git a/meta/lib/oe/rootfs.py b/meta/lib/oe/rootfs.py index 3bcb812e5f..e0f6cd8582 100644 --- a/meta/lib/oe/rootfs.py +++ b/meta/lib/oe/rootfs.py @@ -438,13 +438,25 @@ class OpkgRootfs(Rootfs): def __init__(self, d, manifest_dir): super(OpkgRootfs, self).__init__(d) - bb.utils.remove(self.image_rootfs, True) - bb.utils.remove(self.d.getVar('MULTILIB_TEMP_ROOTFS', True), True) self.manifest = OpkgManifest(d, manifest_dir) self.opkg_conf = self.d.getVar("IPKGCONF_TARGET", True) self.pkg_archs = self.d.getVar("ALL_MULTILIB_PACKAGE_ARCHS", True) - self.pm = OpkgPM(d, self.image_rootfs, self.opkg_conf, self.pkg_archs) + self.inc_opkg_image_gen = self.d.getVar('INC_IPK_IMAGE_GEN', True) or "" + if self.inc_opkg_image_gen != "1": + bb.utils.remove(self.image_rootfs, True) + self.pm = OpkgPM(d, + self.image_rootfs, + self.opkg_conf, + self.pkg_archs) + else: + self.pm = OpkgPM(d, + self.image_rootfs, + self.opkg_conf, + self.pkg_archs) + self.pm.recover_packaging_data() + + bb.utils.remove(self.d.getVar('MULTILIB_TEMP_ROOTFS', True), True) """ This function was reused from the old implementation. @@ -508,6 +520,32 @@ class OpkgRootfs(Rootfs): self._multilib_sanity_test(dirs) + ''' + While ipk incremental image generation is enabled, it will remove the + unneeded pkgs by comparing the old full manifest in previous existing + image and the new full manifest in the current image. + ''' + def _remove_extra_packages(self, pkgs_initial_install): + if self.inc_opkg_image_gen == "1": + # Parse full manifest in previous existing image creation session + old_full_manifest = self.manifest.parse_full_manifest() + + # Create full manifest for the current image session, the old one + # will be replaced by the new one. + self.manifest.create_full(self.pm) + + # Parse full manifest in current image creation session + new_full_manifest = self.manifest.parse_full_manifest() + + pkg_to_remove = list() + for pkg in old_full_manifest: + if pkg not in new_full_manifest: + pkg_to_remove.append(pkg) + + if pkg_to_remove != []: + bb.note('decremental removed: %s' % ' '.join(pkg_to_remove)) + self.pm.remove(pkg_to_remove) + def _create(self): pkgs_to_install = self.manifest.parse_initial_manifest() opkg_pre_process_cmds = self.d.getVar('OPKG_PREPROCESS_COMMANDS', True) @@ -524,6 +562,9 @@ class OpkgRootfs(Rootfs): self.pm.handle_bad_recommendations() + if self.inc_opkg_image_gen == "1": + self._remove_extra_packages(pkgs_to_install) + for pkg_type in self.install_order: if pkg_type in pkgs_to_install: # For multilib, we perform a sanity test before final install @@ -540,6 +581,9 @@ class OpkgRootfs(Rootfs): execute_pre_post_process(self.d, opkg_post_process_cmds) execute_pre_post_process(self.d, rootfs_post_install_cmds) + if self.inc_opkg_image_gen == "1": + self.pm.backup_packaging_data() + def _get_delayed_postinsts(self): pkg_list = [] status_file = os.path.join(self.image_rootfs, |