summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/fetch2
diff options
context:
space:
mode:
authorOlof Johansson <olof.johansson@axis.com>2014-01-20 12:03:20 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-03-24 17:54:45 +0000
commit86860bbfd9371d62f6208aa3ca7fe9e2dc416cec (patch)
tree52b301e6f385e421322c912378980e69d9f9f3e4 /bitbake/lib/bb/fetch2
parent24979a1f7ecc155cf36f61ffb2d2a32c2fb64734 (diff)
downloadpoky-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__.py21
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
33import logging 33import logging
34import urllib 34import urllib
35import urlparse 35import urlparse
36if 'git' not in urlparse.uses_netloc:
37 urlparse.uses_netloc.append('git')
38from urlparse import urlparse
39import operator 36import operator
40import bb.persist_data, bb.utils 37import bb.persist_data, bb.utils
41import bb.checksum 38import 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 \