diff options
| author | Sebastian Heinlein <sebi@sebi-pc> | 2006-09-29 18:12:51 +0200 |
|---|---|---|
| committer | Sebastian Heinlein <sebi@sebi-pc> | 2006-09-29 18:12:51 +0200 |
| commit | f33d8b5f4a283ef5394cc90d2d605448ed959d24 (patch) | |
| tree | 05d20b738ad00a5952a60c95732b3f883731461d /DistUpgrade/DistUpgradeCache.py | |
| parent | b9dffe7bcfab1807249821bacb8b39e83d20d5eb (diff) | |
| parent | 7afafc629b7c5b408972aafc46ef5d1887544aac (diff) | |
| download | python-apt-f33d8b5f4a283ef5394cc90d2d605448ed959d24.tar.gz | |
* merge with mvo
Diffstat (limited to 'DistUpgrade/DistUpgradeCache.py')
| -rw-r--r-- | DistUpgrade/DistUpgradeCache.py | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/DistUpgrade/DistUpgradeCache.py b/DistUpgrade/DistUpgradeCache.py index 8427bb3d..318c30cd 100644 --- a/DistUpgrade/DistUpgradeCache.py +++ b/DistUpgrade/DistUpgradeCache.py @@ -111,6 +111,39 @@ 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, reason): + if (self.has_key(pkgname) + and self[pkgname].isInstalled + and self[pkgname].markedDelete): + self.markInstall(pkgname, reason) + + # first the global list + for pkgname in self.config.getlist("Distro","KeepInstalledPkgs"): + 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, "%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, 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 + self[key].markedInstall): + for section in self.config.getlist(key,"KeepInstalledSection"): + for pkg in self: + if pkg.markedDelete and pkg.section == section: + keepInstalled(self, pkg.name, "%s KeepInstalledSection rule: %s" % (key, section)) + + def postUpgradeRule(self): " run after the upgrade was done in the cache " for (rule, action) in [("Install", self.markInstall), @@ -149,6 +182,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() |
