diff options
author | Olof Johansson <olof.johansson@axis.com> | 2014-01-20 12:03:23 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2014-03-24 17:54:46 +0000 |
commit | 57484d68dff378e4f3bd0d3e40b9db02b029feb4 (patch) | |
tree | 189efb3a2ca35052265b94406bbff8586928b23c /bitbake/lib/bb/fetch2 | |
parent | aca2d14e9350fde58aaaa95cdeff5b051c1d38d3 (diff) | |
download | poky-57484d68dff378e4f3bd0d3e40b9db02b029feb4.tar.gz |
bitbake: fetch2.URI: Support URIs with both query strings and params
There is a case in meta-intel where a SRC_URI contains both a query string and
URI parameter:
https://edc.intel.com/Download.aspx?id=6190;downloadfilename=LIN_IEMGD_1_14_GOLD_2443.tgz
Python's urlparse thought the URI parameters were part of the query parameter
value, but in the bitbake context this is obviously not the case. As bitbake's
usage isn't really RFC compliant, we have to extract and remove the URI parameters
*before* urlparse sees the URI.
(Bitbake rev: c2f27ae4271985b48f957747b6ea372c8699cb49)
Signed-off-by: Olof Johansson <olof.johansson@axis.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/fetch2')
-rw-r--r-- | bitbake/lib/bb/fetch2/__init__.py | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/bitbake/lib/bb/fetch2/__init__.py b/bitbake/lib/bb/fetch2/__init__.py index d9d193ab12..05999607b9 100644 --- a/bitbake/lib/bb/fetch2/__init__.py +++ b/bitbake/lib/bb/fetch2/__init__.py | |||
@@ -208,6 +208,10 @@ class URI(object): | |||
208 | if not uri: | 208 | if not uri: |
209 | return | 209 | return |
210 | 210 | ||
211 | # We hijack the URL parameters, since the way bitbake uses | ||
212 | # them are not quite RFC compliant. | ||
213 | uri, param_str = (uri.split(";", 1) + [None])[:2] | ||
214 | |||
211 | urlp = urlparse.urlparse(uri) | 215 | urlp = urlparse.urlparse(uri) |
212 | self.scheme = urlp.scheme | 216 | self.scheme = urlp.scheme |
213 | 217 | ||
@@ -242,17 +246,7 @@ class URI(object): | |||
242 | if urlp.password: | 246 | if urlp.password: |
243 | self.userinfo += ':%s' % urlp.password | 247 | self.userinfo += ':%s' % urlp.password |
244 | 248 | ||
245 | # Do support params even for URI schemes that Python's | 249 | self.path = urllib.unquote(urlp.path) |
246 | # urlparse doesn't support params for. | ||
247 | path = '' | ||
248 | param_str = '' | ||
249 | if not urlp.params: | ||
250 | path, param_str = (list(urlp.path.split(";", 1)) + [None])[:2] | ||
251 | else: | ||
252 | path = urlp.path | ||
253 | param_str = urlp.params | ||
254 | |||
255 | self.path = urllib.unquote(path) | ||
256 | 250 | ||
257 | if param_str: | 251 | if param_str: |
258 | self.params = self._param_str_split(param_str, ";") | 252 | self.params = self._param_str_split(param_str, ";") |