@@ -525,8 +525,7 @@ class MirrorUriTest(FetcherTest):
mirrorvar = "http://.*/.* file:///somepath/downloads/ " \
"git://someserver.org/bitbake git://git.openembedded.org/bitbake " \
- "https://.*/.* file:///someotherpath/downloads/ " \
- "http://.*/.* file:///someotherpath/downloads/ " \
+ "https?://.*/.* file:///someotherpath/downloads/ " \
"svn://svn.server1.com/ svn://svn.server2.com/"
def test_urireplace(self):
@@ -1415,12 +1414,17 @@ class URLHandle(unittest.TestCase):
"https://somesite.com/somerepo.git;user=anyUser:idtoken=1234" : ('https', 'somesite.com', '/somerepo.git', '', '', {'user': 'anyUser:idtoken=1234'}),
'git://s.o-me_ONE:%s@git.openembedded.org/bitbake;branch=main;protocol=https' % password: ('git', 'git.openembedded.org', '/bitbake', 's.o-me_ONE', password, {'branch': 'main', 'protocol' : 'https'}),
}
- # we require a pathname to encodeurl but users can still pass such urls to
- # decodeurl and we need to handle them
+ # We require a pathname to encodeurl but users can still pass URLs without
+ # a path to decodeurl and we need to handle them. decodeurl is also used to
+ # split the regular expression "URLs" that are used in PREMIRRORS and
+ # MIRRORS.
decodedata = datatable.copy()
decodedata.update({
"http://somesite.net;someparam=1": ('http', 'somesite.net', '/', '', '', {'someparam': '1'}),
"npmsw://some.registry.url;package=@pkg;version=latest": ('npmsw', 'some.registry.url', '/', '', '', {'package': '@pkg', 'version': 'latest'}),
+ r"git://.*/.*": ("git", ".*", "/.*", "", "", {}),
+ r"https?://.*/.*": ("https?", ".*", "/.*", "", "", {}),
+ r"git://(?!internal\.git\.server).*/.*": ("git", r"(?!internal\.git\.server).*", "/.*", "", "", {}),
})
def test_decodeurl(self):
A regular expression "URL" as used in PREMIRRORS and MIRRORS may contain a ? as part of the regular expression. Make sure this does not cause problems when parsed by the fetcher. Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com> --- bitbake/lib/bb/tests/fetch.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)