diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2014-01-21 09:58:21 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2014-01-27 11:14:44 +0000 |
commit | 9a4855bc7fea2a3d7fd72b86abb1a1411cc00333 (patch) | |
tree | f7ad77f14eba7138094ec0a5d9a0a8b8ecf5f931 /bitbake | |
parent | 1a9226f140f578f11696abf1a3c989fae1d4c14a (diff) | |
download | poky-9a4855bc7fea2a3d7fd72b86abb1a1411cc00333.tar.gz |
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>
Diffstat (limited to 'bitbake')
-rw-r--r-- | bitbake/lib/bb/fetch2/wget.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/bitbake/lib/bb/fetch2/wget.py b/bitbake/lib/bb/fetch2/wget.py index 00732019ed..7cd25a508c 100644 --- a/bitbake/lib/bb/fetch2/wget.py +++ b/bitbake/lib/bb/fetch2/wget.py | |||
@@ -91,6 +91,10 @@ class Wget(FetchMethod): | |||
91 | if not os.path.exists(ud.localpath) and not checkonly: | 91 | if not os.path.exists(ud.localpath) and not checkonly: |
92 | raise FetchError("The fetch command returned success for url %s but %s doesn't exist?!" % (uri, ud.localpath), uri) | 92 | raise FetchError("The fetch command returned success for url %s but %s doesn't exist?!" % (uri, ud.localpath), uri) |
93 | 93 | ||
94 | if not checkonly and os.path.getsize(ud.localpath) == 0: | ||
95 | os.remove(ud.localpath) | ||
96 | raise FetchError("The fetch of %s resulted in a zero size file?! Deleting and failing since this isn't right." % (uri), uri) | ||
97 | |||
94 | return True | 98 | return True |
95 | 99 | ||
96 | def checkstatus(self, ud, d): | 100 | def checkstatus(self, ud, d): |