summaryrefslogtreecommitdiffstats
path: root/meta/lib/oe/rootfs.py
diff options
context:
space:
mode:
authorHongxu Jia <hongxu.jia@windriver.com>2014-02-21 14:20:40 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-02-21 16:14:15 +0000
commit1d4462db62893f2707d896e1c6478b62a6142431 (patch)
tree2e066ec4ed257d0f9a050af740578d0a6da3b84f /meta/lib/oe/rootfs.py
parentaf9e8e9132954aa1013ae22355054c9dea4524b3 (diff)
downloadpoky-1d4462db62893f2707d896e1c6478b62a6142431.tar.gz
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] (From OE-Core rev: adf587e55c0f9bc74f0bef415273c937401baebb) Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oe/rootfs.py')
-rw-r--r--meta/lib/oe/rootfs.py50
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):
438 def __init__(self, d, manifest_dir): 438 def __init__(self, d, manifest_dir):
439 super(OpkgRootfs, self).__init__(d) 439 super(OpkgRootfs, self).__init__(d)
440 440
441 bb.utils.remove(self.image_rootfs, True)
442 bb.utils.remove(self.d.getVar('MULTILIB_TEMP_ROOTFS', True), True)
443 self.manifest = OpkgManifest(d, manifest_dir) 441 self.manifest = OpkgManifest(d, manifest_dir)
444 self.opkg_conf = self.d.getVar("IPKGCONF_TARGET", True) 442 self.opkg_conf = self.d.getVar("IPKGCONF_TARGET", True)
445 self.pkg_archs = self.d.getVar("ALL_MULTILIB_PACKAGE_ARCHS", True) 443 self.pkg_archs = self.d.getVar("ALL_MULTILIB_PACKAGE_ARCHS", True)
446 444
447 self.pm = OpkgPM(d, self.image_rootfs, self.opkg_conf, self.pkg_archs) 445 self.inc_opkg_image_gen = self.d.getVar('INC_IPK_IMAGE_GEN', True) or ""
446 if self.inc_opkg_image_gen != "1":
447 bb.utils.remove(self.image_rootfs, True)
448 self.pm = OpkgPM(d,
449 self.image_rootfs,
450 self.opkg_conf,
451 self.pkg_archs)
452 else:
453 self.pm = OpkgPM(d,
454 self.image_rootfs,
455 self.opkg_conf,
456 self.pkg_archs)
457 self.pm.recover_packaging_data()
458
459 bb.utils.remove(self.d.getVar('MULTILIB_TEMP_ROOTFS', True), True)
448 460
449 """ 461 """
450 This function was reused from the old implementation. 462 This function was reused from the old implementation.
@@ -508,6 +520,32 @@ class OpkgRootfs(Rootfs):
508 520
509 self._multilib_sanity_test(dirs) 521 self._multilib_sanity_test(dirs)
510 522
523 '''
524 While ipk incremental image generation is enabled, it will remove the
525 unneeded pkgs by comparing the old full manifest in previous existing
526 image and the new full manifest in the current image.
527 '''
528 def _remove_extra_packages(self, pkgs_initial_install):
529 if self.inc_opkg_image_gen == "1":
530 # Parse full manifest in previous existing image creation session
531 old_full_manifest = self.manifest.parse_full_manifest()
532
533 # Create full manifest for the current image session, the old one
534 # will be replaced by the new one.
535 self.manifest.create_full(self.pm)
536
537 # Parse full manifest in current image creation session
538 new_full_manifest = self.manifest.parse_full_manifest()
539
540 pkg_to_remove = list()
541 for pkg in old_full_manifest:
542 if pkg not in new_full_manifest:
543 pkg_to_remove.append(pkg)
544
545 if pkg_to_remove != []:
546 bb.note('decremental removed: %s' % ' '.join(pkg_to_remove))
547 self.pm.remove(pkg_to_remove)
548
511 def _create(self): 549 def _create(self):
512 pkgs_to_install = self.manifest.parse_initial_manifest() 550 pkgs_to_install = self.manifest.parse_initial_manifest()
513 opkg_pre_process_cmds = self.d.getVar('OPKG_PREPROCESS_COMMANDS', True) 551 opkg_pre_process_cmds = self.d.getVar('OPKG_PREPROCESS_COMMANDS', True)
@@ -524,6 +562,9 @@ class OpkgRootfs(Rootfs):
524 562
525 self.pm.handle_bad_recommendations() 563 self.pm.handle_bad_recommendations()
526 564
565 if self.inc_opkg_image_gen == "1":
566 self._remove_extra_packages(pkgs_to_install)
567
527 for pkg_type in self.install_order: 568 for pkg_type in self.install_order:
528 if pkg_type in pkgs_to_install: 569 if pkg_type in pkgs_to_install:
529 # For multilib, we perform a sanity test before final install 570 # For multilib, we perform a sanity test before final install
@@ -540,6 +581,9 @@ class OpkgRootfs(Rootfs):
540 execute_pre_post_process(self.d, opkg_post_process_cmds) 581 execute_pre_post_process(self.d, opkg_post_process_cmds)
541 execute_pre_post_process(self.d, rootfs_post_install_cmds) 582 execute_pre_post_process(self.d, rootfs_post_install_cmds)
542 583
584 if self.inc_opkg_image_gen == "1":
585 self.pm.backup_packaging_data()
586
543 def _get_delayed_postinsts(self): 587 def _get_delayed_postinsts(self):
544 pkg_list = [] 588 pkg_list = []
545 status_file = os.path.join(self.image_rootfs, 589 status_file = os.path.join(self.image_rootfs,