summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/lib/bb')
-rw-r--r--bitbake/lib/bb/fetch/__init__.py22
1 files changed, 18 insertions, 4 deletions
diff --git a/bitbake/lib/bb/fetch/__init__.py b/bitbake/lib/bb/fetch/__init__.py
index 58fa41b4dc..4b1203d605 100644
--- a/bitbake/lib/bb/fetch/__init__.py
+++ b/bitbake/lib/bb/fetch/__init__.py
@@ -219,7 +219,18 @@ def checkstatus(d):
219 ud = urldata[u] 219 ud = urldata[u]
220 m = ud.method 220 m = ud.method
221 bb.msg.note(1, bb.msg.domain.Fetcher, "Testing URL %s" % u) 221 bb.msg.note(1, bb.msg.domain.Fetcher, "Testing URL %s" % u)
222 ret = m.checkstatus(u, ud, d) 222 # First try checking uri, u, from PREMIRRORS
223 mirrors = [ i.split() for i in (bb.data.getVar('PREMIRRORS', d, 1) or "").split('\n') if i ]
224 ret = try_mirrors(d, u, mirrors, True)
225 if not ret:
226 # Next try checking from the original uri, u
227 try:
228 ret = m.checkstatus(u, ud, d)
229 except:
230 # Finally, try checking uri, u, from MIRRORS
231 mirrors = [ i.split() for i in (bb.data.getVar('MIRRORS', d, 1) or "").split('\n') if i ]
232 ret = try_mirrors (d, u, mirrors, True)
233
223 if not ret: 234 if not ret:
224 bb.msg.fatal(bb.msg.domain.Fetcher, "URL %s doesn't work" % u) 235 bb.msg.fatal(bb.msg.domain.Fetcher, "URL %s doesn't work" % u)
225 236
@@ -348,7 +359,7 @@ def runfetchcmd(cmd, d, quiet = False):
348 359
349 return output 360 return output
350 361
351def try_mirrors(d, uri, mirrors): 362def try_mirrors(d, uri, mirrors, check = False):
352 """ 363 """
353 Try to use a mirrored version of the sources. 364 Try to use a mirrored version of the sources.
354 This method will be automatically called before the fetchers go. 365 This method will be automatically called before the fetchers go.
@@ -358,7 +369,7 @@ def try_mirrors(d, uri, mirrors):
358 mirrors is the list of mirrors we're going to try 369 mirrors is the list of mirrors we're going to try
359 """ 370 """
360 fpath = os.path.join(data.getVar("DL_DIR", d, 1), os.path.basename(uri)) 371 fpath = os.path.join(data.getVar("DL_DIR", d, 1), os.path.basename(uri))
361 if os.access(fpath, os.R_OK): 372 if not check and os.access.path(fpath, os.R_OK):
362 bb.msg.debug(1, bb.msg.domain.Fetcher, "%s already exists, skipping checkout." % fpath) 373 bb.msg.debug(1, bb.msg.domain.Fetcher, "%s already exists, skipping checkout." % fpath)
363 return fpath 374 return fpath
364 375
@@ -375,7 +386,10 @@ def try_mirrors(d, uri, mirrors):
375 ud.setup_localpath(ld) 386 ud.setup_localpath(ld)
376 387
377 try: 388 try:
378 ud.method.go(newuri, ud, ld) 389 if check:
390 ud.method.go(newuri, ud, ld)
391 else:
392 ud.method.checkstatus(newuri, ud, ld)
379 return ud.localpath 393 return ud.localpath
380 except (bb.fetch.MissingParameterError, 394 except (bb.fetch.MissingParameterError,
381 bb.fetch.FetchError, 395 bb.fetch.FetchError,