summaryrefslogtreecommitdiffstats
path: root/pym
diff options
context:
space:
mode:
Diffstat (limited to 'pym')
-rw-r--r--pym/portage/__init__.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py
index 3597fa3f8..079848221 100644
--- a/pym/portage/__init__.py
+++ b/pym/portage/__init__.py
@@ -2770,6 +2770,11 @@ def fetch(myuris, mysettings, listonly=0, fetchonly=0, locks_in_subdir=".locks",
print ">>> \"mirror\" mode desired and \"mirror\" restriction found; skipping fetch."
return 1
+ # Generally, downloading the same file repeatedly from
+ # 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 = {}
thirdpartymirrors = mysettings.thirdpartymirrors()
check_config_instance(mysettings)
@@ -3202,6 +3207,13 @@ 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_max_tries:
+ break
+ checksum_failure_counts[myfile] = count
else:
eout = portage.output.EOutput()
eout.quiet = mysettings.get("PORTAGE_QUIET", None) == "1"