diff options
author | Olof Johansson <olof.johansson@axis.com> | 2014-01-20 12:03:20 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2014-03-24 17:54:45 +0000 |
commit | 86860bbfd9371d62f6208aa3ca7fe9e2dc416cec (patch) | |
tree | 52b301e6f385e421322c912378980e69d9f9f3e4 /bitbake/lib/bb/fetch2 | |
parent | 24979a1f7ecc155cf36f61ffb2d2a32c2fb64734 (diff) | |
download | poky-86860bbfd9371d62f6208aa3ca7fe9e2dc416cec.tar.gz |
bitbake: fetch2.URI: Coerce urlparse to use netloc for all schemes
(Bitbake rev: 4d502578f022bcf772780550c047b8c09ba01443)
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 | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/bitbake/lib/bb/fetch2/__init__.py b/bitbake/lib/bb/fetch2/__init__.py index f1f2ee6020..5c6180bbb7 100644 --- a/bitbake/lib/bb/fetch2/__init__.py +++ b/bitbake/lib/bb/fetch2/__init__.py | |||
@@ -33,9 +33,6 @@ import glob | |||
33 | import logging | 33 | import logging |
34 | import urllib | 34 | import urllib |
35 | import urlparse | 35 | import urlparse |
36 | if 'git' not in urlparse.uses_netloc: | ||
37 | urlparse.uses_netloc.append('git') | ||
38 | from urlparse import urlparse | ||
39 | import operator | 36 | import operator |
40 | import bb.persist_data, bb.utils | 37 | import bb.persist_data, bb.utils |
41 | import bb.checksum | 38 | import bb.checksum |
@@ -209,13 +206,25 @@ class URI(object): | |||
209 | if not uri: | 206 | if not uri: |
210 | return | 207 | return |
211 | 208 | ||
212 | urlp = urlparse(uri) | 209 | urlp = urlparse.urlparse(uri) |
213 | self.scheme = urlp.scheme | 210 | self.scheme = urlp.scheme |
214 | 211 | ||
215 | # Convert URI to be relative | 212 | reparse = 0 |
213 | |||
214 | # Coerce urlparse to make URI scheme use netloc | ||
215 | if not self.scheme in urlparse.uses_netloc: | ||
216 | urlparse.uses_params.append(self.scheme) | ||
217 | reparse = 1 | ||
218 | |||
219 | # Make urlparse happy(/ier) by converting local resources | ||
220 | # to RFC compliant URL format. E.g.: | ||
221 | # file://foo.diff -> file:foo.diff | ||
216 | if urlp.scheme in self._netloc_forbidden: | 222 | if urlp.scheme in self._netloc_forbidden: |
217 | uri = re.sub("(?<=:)//(?!/)", "", uri, 1) | 223 | uri = re.sub("(?<=:)//(?!/)", "", uri, 1) |
218 | urlp = urlparse(uri) | 224 | reparse = 1 |
225 | |||
226 | if reparse: | ||
227 | urlp = urlparse.urlparse(uri) | ||
219 | 228 | ||
220 | # Identify if the URI is relative or not | 229 | # Identify if the URI is relative or not |
221 | if urlp.scheme in self._relative_schemes and \ | 230 | if urlp.scheme in self._relative_schemes and \ |