summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2013-02-19 23:05:11 -0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2013-02-19 23:07:23 -0800
commit7d22ef28e64de06b6238d0ef9b664c0bee6efa46 (patch)
tree3bbd32be336c32cc0cf2973c5e0d1bea268d5387
parent6bf55c6e67b371c0467ae1be4d7f713d6a3dcf3b (diff)
downloadpoky-7d22ef28e64de06b6238d0ef9b664c0bee6efa46.tar.gz
poky-7d22ef28e64de06b6238d0ef9b664c0bee6efa46.tar.bz2
poky-7d22ef28e64de06b6238d0ef9b664c0bee6efa46.zip
bitbake: Revert "fetch2: Adapt encode/decode url to use URI class"1.4_M4.rc11.4_M4.final1.4_M4
This reverts commit 21fe2683aefde10e847e66c11c26d4f4c1e07cfd since bitbake-selftest doesn't pass when this is applied and we're seeing multiple build failures from this change. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--bitbake/lib/bb/fetch2/__init__.py66
1 files changed, 49 insertions, 17 deletions
diff --git a/bitbake/lib/bb/fetch2/__init__.py b/bitbake/lib/bb/fetch2/__init__.py
index 8118fc2510..4cfe08957d 100644
--- a/bitbake/lib/bb/fetch2/__init__.py
+++ b/bitbake/lib/bb/fetch2/__init__.py
@@ -322,9 +322,40 @@ def decodeurl(url):
user, password, parameters).
"""
- urlo = URI(url)
- return (urlo.scheme, urlo.hostport, urlo.path,
- urlo.username, urlo.password, urlo.params)
+ m = re.compile('(?P<type>[^:]*)://((?P<user>.+)@)?(?P<location>[^;]+)(;(?P<parm>.*))?').match(url)
+ if not m:
+ raise MalformedUrl(url)
+
+ 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('/')
+ if locidx != -1 and type.lower() != 'file':
+ host = location[:locidx]
+ path = location[locidx:]
+ else:
+ host = ""
+ path = location
+ if user:
+ m = re.compile('(?P<user>[^:]+)(:?(?P<pswd>.*))').match(user)
+ if m:
+ user = m.group('user')
+ pswd = m.group('pswd')
+ else:
+ user = ''
+ pswd = ''
+
+ p = {}
+ if parm:
+ for s in parm.split(';'):
+ s1, s2 = s.split('=')
+ p[s1] = s2
+
+ return type, host, urllib.unquote(path), user, pswd, p
def encodeurl(decoded):
"""Encodes a URL from tokens (scheme, network location, path,
@@ -333,26 +364,27 @@ def encodeurl(decoded):
type, host, path, user, pswd, p = decoded
- urlo = URI()
-
if not path:
raise MissingParameterError('path', "encoded from the data %s" % str(decoded))
if not type:
raise MissingParameterError('type', "encoded from the data %s" % str(decoded))
-
- urlo.scheme = type
- urlo.path = path
-
- if host:
- urlo.hostname = host
- if user:
- urlo.username = user
- if pswd:
- urlo.password = pswd
+ url = '%s://' % type
+ if user and type != "file":
+ url += "%s" % user
+ if pswd:
+ url += ":%s" % pswd
+ url += "@"
+ if host and type != "file":
+ url += "%s" % host
+ # Standardise path to ensure comparisons work
+ while '//' in path:
+ path = path.replace("//", "/")
+ url += "%s" % urllib.quote(path)
if p:
- urlo.params = p
+ for parm in p:
+ url += ";%s=%s" % (parm, p[parm])
- return str(urlo)
+ return url
def uri_replace(ud, uri_find, uri_replace, replacements, d):
if not ud.url or not uri_find or not uri_replace: