diff options
| -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 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): | |||
| 225 | def mirror_from_string(data): | 225 | def 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 | ||
| 228 | def removefile(f): | ||
| 229 | try: | ||
| 230 | os.remove(f) | ||
| 231 | except: | ||
| 232 | pass | ||
| 233 | |||
| 228 | def go(d, urls = None): | 234 | def 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 | ||
