Patchwork [bitbake-devel,2/2] bitbake: diff path:file and network include special @ character

login
register
mail settings
Submitter Li Wang
Date June 25, 2013, 6:31 a.m.
Message ID <1372141875-17591-2-git-send-email-li.wang@windriver.com>
Download mbox | patch
Permalink /patch/52311/
State New
Headers show

Comments

Li Wang - June 25, 2013, 6:31 a.m.
[YOCTO #4772]

When fetch file, We need to handle the follow address format:
xxx@www.xxx.com:/a/b@c/d
the user name is invalide, when it includes '/' character.
So, we can separate '@' character in username:password, or path:file

Signed-off-by: Li Wang <li.wang@windriver.com>
---
 bitbake/lib/bb/fetch2/__init__.py |    9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

Patch

diff --git a/bitbake/lib/bb/fetch2/__init__.py b/bitbake/lib/bb/fetch2/__init__.py
index 6211cd7..62f3b95 100644
--- a/bitbake/lib/bb/fetch2/__init__.py
+++ b/bitbake/lib/bb/fetch2/__init__.py
@@ -333,11 +333,18 @@  def decodeurl(url):
     if not m:
         raise MalformedUrl(url)
 
+    user = m.group('user')
+    if user:
+        n = re.compile('(?P<usr>[^:]+)(:?(?P<pswd>.*))').match(user)
+        usr = n.group('usr')
+        if usr.find('/') != -1:
+            m = re.compile('(?P<type>[^:]*)://?(?P<location>[^;]+)(;(?P<parm>.*))?').match(url)
+            user = ''
+
     type = m.group('type')
     location = m.group('location')
     if not location:
         raise MalformedUrl(url)
-    user = m.group('user')
     parm = m.group('parm')
 
     locidx = location.find('/')