Skip to contentSkip to conversation

bitbake: python funcname can not include special character @

PATCH New Li Wang 1 participant 2 messages Jun 25, 2013

lore
Share & tools
lore

Li Wang

author
#0 lore raw

PATCH 1/2 bitbake: python funcname can not include special character @

[YOCTO #4772]

When path:file change to python function, it maybe include '@' character. So, add the special character to change to '_' for avoid error.

---
 bitbake/lib/bb/parse/ast.py |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
bitbake/lib/bb/parse/ast.py +1 -1
index 6e7fd84..d4b8b09 100644
@@ -147,7 +147,7 @@ class MethodNode(AstNode):
     def eval(self, data):
         text = '\n'.join(self.body)
         if self.func_name == "__anonymous":
-            funcname = ("__anon_%s_%s" % (self.lineno, self.filename.translate(string.maketrans('/.+-', '____'))))
+            funcname = ("__anon_%s_%s" % (self.lineno, self.filename.translate(string.maketrans('/.+-@', '_____'))))
             text = "def %s(d):\n" % (funcname) + text
             bb.methodpool.insert_method(funcname, text, self.filename)
             anonfuncs = data.getVar('__BBANONFUNCS') or []
Signature · 1 line
1.7.9.5
author
#1 lore raw

PATCH 2/2 bitbake: diff path:file and network include special @ character

[YOCTO #4772]

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

---
 bitbake/lib/bb/fetch2/__init__.py |    9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
bitbake/lib/bb/fetch2/__init__.py +8 -1
index 6211cd7..62f3b95 100644
@@ -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('/')
Signature · 1 line
1.7.9.5