summaryrefslogtreecommitdiffstats
path: root/bitbake/lib
diff options
context:
space:
mode:
authorJakub Dębski <jdebski@enigma.com.pl>2018-04-17 12:00:17 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2018-05-22 13:13:19 +0100
commitef7222c6d1cbd81cd95dd3f13b282ed70b978ea9 (patch)
tree6770acb6776f06b43094a8fb68213a4a96a68534 /bitbake/lib
parentb68ed05be66eb045cb3fc74b201ce798766c3d1a (diff)
downloadpoky-ef7222c6d1cbd81cd95dd3f13b282ed70b978ea9.tar.gz
bitbake: fetch2/__init__.py: Fixed handling of uris with empty path
For mirrors or premirrors defined like: "http://.*/.* http://somewhere.org" fetching ends with errors because function fetch2/__init__.py:encodeurl() creates url like "http://somewhere.orgsomefile.tar.gz". It happens because function fetch2/__init__.py:decodeurl() for url "http://somewhere.org" returns ['http', 'somewhere.org', '', '', '', {}] and then in function fetch2/__init__.py:uri_replace() variable result_decode will be ['http', 'somewhere.org', 'somefile.tar.gz', '', '', {}] (because of line: result_decoded[loc] = os.path.join(result_decoded[loc], basename)) for which encodeurl returns "http://somewhere.orgsomefile.tar.gz". In addition for mirror "http://.*/.* http://somewhere.org/" everything works fine. (Bitbake rev: d822ae24ef5485e550804cbd9130ebd73b2aa48e) Signed-off-by: Jakub Dębski <jdebski@enigma.com.pl> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib')
-rw-r--r--bitbake/lib/bb/fetch2/__init__.py2
-rw-r--r--bitbake/lib/bb/tests/fetch.py6
2 files changed, 6 insertions, 2 deletions
diff --git a/bitbake/lib/bb/fetch2/__init__.py b/bitbake/lib/bb/fetch2/__init__.py
index 72d6092deb..c8e2f829c9 100644
--- a/bitbake/lib/bb/fetch2/__init__.py
+++ b/bitbake/lib/bb/fetch2/__init__.py
@@ -383,7 +383,7 @@ def decodeurl(url):
383 path = location 383 path = location
384 else: 384 else:
385 host = location 385 host = location
386 path = "" 386 path = "/"
387 if user: 387 if user:
388 m = re.compile('(?P<user>[^:]+)(:?(?P<pswd>.*))').match(user) 388 m = re.compile('(?P<user>[^:]+)(:?(?P<pswd>.*))').match(user)
389 if m: 389 if m:
diff --git a/bitbake/lib/bb/tests/fetch.py b/bitbake/lib/bb/tests/fetch.py
index 74859f9d30..1821ee81c0 100644
--- a/bitbake/lib/bb/tests/fetch.py
+++ b/bitbake/lib/bb/tests/fetch.py
@@ -402,6 +402,10 @@ class MirrorUriTest(FetcherTest):
402 : "git://somewhere.org/somedir/mtd-utils.git;tag=1234567890123456789012345678901234567890;protocol=http", 402 : "git://somewhere.org/somedir/mtd-utils.git;tag=1234567890123456789012345678901234567890;protocol=http",
403 ("git://git.invalid.infradead.org/foo/mtd-utils.git;tag=1234567890123456789012345678901234567890", "git://.*/.*", "git://somewhere.org/somedir/MIRRORNAME;protocol=http") 403 ("git://git.invalid.infradead.org/foo/mtd-utils.git;tag=1234567890123456789012345678901234567890", "git://.*/.*", "git://somewhere.org/somedir/MIRRORNAME;protocol=http")
404 : "git://somewhere.org/somedir/git.invalid.infradead.org.foo.mtd-utils.git;tag=1234567890123456789012345678901234567890;protocol=http", 404 : "git://somewhere.org/somedir/git.invalid.infradead.org.foo.mtd-utils.git;tag=1234567890123456789012345678901234567890;protocol=http",
405 ("http://somewhere.org/somedir1/somedir2/somefile_1.2.3.tar.gz", "http://.*/.*", "http://somewhere2.org")
406 : "http://somewhere2.org/somefile_1.2.3.tar.gz",
407 ("http://somewhere.org/somedir1/somedir2/somefile_1.2.3.tar.gz", "http://.*/.*", "http://somewhere2.org/")
408 : "http://somewhere2.org/somefile_1.2.3.tar.gz",
405 409
406 #Renaming files doesn't work 410 #Renaming files doesn't work
407 #("http://somewhere.org/somedir1/somefile_1.2.3.tar.gz", "http://somewhere.org/somedir1/somefile_1.2.3.tar.gz", "http://somewhere2.org/somedir3/somefile_2.3.4.tar.gz") : "http://somewhere2.org/somedir3/somefile_2.3.4.tar.gz" 411 #("http://somewhere.org/somedir1/somefile_1.2.3.tar.gz", "http://somewhere.org/somedir1/somefile_1.2.3.tar.gz", "http://somewhere2.org/somedir3/somefile_2.3.4.tar.gz") : "http://somewhere2.org/somedir3/somefile_2.3.4.tar.gz"
@@ -832,7 +836,7 @@ class URLHandle(unittest.TestCase):
832 # decodeurl and we need to handle them 836 # decodeurl and we need to handle them
833 decodedata = datatable.copy() 837 decodedata = datatable.copy()
834 decodedata.update({ 838 decodedata.update({
835 "http://somesite.net;someparam=1": ('http', 'somesite.net', '', '', '', {'someparam': '1'}), 839 "http://somesite.net;someparam=1": ('http', 'somesite.net', '/', '', '', {'someparam': '1'}),
836 }) 840 })
837 841
838 def test_decodeurl(self): 842 def test_decodeurl(self):