diff options
author | Zac Medico <zmedico@gentoo.org> | 2007-11-03 21:40:12 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2007-11-03 21:40:12 +0000 |
commit | bfd48c851af13ffdbf2ecd0a8c5ff7888775da44 (patch) | |
tree | 571b7e559495029e62682681fb1a01b7f227246b | |
parent | a47bd144a31dc24fcc7810880edfb4e73782d92e (diff) | |
download | portage-bfd48c851af13ffdbf2ecd0a8c5ff7888775da44.tar.gz portage-bfd48c851af13ffdbf2ecd0a8c5ff7888775da44.tar.bz2 portage-bfd48c851af13ffdbf2ecd0a8c5ff7888775da44.zip |
Bug #197965 - Make fetch() bail out after 5 checksum
failures for a particular file since downloading the
same file repeatedly from every single available
mirror is a waste of bandwidth and time.
svn path=/main/trunk/; revision=8403
-rw-r--r-- | pym/portage/__init__.py | 12 |
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" |