summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2007-11-04 05:32:48 +0000
committerZac Medico <zmedico@gentoo.org>2007-11-04 05:32:48 +0000
commit0b8bd8b73d6bc2ef4a638168b5aa9e00b79db7d9 (patch)
tree258e7cb8f5be38d2c9cfbe66313450eab9a43689
parent2f7268fd1c390243d35efbea1a654368bbbc574f (diff)
downloadportage-0b8bd8b73d6bc2ef4a638168b5aa9e00b79db7d9.tar.gz
portage-0b8bd8b73d6bc2ef4a638168b5aa9e00b79db7d9.tar.bz2
portage-0b8bd8b73d6bc2ef4a638168b5aa9e00b79db7d9.zip
In fetch(), replace checksum_failure_counts dict with single
int counter. svn path=/main/trunk/; revision=8416
-rw-r--r--pym/portage/__init__.py14
1 files changed, 6 insertions, 8 deletions
diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py
index b3bd5f42c..8c84cd99a 100644
--- a/pym/portage/__init__.py
+++ b/pym/portage/__init__.py
@@ -2774,7 +2774,6 @@ def fetch(myuris, mysettings, listonly=0, fetchonly=0, locks_in_subdir=".locks",
# every single available mirror is a waste of bandwidth
# and time, so there needs to be a cap.
checksum_failure_max_tries = 5
- checksum_failure_counts = {}
# Behave like the package has RESTRICT="primaryuri" after a
# couple of checksum failures, to increase the probablility
# of success before checksum_failure_max_tries is reached.
@@ -3053,6 +3052,7 @@ def fetch(myuris, mysettings, listonly=0, fetchonly=0, locks_in_subdir=".locks",
# Create a reversed list since that is optimal for list.pop().
uri_list = filedict[myfile][:]
uri_list.reverse()
+ checksum_failure_count = 0
tried_locations = set()
while uri_list:
loc = uri_list.pop()
@@ -3227,11 +3227,9 @@ def fetch(myuris, mysettings, listonly=0, fetchonly=0, locks_in_subdir=".locks",
"File renamed to '%s'\n\n" % \
temp_filename, noiselevel=-1)
fetched=0
- count = checksum_failure_counts.get(myfile)
- if count is None:
- count = 0
- count += 1
- if count == checksum_failure_primaryuri:
+ checksum_failure_count += 1
+ if checksum_failure_count == \
+ checksum_failure_primaryuri:
# Switch to "primaryuri" mode in order
# to increase the probablility of
# of success.
@@ -3240,9 +3238,9 @@ def fetch(myuris, mysettings, listonly=0, fetchonly=0, locks_in_subdir=".locks",
if primaryuris:
uri_list.extend(
reversed(primaryuris))
- if count >= checksum_failure_max_tries:
+ if checksum_failure_count >= \
+ checksum_failure_max_tries:
break
- checksum_failure_counts[myfile] = count
else:
eout = portage.output.EOutput()
eout.quiet = mysettings.get("PORTAGE_QUIET", None) == "1"