From 2bb600a579cd8fec3887593b3a26e26a4b06b13b Mon Sep 17 00:00:00 2001 From: Mark Hatle Date: Thu, 10 Sep 2015 18:15:27 -0500 Subject: bitbake: tests/fetch.py: Fix recursion failure in url mapping Instead of reproducessing the same line over and over and over, we remove the current line from the mirror list. This permits us to re-evaluate the list while excluding all matches that have previousily occured. Without this fix, adding this test results in a failure: RuntimeError: maximum recursion depth exceeded in cmp (Bitbake rev: 24a8e9a5b0ba145ae589178d74365c986ebca325) Signed-off-by: Mark Hatle Signed-off-by: Richard Purdie --- bitbake/lib/bb/fetch2/__init__.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'bitbake/lib/bb/fetch2/__init__.py') diff --git a/bitbake/lib/bb/fetch2/__init__.py b/bitbake/lib/bb/fetch2/__init__.py index 569007fdb8..288a1c8fd0 100644 --- a/bitbake/lib/bb/fetch2/__init__.py +++ b/bitbake/lib/bb/fetch2/__init__.py @@ -862,7 +862,7 @@ def build_mirroruris(origud, mirrors, ld): replacements["BASENAME"] = origud.path.split("/")[-1] replacements["MIRRORNAME"] = origud.host.replace(':','.') + origud.path.replace('/', '.').replace('*', '.') - def adduri(ud, uris, uds): + def adduri(ud, uris, uds, mirrors): for line in mirrors: try: (find, replace) = line @@ -876,6 +876,12 @@ def build_mirroruris(origud, mirrors, ld): logger.debug(1, "Mirror %s not in the list of trusted networks, skipping" % (newuri)) continue + # Create a local copy of the mirrors minus the current line + # this will prevent us from recursively processing the same line + # as well as indirect recursion A -> B -> C -> A + localmirrors = list(mirrors) + localmirrors.remove(line) + try: newud = FetchData(newuri, ld) newud.setup_localpath(ld) @@ -885,16 +891,16 @@ def build_mirroruris(origud, mirrors, ld): try: # setup_localpath of file:// urls may fail, we should still see # if mirrors of the url exist - adduri(newud, uris, uds) + adduri(newud, uris, uds, localmirrors) except UnboundLocalError: pass continue uris.append(newuri) uds.append(newud) - adduri(newud, uris, uds) + adduri(newud, uris, uds, localmirrors) - adduri(origud, uris, uds) + adduri(origud, uris, uds, mirrors) return uris, uds -- cgit v1.2.3-54-g00ecf