bitbake: fetch2/wget: Check downloaded file isn't zero size

I can't think of a reason we'd download zero sized files however there are
reasons zero length files can accidently make it onto source mirrors.

This check allows us to ignore the broken files and switch to another
mirror rather than fail with odd checksum failures.

(Bitbake rev: 300cba2e1a720dba4b83b0c76208ea93c608c1de)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Richard Purdie 2014-01-21 09:58:21 +00:00
parent 1a9226f140
commit 9a4855bc7f
1 changed files with 4 additions and 0 deletions

View File

@ -91,6 +91,10 @@ class Wget(FetchMethod):
if not os.path.exists(ud.localpath) and not checkonly:
raise FetchError("The fetch command returned success for url %s but %s doesn't exist?!" % (uri, ud.localpath), uri)
if not checkonly and os.path.getsize(ud.localpath) == 0:
os.remove(ud.localpath)
raise FetchError("The fetch of %s resulted in a zero size file?! Deleting and failing since this isn't right." % (uri), uri)
return True
def checkstatus(self, ud, d):