diff options
| -rw-r--r-- | bitbake/lib/bb/fetch2/__init__.py | 14 | ||||
| -rw-r--r-- | bitbake/lib/bb/tests/fetch.py | 7 |
2 files changed, 15 insertions, 6 deletions
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): | |||
| 862 | replacements["BASENAME"] = origud.path.split("/")[-1] | 862 | replacements["BASENAME"] = origud.path.split("/")[-1] |
| 863 | replacements["MIRRORNAME"] = origud.host.replace(':','.') + origud.path.replace('/', '.').replace('*', '.') | 863 | replacements["MIRRORNAME"] = origud.host.replace(':','.') + origud.path.replace('/', '.').replace('*', '.') |
| 864 | 864 | ||
| 865 | def adduri(ud, uris, uds): | 865 | def adduri(ud, uris, uds, mirrors): |
| 866 | for line in mirrors: | 866 | for line in mirrors: |
| 867 | try: | 867 | try: |
| 868 | (find, replace) = line | 868 | (find, replace) = line |
| @@ -876,6 +876,12 @@ def build_mirroruris(origud, mirrors, ld): | |||
| 876 | logger.debug(1, "Mirror %s not in the list of trusted networks, skipping" % (newuri)) | 876 | logger.debug(1, "Mirror %s not in the list of trusted networks, skipping" % (newuri)) |
| 877 | continue | 877 | continue |
| 878 | 878 | ||
| 879 | # Create a local copy of the mirrors minus the current line | ||
| 880 | # this will prevent us from recursively processing the same line | ||
| 881 | # as well as indirect recursion A -> B -> C -> A | ||
| 882 | localmirrors = list(mirrors) | ||
| 883 | localmirrors.remove(line) | ||
| 884 | |||
| 879 | try: | 885 | try: |
| 880 | newud = FetchData(newuri, ld) | 886 | newud = FetchData(newuri, ld) |
| 881 | newud.setup_localpath(ld) | 887 | newud.setup_localpath(ld) |
| @@ -885,16 +891,16 @@ def build_mirroruris(origud, mirrors, ld): | |||
| 885 | try: | 891 | try: |
| 886 | # setup_localpath of file:// urls may fail, we should still see | 892 | # setup_localpath of file:// urls may fail, we should still see |
| 887 | # if mirrors of the url exist | 893 | # if mirrors of the url exist |
| 888 | adduri(newud, uris, uds) | 894 | adduri(newud, uris, uds, localmirrors) |
| 889 | except UnboundLocalError: | 895 | except UnboundLocalError: |
| 890 | pass | 896 | pass |
| 891 | continue | 897 | continue |
| 892 | uris.append(newuri) | 898 | uris.append(newuri) |
| 893 | uds.append(newud) | 899 | uds.append(newud) |
| 894 | 900 | ||
| 895 | adduri(newud, uris, uds) | 901 | adduri(newud, uris, uds, localmirrors) |
| 896 | 902 | ||
| 897 | adduri(origud, uris, uds) | 903 | adduri(origud, uris, uds, mirrors) |
| 898 | 904 | ||
| 899 | return uris, uds | 905 | return uris, uds |
| 900 | 906 | ||
diff --git a/bitbake/lib/bb/tests/fetch.py b/bitbake/lib/bb/tests/fetch.py index 84862247e0..94173c14a8 100644 --- a/bitbake/lib/bb/tests/fetch.py +++ b/bitbake/lib/bb/tests/fetch.py | |||
| @@ -405,13 +405,16 @@ class MirrorUriTest(FetcherTest): | |||
| 405 | 'http://otherdownloads.yoctoproject.org/downloads/bitbake-1.0.tar.gz', | 405 | 'http://otherdownloads.yoctoproject.org/downloads/bitbake-1.0.tar.gz', |
| 406 | 'http://downloads2.yoctoproject.org/downloads/bitbake-1.0.tar.gz']) | 406 | 'http://downloads2.yoctoproject.org/downloads/bitbake-1.0.tar.gz']) |
| 407 | 407 | ||
| 408 | recmirrorvar = "https://.*/[^/]* http://AAAA/A/A/A/ \n" | 408 | recmirrorvar = "https://.*/[^/]* http://AAAA/A/A/A/ \n" \ |
| 409 | "https://.*/[^/]* https://BBBB/B/B/B/ \n" | ||
| 409 | 410 | ||
| 410 | def test_recursive(self): | 411 | def test_recursive(self): |
| 411 | fetcher = bb.fetch.FetchData("https://downloads.yoctoproject.org/releases/bitbake/bitbake-1.0.tar.gz", self.d) | 412 | fetcher = bb.fetch.FetchData("https://downloads.yoctoproject.org/releases/bitbake/bitbake-1.0.tar.gz", self.d) |
| 412 | mirrors = bb.fetch2.mirror_from_string(self.recmirrorvar) | 413 | mirrors = bb.fetch2.mirror_from_string(self.recmirrorvar) |
| 413 | uris, uds = bb.fetch2.build_mirroruris(fetcher, mirrors, self.d) | 414 | uris, uds = bb.fetch2.build_mirroruris(fetcher, mirrors, self.d) |
| 414 | self.assertEqual(uris, ['http://AAAA/A/A/A/bitbake/bitbake-1.0.tar.gz']) | 415 | self.assertEqual(uris, ['http://AAAA/A/A/A/bitbake/bitbake-1.0.tar.gz', |
| 416 | 'https://BBBB/B/B/B/bitbake/bitbake-1.0.tar.gz', | ||
| 417 | 'http://AAAA/A/A/A/B/B/bitbake/bitbake-1.0.tar.gz']) | ||
| 415 | 418 | ||
| 416 | class FetcherLocalTest(FetcherTest): | 419 | class FetcherLocalTest(FetcherTest): |
| 417 | def setUp(self): | 420 | def setUp(self): |
