diff options
-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 \ |