bitbake: fetch2: Add fetch parameter to checkstatus
In order to pass connection cache object to checkstatus function add fetch parameter. (Bitbake rev: fbb9c6f5538084e125b58118a86968908e6f895b) Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
parent
bf6c21c38b
commit
f9ea480e6c
|
@ -907,12 +907,12 @@ def rename_bad_checksum(ud, suffix):
|
||||||
bb.utils.movefile(ud.localpath, new_localpath)
|
bb.utils.movefile(ud.localpath, new_localpath)
|
||||||
|
|
||||||
|
|
||||||
def try_mirror_url(origud, ud, ld, check = False):
|
def try_mirror_url(fetch, origud, ud, ld, check = False):
|
||||||
# Return of None or a value means we're finished
|
# Return of None or a value means we're finished
|
||||||
# False means try another url
|
# False means try another url
|
||||||
try:
|
try:
|
||||||
if check:
|
if check:
|
||||||
found = ud.method.checkstatus(ud, ld)
|
found = ud.method.checkstatus(fetch, ud, ld)
|
||||||
if found:
|
if found:
|
||||||
return found
|
return found
|
||||||
return False
|
return False
|
||||||
|
@ -975,7 +975,7 @@ def try_mirror_url(origud, ud, ld, check = False):
|
||||||
pass
|
pass
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def try_mirrors(d, origud, mirrors, check = False):
|
def try_mirrors(fetch, d, origud, mirrors, check = False):
|
||||||
"""
|
"""
|
||||||
Try to use a mirrored version of the sources.
|
Try to use a mirrored version of the sources.
|
||||||
This method will be automatically called before the fetchers go.
|
This method will be automatically called before the fetchers go.
|
||||||
|
@ -989,7 +989,7 @@ def try_mirrors(d, origud, mirrors, check = False):
|
||||||
uris, uds = build_mirroruris(origud, mirrors, ld)
|
uris, uds = build_mirroruris(origud, mirrors, ld)
|
||||||
|
|
||||||
for index, uri in enumerate(uris):
|
for index, uri in enumerate(uris):
|
||||||
ret = try_mirror_url(origud, uds[index], ld, check)
|
ret = try_mirror_url(fetch, origud, uds[index], ld, check)
|
||||||
if ret != False:
|
if ret != False:
|
||||||
return ret
|
return ret
|
||||||
return None
|
return None
|
||||||
|
@ -1473,7 +1473,7 @@ class FetchMethod(object):
|
||||||
"""
|
"""
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def checkstatus(self, urldata, d):
|
def checkstatus(self, fetch, urldata, d):
|
||||||
"""
|
"""
|
||||||
Check the status of a URL
|
Check the status of a URL
|
||||||
Assumes localpath was called first
|
Assumes localpath was called first
|
||||||
|
@ -1577,7 +1577,7 @@ class Fetch(object):
|
||||||
elif m.try_premirror(ud, self.d):
|
elif m.try_premirror(ud, self.d):
|
||||||
logger.debug(1, "Trying PREMIRRORS")
|
logger.debug(1, "Trying PREMIRRORS")
|
||||||
mirrors = mirror_from_string(self.d.getVar('PREMIRRORS', True))
|
mirrors = mirror_from_string(self.d.getVar('PREMIRRORS', True))
|
||||||
localpath = try_mirrors(self.d, ud, mirrors, False)
|
localpath = try_mirrors(self, self.d, ud, mirrors, False)
|
||||||
|
|
||||||
if premirroronly:
|
if premirroronly:
|
||||||
self.d.setVar("BB_NO_NETWORK", "1")
|
self.d.setVar("BB_NO_NETWORK", "1")
|
||||||
|
@ -1616,7 +1616,7 @@ class Fetch(object):
|
||||||
m.clean(ud, self.d)
|
m.clean(ud, self.d)
|
||||||
logger.debug(1, "Trying MIRRORS")
|
logger.debug(1, "Trying MIRRORS")
|
||||||
mirrors = mirror_from_string(self.d.getVar('MIRRORS', True))
|
mirrors = mirror_from_string(self.d.getVar('MIRRORS', True))
|
||||||
localpath = try_mirrors (self.d, ud, mirrors)
|
localpath = try_mirrors(self, self.d, ud, mirrors)
|
||||||
|
|
||||||
if not localpath or ((not os.path.exists(localpath)) and localpath.find("*") == -1):
|
if not localpath or ((not os.path.exists(localpath)) and localpath.find("*") == -1):
|
||||||
if firsterr:
|
if firsterr:
|
||||||
|
@ -1648,15 +1648,15 @@ class Fetch(object):
|
||||||
logger.debug(1, "Testing URL %s", u)
|
logger.debug(1, "Testing URL %s", u)
|
||||||
# First try checking uri, u, from PREMIRRORS
|
# First try checking uri, u, from PREMIRRORS
|
||||||
mirrors = mirror_from_string(self.d.getVar('PREMIRRORS', True))
|
mirrors = mirror_from_string(self.d.getVar('PREMIRRORS', True))
|
||||||
ret = try_mirrors(self.d, ud, mirrors, True)
|
ret = try_mirrors(self, self.d, ud, mirrors, True)
|
||||||
if not ret:
|
if not ret:
|
||||||
# Next try checking from the original uri, u
|
# Next try checking from the original uri, u
|
||||||
try:
|
try:
|
||||||
ret = m.checkstatus(ud, self.d)
|
ret = m.checkstatus(self, ud, self.d)
|
||||||
except:
|
except:
|
||||||
# Finally, try checking uri, u, from MIRRORS
|
# Finally, try checking uri, u, from MIRRORS
|
||||||
mirrors = mirror_from_string(self.d.getVar('MIRRORS', True))
|
mirrors = mirror_from_string(self.d.getVar('MIRRORS', True))
|
||||||
ret = try_mirrors(self.d, ud, mirrors, True)
|
ret = try_mirrors(self, self.d, ud, mirrors, True)
|
||||||
|
|
||||||
if not ret:
|
if not ret:
|
||||||
raise FetchError("URL %s doesn't work" % u, u)
|
raise FetchError("URL %s doesn't work" % u, u)
|
||||||
|
|
|
@ -423,7 +423,7 @@ class Git(FetchMethod):
|
||||||
else:
|
else:
|
||||||
return True, str(rev)
|
return True, str(rev)
|
||||||
|
|
||||||
def checkstatus(self, ud, d):
|
def checkstatus(self, fetch, ud, d):
|
||||||
try:
|
try:
|
||||||
self._lsremote(ud, d, "")
|
self._lsremote(ud, d, "")
|
||||||
return True
|
return True
|
||||||
|
|
|
@ -112,7 +112,7 @@ class Local(FetchMethod):
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def checkstatus(self, urldata, d):
|
def checkstatus(self, fetch, urldata, d):
|
||||||
"""
|
"""
|
||||||
Check the status of the url
|
Check the status of the url
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -100,7 +100,7 @@ class Wget(FetchMethod):
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def checkstatus(self, ud, d):
|
def checkstatus(self, fetch, ud, d):
|
||||||
|
|
||||||
uri = ud.url.split(";")[0]
|
uri = ud.url.split(";")[0]
|
||||||
fetchcmd = self.basecmd + " --spider '%s'" % uri
|
fetchcmd = self.basecmd + " --spider '%s'" % uri
|
||||||
|
|
Loading…
Reference in New Issue