[oe-commits] [bitbake] branch master-next updated: fetch2/__init__.py: Fixed handling of uris with empty path

git at git.openembedded.org git at git.openembedded.org
Fri May 11 06:57:24 UTC 2018


This is an automated email from the git hooks/post-receive script.

rpurdie pushed a commit to branch master-next
in repository bitbake.

The following commit(s) were added to refs/heads/master-next by this push:
     new caf5243  fetch2/__init__.py: Fixed handling of uris with empty path
caf5243 is described below

commit caf52430a3c60b28a6433f92538d50012eabb5c3
Author: Jakub Dębski <jdebski at enigma.com.pl>
AuthorDate: Tue Apr 17 12:00:17 2018 +0200

    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.
    
    Signed-off-by: Jakub Dębski <jdebski at enigma.com.pl>
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
 lib/bb/fetch2/__init__.py | 2 +-
 lib/bb/tests/fetch.py     | 6 +++++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/lib/bb/fetch2/__init__.py b/lib/bb/fetch2/__init__.py
index 72d6092..c8e2f82 100644
--- a/lib/bb/fetch2/__init__.py
+++ b/lib/bb/fetch2/__init__.py
@@ -383,7 +383,7 @@ def decodeurl(url):
         path = location
     else:
         host = location
-        path = ""
+        path = "/"
     if user:
         m = re.compile('(?P<user>[^:]+)(:?(?P<pswd>.*))').match(user)
         if m:
diff --git a/lib/bb/tests/fetch.py b/lib/bb/tests/fetch.py
index 74859f9..1821ee8 100644
--- a/lib/bb/tests/fetch.py
+++ b/lib/bb/tests/fetch.py
@@ -402,6 +402,10 @@ class MirrorUriTest(FetcherTest):
             : "git://somewhere.org/somedir/mtd-utils.git;tag=1234567890123456789012345678901234567890;protocol=http", 
         ("git://git.invalid.infradead.org/foo/mtd-utils.git;tag=1234567890123456789012345678901234567890", "git://.*/.*", "git://somewhere.org/somedir/MIRRORNAME;protocol=http") 
             : "git://somewhere.org/somedir/git.invalid.infradead.org.foo.mtd-utils.git;tag=1234567890123456789012345678901234567890;protocol=http", 
+        ("http://somewhere.org/somedir1/somedir2/somefile_1.2.3.tar.gz", "http://.*/.*", "http://somewhere2.org")
+            : "http://somewhere2.org/somefile_1.2.3.tar.gz",
+        ("http://somewhere.org/somedir1/somedir2/somefile_1.2.3.tar.gz", "http://.*/.*", "http://somewhere2.org/")
+            : "http://somewhere2.org/somefile_1.2.3.tar.gz",
 
         #Renaming files doesn't work
         #("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):
     # decodeurl and we need to handle them
     decodedata = datatable.copy()
     decodedata.update({
-       "http://somesite.net;someparam=1": ('http', 'somesite.net', '', '', '', {'someparam': '1'}),
+       "http://somesite.net;someparam=1": ('http', 'somesite.net', '/', '', '', {'someparam': '1'}),
     })
 
     def test_decodeurl(self):

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list