summaryrefslogtreecommitdiff
path: root/DistUpgrade/DistUpgradeControler.py
diff options
context:
space:
mode:
authorSebastian Heinlein <sebastian.heinlein@web.de>2006-01-26 15:53:46 +0100
committerSebastian Heinlein <sebastian.heinlein@web.de>2006-01-26 15:53:46 +0100
commit5c7cce315d65d96a744c91d4cec10a3a135b3a51 (patch)
tree5a7507f50990b902dbed751bd5c055a52238277b /DistUpgrade/DistUpgradeControler.py
parent7e1b71667312232f492fe8288be6da68c4400e59 (diff)
parent52ba94d286981672f3b05c08911e19e633e48568 (diff)
downloadpython-apt-5c7cce315d65d96a744c91d4cec10a3a135b3a51.tar.gz
* merged from mvo
* remove the commented line about hiding the progress bar at the end of the installation. the full progress bar is importnat to indicate the end of the upgrade. so i don't see any need to perhaps uncomment this again in the future
Diffstat (limited to 'DistUpgrade/DistUpgradeControler.py')
-rw-r--r--DistUpgrade/DistUpgradeControler.py50
1 files changed, 37 insertions, 13 deletions
diff --git a/DistUpgrade/DistUpgradeControler.py b/DistUpgrade/DistUpgradeControler.py
index a0f5a642..229b7107 100644
--- a/DistUpgrade/DistUpgradeControler.py
+++ b/DistUpgrade/DistUpgradeControler.py
@@ -191,19 +191,42 @@ class DistUpgradeControler(object):
self.cache.requiredDownload)
return res
- def doDistUpgrade(self):
+ def doDistUpgrade(self, currentTry=0):
+ currentRetry = 0
fprogress = self._view.getFetchProgress()
iprogress = self._view.getInstallProgress()
- try:
- res = self.cache.commit(fprogress,iprogress)
- except (SystemError, IOError), e:
- self._view.error(_("Error during commit"),
- _("Some problem occured during the upgrade. "
- "This is mostly a network problem, please "
- "check the network and try again. "),
- "%s" % e)
- return False
- return True
+ # retry the fetching in case of errors
+ while currentRetry < 3:
+ try:
+ res = self.cache.commit(fprogress,iprogress)
+ except SystemError, e:
+ # installing the packages failed, can't be retried
+ self._view.error(_("Error during commit"),
+ _("Some problem occured during the upgrade. "
+ "Most likely packages failed to install. "
+ "Try 'sudo apt-get install -f' or synaptic "
+ "to fix your system."),
+ "%s" % e)
+ return False
+ except IOError, e:
+ # fetch failed, will be retried
+ logging.error("IOError in cache.commit(): '%s'. Retrying (currentTry: %s)" % (e,currentTry))
+ currentRetry += 1
+ continue
+ # no exception, so all was fine, we are done
+ return True
+
+ # maximum fetch-retries reached without a successful commit
+ logging.debug("giving up on fetching after maximum retries")
+ self._view.error(_("Error fetching the packages"),
+ _("Some problem occured during the fetching "
+ "of the packages. This is most likely a network "
+ "problem. Please check your network and try "
+ "again. "),
+ "%s" % e)
+ # abort here because we want our sources.list back
+ self.abort()
+
def doPostUpgrade(self):
@@ -282,11 +305,12 @@ class DistUpgradeControler(object):
self._view.updateStatus(_("Upgrading"))
if not self.doDistUpgrade():
- self.abort()
+ # don't abort here, because it would restore the sources.list
+ sys.exit(1)
# do post-upgrade stuff
self._view.setStep(4)
- self._view.updateStatus(_("Searching for obsolete software"))
+ self._view.updateStatus(_("Searching for obsolete software"))
self.doPostUpgrade()
# done, ask for reboot