summaryrefslogtreecommitdiffstats
path: root/pym
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2007-07-20 05:40:42 +0000
committerZac Medico <zmedico@gentoo.org>2007-07-20 05:40:42 +0000
commit203ec4fdc3ef654ba93eb5a6db912a031cbd3314 (patch)
tree94986cf513578a9a090bf1320eae1513bd0c577f /pym
parentb9deea61db6df0adfb5851c34abed8cb9f37e7ca (diff)
downloadportage-203ec4fdc3ef654ba93eb5a6db912a031cbd3314.tar.gz
portage-203ec4fdc3ef654ba93eb5a6db912a031cbd3314.tar.bz2
portage-203ec4fdc3ef654ba93eb5a6db912a031cbd3314.zip
If the fetcher reported success and the file is too small, don't attempt to resume. Upstream probably changed the distfile and we need to show a digest verification failure so the user gets a clue.
svn path=/main/trunk/; revision=7321
Diffstat (limited to 'pym')
-rw-r--r--pym/portage/__init__.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py
index 9b7553cb3..7764dcbe1 100644
--- a/pym/portage/__init__.py
+++ b/pym/portage/__init__.py
@@ -2840,7 +2840,7 @@ def fetch(myuris, mysettings, listonly=0, fetchonly=0, locks_in_subdir=".locks",
"gid" : portage_gid,
"groups" : userpriv_groups,
"umask" : 002})
-
+ myret = -1
try:
if mysettings.selinux_enabled():
@@ -2889,7 +2889,15 @@ def fetch(myuris, mysettings, listonly=0, fetchonly=0, locks_in_subdir=".locks",
else:
# no exception? file exists. let digestcheck() report
# an appropriately for size or checksum errors
- if (mystat[stat.ST_SIZE]<mydigests[myfile]["size"]):
+
+ # If the fetcher reported success and the file is
+ # too small, it's probably because the digest is
+ # bad (upstream changed the distfile). In this
+ # case we don't want to attempt to resume. Show a
+ # digest verification failure to that the user gets
+ # a clue about what just happened.
+ if myret != os.EX_OK and \
+ mystat.st_size < mydigests[myfile]["size"]:
# Fetch failed... Try the next one... Kill 404 files though.
if (mystat[stat.ST_SIZE]<100000) and (len(myfile)>4) and not ((myfile[-5:]==".html") or (myfile[-4:]==".htm")):
html404=re.compile("<title>.*(not found|404).*</title>",re.I|re.M)