From b7c39558155861ae5807e35cc3b6ba932a207c36 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Tue, 26 Sep 2006 21:50:03 +0200 Subject: * DistUpgrade/DistUpgrade.cfg: - new KeepInstalledPkgs keyword * DistUpgrade/DistUpgradeCache.py: - implemented keepInstaledRule() --- DistUpgrade/DistUpgradeCache.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'DistUpgrade/DistUpgradeCache.py') diff --git a/DistUpgrade/DistUpgradeCache.py b/DistUpgrade/DistUpgradeCache.py index 8427bb3d..190a17b9 100644 --- a/DistUpgrade/DistUpgradeCache.py +++ b/DistUpgrade/DistUpgradeCache.py @@ -111,6 +111,28 @@ class MyCache(apt.Cache): if self.has_key(pkg): self._depcache.MarkDelete(self[pkg]._pkg,True) + def keepInstalledRule(self): + """ run after the dist-upgrade to ensure that certain + packages are kept installed """ + def keepInstalled(self, pkgname): + if (self.has_key(pkgname) + and self[pkgname].isInstalled + and self[pkgname].markedDelete): + self[pkgname].markInstall() + # first the global list + for pkgname in self.config.getlist("Distro","KeepInstalledPkgs"): + keepInstalled(self, pkgname) + # the the per-metapkg rules + for key in self.metapkgs: + if self.has_key(key) and (self[key].isInstalled or + self[key].markedInstall): + for pkgname in self.config.getlist(key,"KeepInstalledPkgs"): + keepInstalled(self, pkgname) + + + + + def postUpgradeRule(self): " run after the upgrade was done in the cache " for (rule, action) in [("Install", self.markInstall), @@ -149,6 +171,9 @@ class MyCache(apt.Cache): if not self._installMetaPkgs(view): raise SystemError, _("Can't upgrade required meta-packages") + # see if our KeepInstalled rules are honored + self.keepInstalledRule() + # and if we have some special rules self.postUpgradeRule() -- cgit v1.2.3 From e4113f9d48f57c82a7b012a8784ca0b1e4a1d230 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Tue, 26 Sep 2006 21:53:00 +0200 Subject: * DistUpgrade/DistUpgradeCache.py: - implemented "KeepInstalledSection" --- DistUpgrade/DistUpgradeCache.py | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'DistUpgrade/DistUpgradeCache.py') diff --git a/DistUpgrade/DistUpgradeCache.py b/DistUpgrade/DistUpgradeCache.py index 190a17b9..1d5fad53 100644 --- a/DistUpgrade/DistUpgradeCache.py +++ b/DistUpgrade/DistUpgradeCache.py @@ -119,6 +119,7 @@ class MyCache(apt.Cache): and self[pkgname].isInstalled and self[pkgname].markedDelete): self[pkgname].markInstall() + # first the global list for pkgname in self.config.getlist("Distro","KeepInstalledPkgs"): keepInstalled(self, pkgname) @@ -128,9 +129,19 @@ class MyCache(apt.Cache): self[key].markedInstall): for pkgname in self.config.getlist(key,"KeepInstalledPkgs"): keepInstalled(self, pkgname) - - - + # now the keepInstalledSection code + for section in self.config.getlist("Distro","KeepInstalledSection"): + for pkg in self: + if pkg.markedDelete and pkg.section == section: + keepInstalled(self, pkgname) + # the the per-metapkg rules + for key in self.metapkgs: + if self.has_key(key) and (self[key].isInstalled or + self[key].markedInstall): + for section in self.config.getlist(key,"KeepInstalledSection"): + for pkg in self: + if pkg.markedDelete and pkg.section == section: + keepInstalled(self, pkgname) def postUpgradeRule(self): -- cgit v1.2.3 From 8a6925c34753aa87dea38a5b12ea6f80d2d369e5 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Tue, 26 Sep 2006 22:01:05 +0200 Subject: * DistUpgrade/DistUpgradeCache.py: - added logging for the KeepInstaleld rules --- DistUpgrade/Changelog | 2 ++ DistUpgrade/DistUpgradeCache.py | 12 ++++++------ 2 files changed, 8 insertions(+), 6 deletions(-) (limited to 'DistUpgrade/DistUpgradeCache.py') diff --git a/DistUpgrade/Changelog b/DistUpgrade/Changelog index a7e39c88..4e358b0c 100644 --- a/DistUpgrade/Changelog +++ b/DistUpgrade/Changelog @@ -4,6 +4,8 @@ (see #54234 for the rationale) - updated demotions.cfg for dapper->edgy - special case the packages affected by the Breaks changes + - make sure that no translations get lost during the upgrade + (thanks to mdz for pointing this out) - bugfixes 2006-09-23: - support fetching backports of selected packages first and diff --git a/DistUpgrade/DistUpgradeCache.py b/DistUpgrade/DistUpgradeCache.py index 1d5fad53..00c0013b 100644 --- a/DistUpgrade/DistUpgradeCache.py +++ b/DistUpgrade/DistUpgradeCache.py @@ -114,26 +114,26 @@ class MyCache(apt.Cache): def keepInstalledRule(self): """ run after the dist-upgrade to ensure that certain packages are kept installed """ - def keepInstalled(self, pkgname): + def keepInstalled(self, pkgname, reason): if (self.has_key(pkgname) and self[pkgname].isInstalled and self[pkgname].markedDelete): - self[pkgname].markInstall() + self.markInstall(pkgname, reason) # first the global list for pkgname in self.config.getlist("Distro","KeepInstalledPkgs"): - keepInstalled(self, pkgname) + keepInstalled(self, pkgname, "Distro KeepInstalledPkgs rule") # the the per-metapkg rules for key in self.metapkgs: if self.has_key(key) and (self[key].isInstalled or self[key].markedInstall): for pkgname in self.config.getlist(key,"KeepInstalledPkgs"): - keepInstalled(self, pkgname) + keepInstalled(self, pkgname, "%s KeepInstalledPkgs rule" % key) # now the keepInstalledSection code for section in self.config.getlist("Distro","KeepInstalledSection"): for pkg in self: if pkg.markedDelete and pkg.section == section: - keepInstalled(self, pkgname) + keepInstalled(self, pkgname, "Distro KeepInstalledSection rule: %s" % section) # the the per-metapkg rules for key in self.metapkgs: if self.has_key(key) and (self[key].isInstalled or @@ -141,7 +141,7 @@ class MyCache(apt.Cache): for section in self.config.getlist(key,"KeepInstalledSection"): for pkg in self: if pkg.markedDelete and pkg.section == section: - keepInstalled(self, pkgname) + keepInstalled(self, pkgname, "%s KeepInstalledSection rule: %s" % (key, section)) def postUpgradeRule(self): -- cgit v1.2.3 From e709c67d58ddd99b11f8e6e466dca487a844a880 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Tue, 26 Sep 2006 22:13:19 +0200 Subject: * DistUpgrade/DistUpgradeCache.py: - use the right packagename when doing the KeepInstalledSection --- DistUpgrade/DistUpgradeCache.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'DistUpgrade/DistUpgradeCache.py') diff --git a/DistUpgrade/DistUpgradeCache.py b/DistUpgrade/DistUpgradeCache.py index 00c0013b..318c30cd 100644 --- a/DistUpgrade/DistUpgradeCache.py +++ b/DistUpgrade/DistUpgradeCache.py @@ -133,7 +133,7 @@ class MyCache(apt.Cache): for section in self.config.getlist("Distro","KeepInstalledSection"): for pkg in self: if pkg.markedDelete and pkg.section == section: - keepInstalled(self, pkgname, "Distro KeepInstalledSection rule: %s" % section) + keepInstalled(self, pkg.name, "Distro KeepInstalledSection rule: %s" % section) # the the per-metapkg rules for key in self.metapkgs: if self.has_key(key) and (self[key].isInstalled or @@ -141,7 +141,7 @@ class MyCache(apt.Cache): for section in self.config.getlist(key,"KeepInstalledSection"): for pkg in self: if pkg.markedDelete and pkg.section == section: - keepInstalled(self, pkgname, "%s KeepInstalledSection rule: %s" % (key, section)) + keepInstalled(self, pkg.name, "%s KeepInstalledSection rule: %s" % (key, section)) def postUpgradeRule(self): -- cgit v1.2.3