]> code.ossystems Code Review - openembedded-core.git/commitdiff
bitbake decodeurl: fix the file:// url handling
authorNitin A Kamble <nitin.a.kamble@intel.com>
Fri, 4 Jun 2010 04:50:02 +0000 (21:50 -0700)
committerRichard Purdie <rpurdie@linux.intel.com>
Mon, 7 Jun 2010 15:05:00 +0000 (16:05 +0100)
Without this patch decoding a url of this kind file://dir/filename gives
path=/filename host=dir.
With the patch it decodes as path=/dir/filename host=""

Probably nobody stumbled on this issue yet because nobody used
file:// urls with directory names in the path.

Signed-off-by: Nitin A Kamble <nitin.a.kamble@intel.com>
bitbake/lib/bb/fetch/__init__.py

index e6cc1c535b1aa6f60b3ab65bc1a4d31aa8a05e45..b566da43119b704f7b1e1ec1e6f585dd74306468 100644 (file)
@@ -57,6 +57,9 @@ def decodeurl(url):
     >>> decodeurl("http://www.google.com/index.html")
     ('http', 'www.google.com', '/index.html', '', '', {})
 
+    >>> decodeurl("file://gas/COPYING")
+    ('file', '', 'gas/COPYING', '', '', {})
+
     CVS url with username, host and cvsroot. The cvs module to check out is in the
     parameters:
 
@@ -82,7 +85,7 @@ def decodeurl(url):
     parm = m.group('parm')
 
     locidx = location.find('/')
-    if locidx != -1:
+    if locidx != -1 and type.lower() != 'file':
         host = location[:locidx]
         path = location[locidx:]
     else: