If the fetcher reported success and the file is too small, don't attempt to resume...
authorZac Medico <zmedico@gentoo.org>
Mon, 30 Jul 2007 06:50:13 +0000 (06:50 -0000)
committerZac Medico <zmedico@gentoo.org>
Mon, 30 Jul 2007 06:50:13 +0000 (06:50 -0000)
svn path=/main/branches/2.1.2.9/; revision=7501

pym/portage.py

index e8c079d066e95bfef6ceac9ea2ae08835a8549cc..3f21c75323f014881091c0f2400683f57a1c4e15 100644 (file)
@@ -2645,7 +2645,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():
@@ -2694,7 +2694,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)