1
0
mirror of https://git.yoctoproject.org/poky synced 2026-05-31 12:49:46 +00:00

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>
This commit is contained in:
Olof Johansson
2014-01-20 12:03:20 +01:00
committed by Richard Purdie
parent 24979a1f7e
commit 86860bbfd9
+15 -6
View File
@@ -33,9 +33,6 @@ import glob
import logging import logging
import urllib import urllib
import urlparse import urlparse
if 'git' not in urlparse.uses_netloc:
urlparse.uses_netloc.append('git')
from urlparse import urlparse
import operator import operator
import bb.persist_data, bb.utils import bb.persist_data, bb.utils
import bb.checksum import bb.checksum
@@ -209,13 +206,25 @@ class URI(object):
if not uri: if not uri:
return return
urlp = urlparse(uri) urlp = urlparse.urlparse(uri)
self.scheme = urlp.scheme self.scheme = urlp.scheme
# Convert URI to be relative reparse = 0
# Coerce urlparse to make URI scheme use netloc
if not self.scheme in urlparse.uses_netloc:
urlparse.uses_params.append(self.scheme)
reparse = 1
# Make urlparse happy(/ier) by converting local resources
# to RFC compliant URL format. E.g.:
# file://foo.diff -> file:foo.diff
if urlp.scheme in self._netloc_forbidden: if urlp.scheme in self._netloc_forbidden:
uri = re.sub("(?<=:)//(?!/)", "", uri, 1) uri = re.sub("(?<=:)//(?!/)", "", uri, 1)
urlp = urlparse(uri) reparse = 1
if reparse:
urlp = urlparse.urlparse(uri)
# Identify if the URI is relative or not # Identify if the URI is relative or not
if urlp.scheme in self._relative_schemes and \ if urlp.scheme in self._relative_schemes and \