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-06-21 13:10:33 +0100
commit20649e95ede723feb8c766bc2f76bc6ce2fd1500 (patch)
tree4485393bd9b26c7066179203d38eb6f6601ba869 /bitbake
parent3f441765a7f6c229c5f4cd4edc0d6d8a34da2d11 (diff)
downloadpoky-20649e95ede723feb8c766bc2f76bc6ce2fd1500.tar.gz
poky-20649e95ede723feb8c766bc2f76bc6ce2fd1500.tar.bz2
poky-20649e95ede723feb8c766bc2f76bc6ce2fd1500.zip
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 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):
else:
logger.debug(1, "Fetcher accessed the network with the command %s" % info)
+def build_mirroruris(origud, mirrors, ld):
+ uris = []
+ uds = []
+
+ def adduri(uri, ud, uris, uds):
+ for line in mirrors:
+ try:
+ (find, replace) = line
+ except ValueError:
+ continue
+ newuri = uri_replace(ud, find, replace, ld)
+ if not newuri or newuri in uris or newuri == origud.url:
+ continue
+ uris.append(newuri)
+ newud = FetchData(newuri, ld)
+ newud.setup_localpath(ld)
+ uds.append(newud)
+
+ adduri(newuri, newud, uris, uds)
+
+ adduri(None, origud, uris, uds)
+
+ return uris, uds
+
def try_mirror_url(newuri, origud, ud, ld, check = False):
# Return of None or a value means we're finished
# False means try another url
@@ -529,18 +553,11 @@ def try_mirrors(d, origud, mirrors, check = False):
mirrors is the list of mirrors we're going to try
"""
ld = d.createCopy()
- for line in mirrors:
- try:
- (find, replace) = line
- except ValueError:
- continue
- newuri = uri_replace(origud, find, replace, ld)
- if not newuri:
- continue
- ud = FetchData(newuri, ld)
- ud.setup_localpath(ld)
-
- ret = try_mirror_url(newuri, origud, ud, ld, check)
+
+ uris, uds = build_mirroruris(origud, mirrors, ld)
+
+ for index, uri in enumerate(uris):
+ ret = try_mirror_url(uri, origud, uds[index], ld, check)
if ret != False:
return ret
return None