summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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):
443 self.pkg_archs = self.d.getVar("ALL_MULTILIB_PACKAGE_ARCHS", True) 443 self.pkg_archs = self.d.getVar("ALL_MULTILIB_PACKAGE_ARCHS", True)
444 444
445 self.inc_opkg_image_gen = self.d.getVar('INC_IPK_IMAGE_GEN', True) or "" 445 self.inc_opkg_image_gen = self.d.getVar('INC_IPK_IMAGE_GEN', True) or ""
446 if self.inc_opkg_image_gen != "1": 446 if self._remove_old_rootfs():
447 bb.utils.remove(self.image_rootfs, True) 447 bb.utils.remove(self.image_rootfs, True)
448 self.pm = OpkgPM(d, 448 self.pm = OpkgPM(d,
449 self.image_rootfs, 449 self.image_rootfs,
@@ -546,6 +546,33 @@ class OpkgRootfs(Rootfs):
546 bb.note('decremental removed: %s' % ' '.join(pkg_to_remove)) 546 bb.note('decremental removed: %s' % ' '.join(pkg_to_remove))
547 self.pm.remove(pkg_to_remove) 547 self.pm.remove(pkg_to_remove)
548 548
549 '''
550 Compare with previous existing image creation, if some conditions
551 triggered, the previous old image should be removed.
552 The conditions include any of 'PACKAGE_EXCLUDE, NO_RECOMMENDATIONS
553 and BAD_RECOMMENDATIONS' has been changed.
554 '''
555 def _remove_old_rootfs(self):
556 if self.inc_opkg_image_gen != "1":
557 return True
558
559 vars_list_file = self.d.expand('${T}/vars_list')
560
561 old_vars_list = ""
562 if os.path.exists(vars_list_file):
563 old_vars_list = open(vars_list_file, 'r+').read()
564
565 new_vars_list = '%s:%s:%s\n' % \
566 ((self.d.getVar('BAD_RECOMMENDATIONS', True) or '').strip(),
567 (self.d.getVar('NO_RECOMMENDATIONS', True) or '').strip(),
568 (self.d.getVar('PACKAGE_EXCLUDE', True) or '').strip())
569 open(vars_list_file, 'w+').write(new_vars_list)
570
571 if old_vars_list != new_vars_list:
572 return True
573
574 return False
575
549 def _create(self): 576 def _create(self):
550 pkgs_to_install = self.manifest.parse_initial_manifest() 577 pkgs_to_install = self.manifest.parse_initial_manifest()
551 opkg_pre_process_cmds = self.d.getVar('OPKG_PREPROCESS_COMMANDS', True) 578 opkg_pre_process_cmds = self.d.getVar('OPKG_PREPROCESS_COMMANDS', True)