summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2012-06-20 12:49:39 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-08-21 11:35:08 +0100
commit1162729c791839b151194df43ae1273f364c01fa (patch)
tree5b678160615a01d8f51dcfdb56379bddf758b9d8 /bitbake
parent4591963649d862366c19451f9f7ded496fdef4e3 (diff)
downloadpoky-1162729c791839b151194df43ae1273f364c01fa.tar.gz
bitbake: fetch2: Improve mirror looping to consider more cases
Currently we only consider one pass through the mirror list. This doesn't catch cases where for example you might want to setup a mirror of a mirror and allow multiple redirection. There is no reason we can't support this and the patch loops through the list recursively now. As a safeguard, it will stop if any duplicate urls are found, hence avoiding circular dependency looping. (From Poky rev: 0ec0a4412865e54495c07beea1ced8355da58073) (Bitbake rev: e585730e931e6abdb15ba8a3849c5fd22845b891) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/lib/bb/fetch2/__init__.py41
1 files changed, 29 insertions, 12 deletions
diff --git a/bitbake/lib/bb/fetch2/__init__.py b/bitbake/lib/bb/fetch2/__init__.py
index 405f07469b..13341a894a 100644
--- a/bitbake/lib/bb/fetch2/__init__.py
+++ b/bitbake/lib/bb/fetch2/__init__.py
@@ -449,6 +449,30 @@ def check_network_access(d, info = "", url = None):
449 else: 449 else:
450 logger.debug(1, "Fetcher accessed the network with the command %s" % info) 450 logger.debug(1, "Fetcher accessed the network with the command %s" % info)
451 451
452def build_mirroruris(origud, mirrors, ld):
453 uris = []
454 uds = []
455
456 def adduri(uri, ud, uris, uds):
457 for line in mirrors:
458 try:
459 (find, replace) = line
460 except ValueError:
461 continue
462 newuri = uri_replace(ud, find, replace, ld)
463 if not newuri or newuri in uris or newuri == origud.url:
464 continue
465 uris.append(newuri)
466 newud = FetchData(newuri, ld)
467 newud.setup_localpath(ld)
468 uds.append(newud)
469
470 adduri(newuri, newud, uris, uds)
471
472 adduri(None, origud, uris, uds)
473
474 return uris, uds
475
452def try_mirror_url(newuri, origud, ud, ld, check = False): 476def try_mirror_url(newuri, origud, ud, ld, check = False):
453 # Return of None or a value means we're finished 477 # Return of None or a value means we're finished
454 # False means try another url 478 # False means try another url
@@ -514,18 +538,11 @@ def try_mirrors(d, origud, mirrors, check = False):
514 mirrors is the list of mirrors we're going to try 538 mirrors is the list of mirrors we're going to try
515 """ 539 """
516 ld = d.createCopy() 540 ld = d.createCopy()
517 for line in mirrors: 541
518 try: 542 uris, uds = build_mirroruris(origud, mirrors, ld)
519 (find, replace) = line 543
520 except ValueError: 544 for index, uri in enumerate(uris):
521 continue 545 ret = try_mirror_url(uri, origud, uds[index], ld, check)
522 newuri = uri_replace(origud, find, replace, ld)
523 if not newuri:
524 continue
525 ud = FetchData(newuri, ld)
526 ud.setup_localpath(ld)
527
528 ret = try_mirror_url(newuri, origud, ud, ld, check)
529 if ret != False: 546 if ret != False:
530 return ret 547 return ret
531 return None 548 return None