summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorRichard Purdie <rpurdie@linux.intel.com>2010-10-23 00:22:54 +0100
committerRichard Purdie <rpurdie@linux.intel.com>2010-10-23 00:22:54 +0100
commitc5fab99a6f979a4a0ce246c6395b35a3082aec0d (patch)
tree5a413d18a3290c5966ad7e1e0519c2bfaff1cffd /bitbake
parentab718b337c767e277c2e38183f99e61998610b67 (diff)
downloadpoky-c5fab99a6f979a4a0ce246c6395b35a3082aec0d.tar.gz
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')
-rw-r--r--bitbake/lib/bb/fetch/__init__.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/bitbake/lib/bb/fetch/__init__.py b/bitbake/lib/bb/fetch/__init__.py
index 9e425cb785..8cf44d88f4 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):
225def mirror_from_string(data): 225def mirror_from_string(data):
226 return [ i.split() for i in (data or "").replace('\\n','\n').split('\n') if i ] 226 return [ i.split() for i in (data or "").replace('\\n','\n').split('\n') if i ]
227 227
228def removefile(f):
229 try:
230 os.remove(f)
231 except:
232 pass
233
228def go(d, urls = None): 234def go(d, urls = None):
229 """ 235 """
230 Fetch all urls 236 Fetch all urls
@@ -258,6 +264,8 @@ def go(d, urls = None):
258 m.go(u, ud, d) 264 m.go(u, ud, d)
259 localpath = ud.localpath 265 localpath = ud.localpath
260 except FetchError: 266 except FetchError:
267 # Remove any incomplete file
268 removefile(ud.localpath)
261 # Finally, try fetching uri, u, from MIRRORS 269 # Finally, try fetching uri, u, from MIRRORS
262 mirrors = mirror_from_string(bb.data.getVar('MIRRORS', d, True)) 270 mirrors = mirror_from_string(bb.data.getVar('MIRRORS', d, True))
263 localpath = try_mirrors (d, u, mirrors) 271 localpath = try_mirrors (d, u, mirrors)
@@ -470,6 +478,7 @@ def try_mirrors(d, uri, mirrors, check = False, force = False):
470 import sys 478 import sys
471 (type, value, traceback) = sys.exc_info() 479 (type, value, traceback) = sys.exc_info()
472 bb.msg.debug(2, bb.msg.domain.Fetcher, "Mirror fetch failure: %s" % value) 480 bb.msg.debug(2, bb.msg.domain.Fetcher, "Mirror fetch failure: %s" % value)
481 removefile(ud.localpath)
473 continue 482 continue
474 return None 483 return None
475 484