summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/fetch2
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2016-02-26 17:49:33 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-02-28 11:34:38 +0000
commitab7b7bf94da653121baf7b1f6de9f11c8d4987e8 (patch)
treef950872862b008879e007c953b91efe4d857ac91 /bitbake/lib/bb/fetch2
parent06b4d8ffe4ee446b93243c7cf76c122ec836929d (diff)
downloadpoky-ab7b7bf94da653121baf7b1f6de9f11c8d4987e8.tar.gz
bitbake: fetch2/__init__: Fix decodeurl to better handle urls without paths
If we specify urls such as npm://somehost;someparams the fetcher currently does a poor job of handling mirrors of these urls due to deficiencies in the way decodeurl works. This is because "somehost" is returned as a path, not a host. This tweaks the code so that unless its a file url, the host is returned correctly. This patch also adds test cases for these urls to the exist set of test urls. We need to tweak the URI() class since this thinks this is a relative url which is clearly isn't. We also need to handle the fact that encodeurl will error if passed a url of this form (it would want the path to be '/'. (Bitbake rev: 83203cd2e677706e0111892a7843b83263cb8bd9) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/fetch2')
-rw-r--r--bitbake/lib/bb/fetch2/__init__.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/bitbake/lib/bb/fetch2/__init__.py b/bitbake/lib/bb/fetch2/__init__.py
index 914553aaf7..5f0e6c9266 100644
--- a/bitbake/lib/bb/fetch2/__init__.py
+++ b/bitbake/lib/bb/fetch2/__init__.py
@@ -327,7 +327,7 @@ class URI(object):
327 def path(self, path): 327 def path(self, path):
328 self._path = path 328 self._path = path
329 329
330 if re.compile("^/").match(path): 330 if not path or re.compile("^/").match(path):
331 self.relative = False 331 self.relative = False
332 else: 332 else:
333 self.relative = True 333 self.relative = True
@@ -375,9 +375,12 @@ def decodeurl(url):
375 if locidx != -1 and type.lower() != 'file': 375 if locidx != -1 and type.lower() != 'file':
376 host = location[:locidx] 376 host = location[:locidx]
377 path = location[locidx:] 377 path = location[locidx:]
378 else: 378 elif type.lower() == 'file':
379 host = "" 379 host = ""
380 path = location 380 path = location
381 else:
382 host = location
383 path = ""
381 if user: 384 if user:
382 m = re.compile('(?P<user>[^:]+)(:?(?P<pswd>.*))').match(user) 385 m = re.compile('(?P<user>[^:]+)(:?(?P<pswd>.*))').match(user)
383 if m: 386 if m: