diff options
| author | Sebastian Heinlein <sebastian.heinlein@web.de> | 2006-03-30 17:46:30 +0200 |
|---|---|---|
| committer | Sebastian Heinlein <sebastian.heinlein@web.de> | 2006-03-30 17:46:30 +0200 |
| commit | 5a63844ce935b881165ea3e506a381786c6e2df9 (patch) | |
| tree | d8c65e4d2d8074b1d90f4d12eee47741757e0b48 /DistUpgrade/DistUpgradeControler.py | |
| parent | 3aa98f64592d44a6c65ad1bac11e03292c7deb39 (diff) | |
| parent | c4020d3179f287120da0c566cbae3a6034946637 (diff) | |
| download | python-apt-5a63844ce935b881165ea3e506a381786c6e2df9.tar.gz | |
merged from mvo
Diffstat (limited to 'DistUpgrade/DistUpgradeControler.py')
| -rw-r--r-- | DistUpgrade/DistUpgradeControler.py | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/DistUpgrade/DistUpgradeControler.py b/DistUpgrade/DistUpgradeControler.py index 6dcc0e2a..6ee2fb97 100644 --- a/DistUpgrade/DistUpgradeControler.py +++ b/DistUpgrade/DistUpgradeControler.py @@ -58,7 +58,6 @@ class DistUpgradeControler(object): def updateSourcesList(self): - self.sources = SourcesList() # this must map, i.e. second in "from" must be the second in "to" # (but they can be different, so in theory we could exchange @@ -157,7 +156,7 @@ class DistUpgradeControler(object): # FIXME: retry here too? just like the DoDistUpgrade? # also remove all files from the lists partial dir! currentRetry = 0 - maxRetries = self.config.get("Network","MaxRetries") + maxRetries = int(self.config.get("Network","MaxRetries")) while currentRetry < maxRetries: try: res = self.cache.update(progress) @@ -183,7 +182,7 @@ class DistUpgradeControler(object): # log the changes for debuging self._logChanges() # ask the user if he wants to do the changes - archivedir = apt_pkg.Config.FindDir("Dir::Cache::archives ") + archivedir = apt_pkg.Config.FindDir("Dir::Cache::archives") st = os.statvfs(archivedir) free = st[statvfs.F_BAVAIL]*st[statvfs.F_FRSIZE] if self.cache.requiredDownload > free: @@ -205,7 +204,7 @@ class DistUpgradeControler(object): fprogress = self._view.getFetchProgress() iprogress = self._view.getInstallProgress() # retry the fetching in case of errors - maxRetries = self.config.get("Network","MaxRetries") + maxRetries = int(self.config.get("Network","MaxRetries")) while currentRetry < maxRetries: try: res = self.cache.commit(fprogress,iprogress) @@ -213,9 +212,10 @@ class DistUpgradeControler(object): # installing the packages failed, can't be retried self._view.error(_("Could not install the upgrades"), _("The upgrade aborts now. Your system " - "can be in an unusable state. Please " - "try 'sudo apt-get install -f' or Synaptic " - "to fix your system."), "%s" % e) + "can be in an unusable state. A recovery " + "is now run (dpkg --configure -a)."), + "%s" % e) + self._view.getTerminal().call(["dpkg","--configure","-a"]) return False except IOError, e: # fetch failed, will be retried @@ -270,9 +270,12 @@ class DistUpgradeControler(object): # get changes changes = self.cache.getChanges() logging.debug("The following packages are remove candidates: %s" % " ".join([pkg.name for pkg in changes])) + summary = _("Remove obsolete packages?") + actions = [_("_Skip This Step"), _("_Remove")] + # FIXME Add an explanation about what obsolete pacages are + #explanation = _("") if len(changes) > 0 and \ - self._view.confirmChanges(_("Remove obsolete Packages?"), - changes, 0): + self._view.confirmChanges(summary, changes, 0, actions): fprogress = self._view.getFetchProgress() iprogress = self._view.getInstallProgress() try: @@ -295,13 +298,16 @@ class DistUpgradeControler(object): # sanity check (check for ubuntu-desktop, brokenCache etc) self._view.updateStatus(_("Checking package manager")) self._view.setStep(1) + self.openCache() - + self.sources = SourcesList() + if not self.cache.sanityCheck(self._view): abort(1) # run a "apt-get update" now - self.doUpdate() + if not self.doUpdate(): + self.abort() # do pre-upgrade stuff (calc list of obsolete pkgs etc) self.doPreUpdate() |
