From d516fad5be413aa965b241f136d0e8f701fc83fd Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Mon, 25 Jun 2007 03:14:42 +0000 Subject: [PATCH] Allow emerge --fetchonly to continue downloading other packages after a download from a binhost fails. (trunk r6709) svn path=/main/branches/2.1.2/; revision=7021 --- bin/emerge | 29 ++++++++++++++++++++++++++--- pym/portage.py | 3 ++- 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/bin/emerge b/bin/emerge index 67bf8db2a..289d992e5 100755 --- a/bin/emerge +++ b/bin/emerge @@ -48,6 +48,7 @@ import portage_locks import portage_exception from portage_data import secpass from portage_util import normalize_path as normpath +from portage_util import writemsg if not hasattr(__builtins__, "set"): from sets import Set as set @@ -2954,6 +2955,8 @@ class MergeTask(object): def merge(self, mylist, favorites, mtimedb): failed_fetches = [] + fetchonly = "--fetchonly" in self.myopts or \ + "--fetch-all-uri" in self.myopts mymergelist=[] ldpath_mtimes = mtimedb["ldpath"] xterm_titles = "notitles" not in self.settings.features @@ -3250,9 +3253,29 @@ class MergeTask(object): short_msg = "emerge: (%s of %s) %s Fetch" % \ (mergecount, len(mymergelist), pkg_key) emergelog(xterm_titles, msg, short_msg=short_msg) - if not self.trees[myroot]["bintree"].gettbz2( - pkg_key): - return 1 + try: + self.trees[myroot]["bintree"].gettbz2(pkg_key) + except portage_exception.FileNotFound: + writemsg("!!! Fetching Binary failed " + \ + "for '%s'\n" % pkg_key, noiselevel=-1) + if not fetchonly: + return 1 + failed_fetches.append(pkg_key) + except portage_exception.DigestException, e: + writemsg("\n!!! Digest verification failed:\n", + noiselevel=-1) + writemsg("!!! %s\n" % e.value[0], + noiselevel=-1) + writemsg("!!! Reason: %s\n" % e.value[1], + noiselevel=-1) + writemsg("!!! Got: %s\n" % e.value[2], + noiselevel=-1) + writemsg("!!! Expected: %s\n" % e.value[3], + noiselevel=-1) + os.unlink(mytbz2) + if not fetchonly: + return 1 + failed_fetches.append(pkg_key) finally: if tbz2_lock: portage_locks.unlockfile(tbz2_lock) diff --git a/pym/portage.py b/pym/portage.py index 9307ce8be..2a1c1c6ca 100644 --- a/pym/portage.py +++ b/pym/portage.py @@ -6827,7 +6827,8 @@ class binarytree(object): fcmd = self.settings.get(fcmd_prefix + "_" + protocol.upper()) if not fcmd: fcmd = self.settings.get(fcmd_prefix) - return getbinpkg.file_get(url, mydest, fcmd=fcmd) + if not getbinpkg.file_get(url, mydest, fcmd=fcmd): + raise portage_exception.FileNotFound(tbz2_path) def getslot(self,mycatpkg): "Get a slot for a catpkg; assume it exists." -- 2.26.2