summaryrefslogtreecommitdiff
path: root/meta/lib/oe/rootfs.py
diff options
context:
space:
mode:
authorHongxu Jia <hongxu.jia@windriver.com>2014-02-21 14:21:36 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-02-21 16:13:55 +0000
commit0566de3fa424af3bdfadcd0a08ce4c214abda083 (patch)
tree9b18aeae3f92c8ba11008a59ca2b520ad0f0d731 /meta/lib/oe/rootfs.py
parentadf587e55c0f9bc74f0bef415273c937401baebb (diff)
downloadopenembedded-core-0566de3fa424af3bdfadcd0a08ce4c214abda083.tar.gz
openembedded-core-0566de3fa424af3bdfadcd0a08ce4c214abda083.tar.bz2
openembedded-core-0566de3fa424af3bdfadcd0a08ce4c214abda083.zip
rootfs.py: support BAD_RECOMMENDATIONS for ipk incremental image generation
While incremental image generation enabled and the previous image is existed, if BAD_RECOMMENDATIONS is changed, the operation on the existing image is complicated, so remove the old image in this situation. The same with PACKAGE_EXCLUDE and NO_RECOMMENDATIONS. [YOCTO #1894] Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
Diffstat (limited to 'meta/lib/oe/rootfs.py')
-rw-r--r--meta/lib/oe/rootfs.py29
1 files changed, 28 insertions, 1 deletions
diff --git a/meta/lib/oe/rootfs.py b/meta/lib/oe/rootfs.py
index e0f6cd8582..78e9627682 100644
--- a/meta/lib/oe/rootfs.py
+++ b/meta/lib/oe/rootfs.py
@@ -443,7 +443,7 @@ class OpkgRootfs(Rootfs):
self.pkg_archs = self.d.getVar("ALL_MULTILIB_PACKAGE_ARCHS", True)
self.inc_opkg_image_gen = self.d.getVar('INC_IPK_IMAGE_GEN', True) or ""
- if self.inc_opkg_image_gen != "1":
+ if self._remove_old_rootfs():
bb.utils.remove(self.image_rootfs, True)
self.pm = OpkgPM(d,
self.image_rootfs,
@@ -546,6 +546,33 @@ class OpkgRootfs(Rootfs):
bb.note('decremental removed: %s' % ' '.join(pkg_to_remove))
self.pm.remove(pkg_to_remove)
+ '''
+ Compare with previous existing image creation, if some conditions
+ triggered, the previous old image should be removed.
+ The conditions include any of 'PACKAGE_EXCLUDE, NO_RECOMMENDATIONS
+ and BAD_RECOMMENDATIONS' has been changed.
+ '''
+ def _remove_old_rootfs(self):
+ if self.inc_opkg_image_gen != "1":
+ return True
+
+ vars_list_file = self.d.expand('${T}/vars_list')
+
+ old_vars_list = ""
+ if os.path.exists(vars_list_file):
+ old_vars_list = open(vars_list_file, 'r+').read()
+
+ new_vars_list = '%s:%s:%s\n' % \
+ ((self.d.getVar('BAD_RECOMMENDATIONS', True) or '').strip(),
+ (self.d.getVar('NO_RECOMMENDATIONS', True) or '').strip(),
+ (self.d.getVar('PACKAGE_EXCLUDE', True) or '').strip())
+ open(vars_list_file, 'w+').write(new_vars_list)
+
+ if old_vars_list != new_vars_list:
+ return True
+
+ return False
+
def _create(self):
pkgs_to_install = self.manifest.parse_initial_manifest()
opkg_pre_process_cmds = self.d.getVar('OPKG_PREPROCESS_COMMANDS', True)