bitbake/fetch: When fetchers return errors, ensure any partial download is cleared
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
This commit is contained in:
parent
ab718b337c
commit
c5fab99a6f
|
@ -225,6 +225,12 @@ def init(urls, d, setup = True):
|
||||||
def mirror_from_string(data):
|
def mirror_from_string(data):
|
||||||
return [ i.split() for i in (data or "").replace('\\n','\n').split('\n') if i ]
|
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):
|
def go(d, urls = None):
|
||||||
"""
|
"""
|
||||||
Fetch all urls
|
Fetch all urls
|
||||||
|
@ -258,6 +264,8 @@ def go(d, urls = None):
|
||||||
m.go(u, ud, d)
|
m.go(u, ud, d)
|
||||||
localpath = ud.localpath
|
localpath = ud.localpath
|
||||||
except FetchError:
|
except FetchError:
|
||||||
|
# Remove any incomplete file
|
||||||
|
removefile(ud.localpath)
|
||||||
# Finally, try fetching uri, u, from MIRRORS
|
# Finally, try fetching uri, u, from MIRRORS
|
||||||
mirrors = mirror_from_string(bb.data.getVar('MIRRORS', d, True))
|
mirrors = mirror_from_string(bb.data.getVar('MIRRORS', d, True))
|
||||||
localpath = try_mirrors (d, u, mirrors)
|
localpath = try_mirrors (d, u, mirrors)
|
||||||
|
@ -470,6 +478,7 @@ def try_mirrors(d, uri, mirrors, check = False, force = False):
|
||||||
import sys
|
import sys
|
||||||
(type, value, traceback) = sys.exc_info()
|
(type, value, traceback) = sys.exc_info()
|
||||||
bb.msg.debug(2, bb.msg.domain.Fetcher, "Mirror fetch failure: %s" % value)
|
bb.msg.debug(2, bb.msg.domain.Fetcher, "Mirror fetch failure: %s" % value)
|
||||||
|
removefile(ud.localpath)
|
||||||
continue
|
continue
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue