diff options
| author | Michael Vogt <michael.vogt@ubuntu.com> | 2006-02-06 14:21:36 +0100 |
|---|---|---|
| committer | Michael Vogt <michael.vogt@ubuntu.com> | 2006-02-06 14:21:36 +0100 |
| commit | e8b68ea2858f439e93b36a1fb320ea4243790159 (patch) | |
| tree | 6dd16d4dc5d1d85e6da27c1fbc9ac9e83b4a2150 /DistUpgrade | |
| parent | d5021367c09c22f7ab6296bbec5f159ee0ab0dda (diff) | |
| download | python-apt-e8b68ea2858f439e93b36a1fb320ea4243790159.tar.gz | |
* added a "PostUpgrade{Install,Remove,Purge}" rule, removed the ForcedPurges and superseed it with the new rule
Diffstat (limited to 'DistUpgrade')
| -rw-r--r-- | DistUpgrade/DistUpgrade.cfg | 8 | ||||
| -rw-r--r-- | DistUpgrade/DistUpgradeCache.py | 30 | ||||
| -rw-r--r-- | DistUpgrade/DistUpgradeControler.py | 11 | ||||
| -rw-r--r-- | DistUpgrade/README | 32 |
4 files changed, 68 insertions, 13 deletions
diff --git a/DistUpgrade/DistUpgrade.cfg b/DistUpgrade/DistUpgrade.cfg index e081313a..a2720f49 100644 --- a/DistUpgrade/DistUpgrade.cfg +++ b/DistUpgrade/DistUpgrade.cfg @@ -7,15 +7,17 @@ View=DistUpgradeViewGtk # the meta-pkgs we support MetaPkgs=ubuntu-desktop, kubuntu-desktop, edubuntu-desktop, xubuntu-desktop BaseMetaPkgs=ubuntu-base -ForcedPurges=xorg-common +PostUpgradePurge=xorg-common # information about the individual meta-pkgs [ubuntu-desktop] KeyDependencies=gdm, gnome-panel, ubuntu-artwork -ForcedObsoletes=xscreensaver +# those pkgs will be marked remove right after the distUpgrade in the cache +PostUpgradeRemove=xchat, xscreensaver [kubuntu-desktop] KeyDependencies=kdm, kicker, kubuntu-artwork-usplash +# those packages are marked as obsolete right after the upgrade ForcedObsoletes=ivman [edubuntu-desktop] @@ -32,7 +34,7 @@ BackupExt=distUpgrade From=breezy To=dapper ValidOrigin=Ubuntu -ValidMirrors = http://archive.ubuntu.com/ubuntu, http://security.ubuntu.com/ubuntu, http://archive.distrosprint/ubuntu/ +ValidMirrors = http://archive.ubuntu.com/ubuntu, http://security.ubuntu.com/ubuntu [Network] MaxRetries=3
\ No newline at end of file diff --git a/DistUpgrade/DistUpgradeCache.py b/DistUpgrade/DistUpgradeCache.py index 6826e3ba..b20c9f77 100644 --- a/DistUpgrade/DistUpgradeCache.py +++ b/DistUpgrade/DistUpgradeCache.py @@ -15,6 +15,7 @@ class MyCache(apt.Cache): self.to_remove = [] self.config = DistUpgradeConfig() + self.metapkgs = self.config.getlist("Distro","MetaPkgs") # turn on debuging apt_pkg.Config.Set("Debug::pkgProblemResolver","true") @@ -97,10 +98,38 @@ class MyCache(apt.Cache): return False return True + def markInstall(self, pkg, reason=""): + logging.debug("Installing '%s' (%s)" % (pkg, reason)) + if self.has_key(pkg): + self[pkg].markInstall() + def markRemove(self, pkg, reason=""): + logging.debug("Removing '%s' (%s)" % (pkg, reason)) + if self.has_key(pkg): + self[pkg].markDelete() + def markPurge(self, pkg, reason=""): + logging.debug("Purging '%s' (%s)" % (pkg, reason)) + if self.has_key(pkg): + self._depcache.MarkDelete(self[pkg]._pkg,True) + + def postUpgradeRule(self): + " run after the upgrade was done in the cache " + for (rule, action) in [("Install", self.markInstall), + ("Remove", self.markRemove), + ("Purge", self.markPurge)]: + # first the global list + for pkg in self.config.getlist("Distro","PostUpgrade%s" % rule): + action(pkg, "Distro PostUpgrade%s rule" % rule) + for key in self.metapkgs: + if self.has_key(key) and self[key].isInstalled: + for pkg in self.config.getlist(key,"PostUpgrade%s" % rule): + action(pkg, "%s PostUpgrade%s rule" % (key, rule)) + def distUpgrade(self, view): try: # upgrade (and make sure this way that the cache is ok) self.upgrade(True) + self.postUpgradeRule() + if not self._installMetaPkgs(view): raise SystemError, _("Can't upgrade required meta-packages") if not self._verifyChanges(): @@ -176,6 +205,7 @@ class MyCache(apt.Cache): for key in metapkgs: try: if self.has_key(key) and self[key].isInstalled: + logging.debug("Marking '%s' for upgrade" % key) self[key].markUpgrade() except SystemError, e: logging.debug("Can't mark '%s' for upgrade" % key) diff --git a/DistUpgrade/DistUpgradeControler.py b/DistUpgrade/DistUpgradeControler.py index 71127092..9fa717fe 100644 --- a/DistUpgrade/DistUpgradeControler.py +++ b/DistUpgrade/DistUpgradeControler.py @@ -52,8 +52,6 @@ class DistUpgradeControler(object): # forced obsoletes self.forced_obsoletes = self.config.getlist("Distro","ForcedObsoletes") - # forced purges - self.forced_purges = self.config.getlist("Distro","ForcedPurges") def openCache(self): self.cache = MyCache(self._view.getOpCacheProgress()) @@ -251,9 +249,8 @@ class DistUpgradeControler(object): for pkg in self.config.getlist("Distro","MetaPkgs"): if self.cache.has_key(pkg) and self.cache[pkg].isInstalled: self.forced_obsoletes.extend(self.config.getlist(pkg,"ForcedObsoletes")) - self.forced_purges.extend(self.config.getlist(pkg,"ForcedPurges")) logging.debug("forced_obsoletes: %s", self.forced_obsoletes) - logging.debug("forced_purges: %s", self.forced_purges) + # mark packages that are now obsolete (and where not obsolete @@ -269,12 +266,6 @@ class DistUpgradeControler(object): logging.debug("'%s' scheduled for remove but not in remove_candiates, skipping", pkgname) logging.debug("Finish checking for obsolete pkgs") - # mark some stuff for purge - for pkg in self.forced_purges: - if self.cache.has_key(pkg): - logging.debug("Marking '%s' for purge", pkg) - self.cache._depcache.MarkDelete(self.cache[pkg]._pkg,True) - # get changes changes = self.cache.getChanges() logging.debug("The following packages are remove candidates: %s" % " ".join([pkg.name for pkg in changes])) diff --git a/DistUpgrade/README b/DistUpgrade/README new file mode 100644 index 00000000..28684985 --- /dev/null +++ b/DistUpgrade/README @@ -0,0 +1,32 @@ +The DistUpgrade.cfg format is based on the python ConfigParser. + +It supports the following sections: + +[View] - controls the output + +[Distro] - global distribution specfic options +BaseMetaPkgs: + the basic meta-pkgs that must be installed (ubuntu-base usually) +MetaPkgs: + packages that define a "desktop" (e.g. ubuntu-desktop) +PostUpgrade{Install,Remove,Purge}: + action right after the upgrade was calculated in the cache (marking + happens *before* the cache.commit()) +ForcedObsoletes: + Obsolete packages that the user is asked about after the upgrade (marking + happens *after* the cache.commit()) + +[$meta-pkg] +KeyDependencies: + Dependencies that are considered "key" dependencies of the meta-pkg to + detect if it was installed but later removed by the user +PostUpgrade{Install,Remove,Purge}: + s.above +ForcedObsoletes: + s.above + +[Files] - file specific stuff + +[Sources] - how to rewrite the sources.list + +[Network] - network specific options
\ No newline at end of file |
