diff options
| -rw-r--r-- | bitbake/lib/bb/fetch2/__init__.py | 41 |
1 files changed, 29 insertions, 12 deletions
diff --git a/bitbake/lib/bb/fetch2/__init__.py b/bitbake/lib/bb/fetch2/__init__.py index 737ae7ed8f..78adce2f29 100644 --- a/bitbake/lib/bb/fetch2/__init__.py +++ b/bitbake/lib/bb/fetch2/__init__.py | |||
| @@ -464,6 +464,30 @@ def check_network_access(d, info = "", url = None): | |||
| 464 | else: | 464 | else: |
| 465 | logger.debug(1, "Fetcher accessed the network with the command %s" % info) | 465 | logger.debug(1, "Fetcher accessed the network with the command %s" % info) |
| 466 | 466 | ||
| 467 | def build_mirroruris(origud, mirrors, ld): | ||
| 468 | uris = [] | ||
| 469 | uds = [] | ||
| 470 | |||
| 471 | def adduri(uri, ud, uris, uds): | ||
| 472 | for line in mirrors: | ||
| 473 | try: | ||
| 474 | (find, replace) = line | ||
| 475 | except ValueError: | ||
| 476 | continue | ||
| 477 | newuri = uri_replace(ud, find, replace, ld) | ||
| 478 | if not newuri or newuri in uris or newuri == origud.url: | ||
| 479 | continue | ||
| 480 | uris.append(newuri) | ||
| 481 | newud = FetchData(newuri, ld) | ||
| 482 | newud.setup_localpath(ld) | ||
| 483 | uds.append(newud) | ||
| 484 | |||
| 485 | adduri(newuri, newud, uris, uds) | ||
| 486 | |||
| 487 | adduri(None, origud, uris, uds) | ||
| 488 | |||
| 489 | return uris, uds | ||
| 490 | |||
| 467 | def try_mirror_url(newuri, origud, ud, ld, check = False): | 491 | def try_mirror_url(newuri, origud, ud, ld, check = False): |
| 468 | # Return of None or a value means we're finished | 492 | # Return of None or a value means we're finished |
| 469 | # False means try another url | 493 | # False means try another url |
| @@ -529,18 +553,11 @@ def try_mirrors(d, origud, mirrors, check = False): | |||
| 529 | mirrors is the list of mirrors we're going to try | 553 | mirrors is the list of mirrors we're going to try |
| 530 | """ | 554 | """ |
| 531 | ld = d.createCopy() | 555 | ld = d.createCopy() |
| 532 | for line in mirrors: | 556 | |
| 533 | try: | 557 | uris, uds = build_mirroruris(origud, mirrors, ld) |
| 534 | (find, replace) = line | 558 | |
| 535 | except ValueError: | 559 | for index, uri in enumerate(uris): |
| 536 | continue | 560 | ret = try_mirror_url(uri, origud, uds[index], ld, check) |
| 537 | newuri = uri_replace(origud, find, replace, ld) | ||
| 538 | if not newuri: | ||
| 539 | continue | ||
| 540 | ud = FetchData(newuri, ld) | ||
| 541 | ud.setup_localpath(ld) | ||
| 542 | |||
| 543 | ret = try_mirror_url(newuri, origud, ud, ld, check) | ||
| 544 | if ret != False: | 561 | if ret != False: |
| 545 | return ret | 562 | return ret |
| 546 | return None | 563 | return None |
