diff options
author | Richard Purdie <rpurdie@linux.intel.com> | 2010-10-23 00:22:54 +0100 |
---|---|---|
committer | Richard Purdie <rpurdie@linux.intel.com> | 2010-10-23 00:22:54 +0100 |
commit | c5fab99a6f979a4a0ce246c6395b35a3082aec0d (patch) | |
tree | 5a413d18a3290c5966ad7e1e0519c2bfaff1cffd /bitbake/lib/bb/fetch | |
parent | ab718b337c767e277c2e38183f99e61998610b67 (diff) | |
download | openembedded-core-c5fab99a6f979a4a0ce246c6395b35a3082aec0d.tar.gz openembedded-core-c5fab99a6f979a4a0ce246c6395b35a3082aec0d.tar.bz2 openembedded-core-c5fab99a6f979a4a0ce246c6395b35a3082aec0d.tar.xz openembedded-core-c5fab99a6f979a4a0ce246c6395b35a3082aec0d.zip |
bitbake/fetch: When fetchers return errors, ensure any partial download is cleared
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
Diffstat (limited to 'bitbake/lib/bb/fetch')
-rw-r--r-- | bitbake/lib/bb/fetch/__init__.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/bitbake/lib/bb/fetch/__init__.py b/bitbake/lib/bb/fetch/__init__.py index 9e425cb78..8cf44d88f 100644 --- a/bitbake/lib/bb/fetch/__init__.py +++ b/bitbake/lib/bb/fetch/__init__.py @@ -225,6 +225,12 @@ def init(urls, d, setup = True): def mirror_from_string(data): return [ i.split() for i in (data or "").replace('\\n','\n').split('\n') if i ] +def removefile(f): + try: + os.remove(f) + except: + pass + def go(d, urls = None): """ Fetch all urls @@ -258,6 +264,8 @@ def go(d, urls = None): m.go(u, ud, d) localpath = ud.localpath except FetchError: + # Remove any incomplete file + removefile(ud.localpath) # Finally, try fetching uri, u, from MIRRORS mirrors = mirror_from_string(bb.data.getVar('MIRRORS', d, True)) localpath = try_mirrors (d, u, mirrors) @@ -470,6 +478,7 @@ def try_mirrors(d, uri, mirrors, check = False, force = False): import sys (type, value, traceback) = sys.exc_info() bb.msg.debug(2, bb.msg.domain.Fetcher, "Mirror fetch failure: %s" % value) + removefile(ud.localpath) continue return None |