summaryrefslogtreecommitdiffstats
path: root/bitbake/lib
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/lib')
-rw-r--r--bitbake/lib/bb/fetch2/__init__.py94
1 files changed, 47 insertions, 47 deletions
diff --git a/bitbake/lib/bb/fetch2/__init__.py b/bitbake/lib/bb/fetch2/__init__.py
index ec65216fef..5c02317764 100644
--- a/bitbake/lib/bb/fetch2/__init__.py
+++ b/bitbake/lib/bb/fetch2/__init__.py
@@ -48,11 +48,11 @@ logger = logging.getLogger("BitBake.Fetcher")
48class BBFetchException(Exception): 48class BBFetchException(Exception):
49 """Class all fetch exceptions inherit from""" 49 """Class all fetch exceptions inherit from"""
50 def __init__(self, message): 50 def __init__(self, message):
51 self.msg = message 51 self.msg = message
52 Exception.__init__(self, message) 52 Exception.__init__(self, message)
53 53
54 def __str__(self): 54 def __str__(self):
55 return self.msg 55 return self.msg
56 56
57class UntrustedUrl(BBFetchException): 57class UntrustedUrl(BBFetchException):
58 """Exception raised when encountering a host not listed in BB_ALLOWED_NETWORKS""" 58 """Exception raised when encountering a host not listed in BB_ALLOWED_NETWORKS"""
@@ -68,24 +68,24 @@ class UntrustedUrl(BBFetchException):
68class MalformedUrl(BBFetchException): 68class MalformedUrl(BBFetchException):
69 """Exception raised when encountering an invalid url""" 69 """Exception raised when encountering an invalid url"""
70 def __init__(self, url, message=''): 70 def __init__(self, url, message=''):
71 if message: 71 if message:
72 msg = message 72 msg = message
73 else: 73 else:
74 msg = "The URL: '%s' is invalid and cannot be interpreted" % url 74 msg = "The URL: '%s' is invalid and cannot be interpreted" % url
75 self.url = url 75 self.url = url
76 BBFetchException.__init__(self, msg) 76 BBFetchException.__init__(self, msg)
77 self.args = (url,) 77 self.args = (url,)
78 78
79class FetchError(BBFetchException): 79class FetchError(BBFetchException):
80 """General fetcher exception when something happens incorrectly""" 80 """General fetcher exception when something happens incorrectly"""
81 def __init__(self, message, url = None): 81 def __init__(self, message, url = None):
82 if url: 82 if url:
83 msg = "Fetcher failure for URL: '%s'. %s" % (url, message) 83 msg = "Fetcher failure for URL: '%s'. %s" % (url, message)
84 else: 84 else:
85 msg = "Fetcher failure: %s" % message 85 msg = "Fetcher failure: %s" % message
86 self.url = url 86 self.url = url
87 BBFetchException.__init__(self, msg) 87 BBFetchException.__init__(self, msg)
88 self.args = (message, url) 88 self.args = (message, url)
89 89
90class ChecksumError(FetchError): 90class ChecksumError(FetchError):
91 """Exception when mismatched checksum encountered""" 91 """Exception when mismatched checksum encountered"""
@@ -99,44 +99,44 @@ class NoChecksumError(FetchError):
99class UnpackError(BBFetchException): 99class UnpackError(BBFetchException):
100 """General fetcher exception when something happens incorrectly when unpacking""" 100 """General fetcher exception when something happens incorrectly when unpacking"""
101 def __init__(self, message, url): 101 def __init__(self, message, url):
102 msg = "Unpack failure for URL: '%s'. %s" % (url, message) 102 msg = "Unpack failure for URL: '%s'. %s" % (url, message)
103 self.url = url 103 self.url = url
104 BBFetchException.__init__(self, msg) 104 BBFetchException.__init__(self, msg)
105 self.args = (message, url) 105 self.args = (message, url)
106 106
107class NoMethodError(BBFetchException): 107class NoMethodError(BBFetchException):
108 """Exception raised when there is no method to obtain a supplied url or set of urls""" 108 """Exception raised when there is no method to obtain a supplied url or set of urls"""
109 def __init__(self, url): 109 def __init__(self, url):
110 msg = "Could not find a fetcher which supports the URL: '%s'" % url 110 msg = "Could not find a fetcher which supports the URL: '%s'" % url
111 self.url = url 111 self.url = url
112 BBFetchException.__init__(self, msg) 112 BBFetchException.__init__(self, msg)
113 self.args = (url,) 113 self.args = (url,)
114 114
115class MissingParameterError(BBFetchException): 115class MissingParameterError(BBFetchException):
116 """Exception raised when a fetch method is missing a critical parameter in the url""" 116 """Exception raised when a fetch method is missing a critical parameter in the url"""
117 def __init__(self, missing, url): 117 def __init__(self, missing, url):
118 msg = "URL: '%s' is missing the required parameter '%s'" % (url, missing) 118 msg = "URL: '%s' is missing the required parameter '%s'" % (url, missing)
119 self.url = url 119 self.url = url
120 self.missing = missing 120 self.missing = missing
121 BBFetchException.__init__(self, msg) 121 BBFetchException.__init__(self, msg)
122 self.args = (missing, url) 122 self.args = (missing, url)
123 123
124class ParameterError(BBFetchException): 124class ParameterError(BBFetchException):
125 """Exception raised when a url cannot be proccessed due to invalid parameters.""" 125 """Exception raised when a url cannot be proccessed due to invalid parameters."""
126 def __init__(self, message, url): 126 def __init__(self, message, url):
127 msg = "URL: '%s' has invalid parameters. %s" % (url, message) 127 msg = "URL: '%s' has invalid parameters. %s" % (url, message)
128 self.url = url 128 self.url = url
129 BBFetchException.__init__(self, msg) 129 BBFetchException.__init__(self, msg)
130 self.args = (message, url) 130 self.args = (message, url)
131 131
132class NetworkAccess(BBFetchException): 132class NetworkAccess(BBFetchException):
133 """Exception raised when network access is disabled but it is required.""" 133 """Exception raised when network access is disabled but it is required."""
134 def __init__(self, url, cmd): 134 def __init__(self, url, cmd):
135 msg = "Network access disabled through BB_NO_NETWORK (or set indirectly due to use of BB_FETCH_PREMIRRORONLY) but access requested with command %s (for url %s)" % (cmd, url) 135 msg = "Network access disabled through BB_NO_NETWORK (or set indirectly due to use of BB_FETCH_PREMIRRORONLY) but access requested with command %s (for url %s)" % (cmd, url)
136 self.url = url 136 self.url = url
137 self.cmd = cmd 137 self.cmd = cmd
138 BBFetchException.__init__(self, msg) 138 BBFetchException.__init__(self, msg)
139 self.args = (url, cmd) 139 self.args = (url, cmd)
140 140
141class NonLocalMethod(Exception): 141class NonLocalMethod(Exception):
142 def __init__(self): 142 def __init__(self):
@@ -455,7 +455,7 @@ def uri_replace(ud, uri_find, uri_replace, replacements, d, mirrortarball=None):
455 result_decoded[loc][k] = uri_replace_decoded[loc][k] 455 result_decoded[loc][k] = uri_replace_decoded[loc][k]
456 elif (re.match(regexp, uri_decoded[loc])): 456 elif (re.match(regexp, uri_decoded[loc])):
457 if not uri_replace_decoded[loc]: 457 if not uri_replace_decoded[loc]:
458 result_decoded[loc] = "" 458 result_decoded[loc] = ""
459 else: 459 else:
460 for k in replacements: 460 for k in replacements:
461 uri_replace_decoded[loc] = uri_replace_decoded[loc].replace(k, replacements[k]) 461 uri_replace_decoded[loc] = uri_replace_decoded[loc].replace(k, replacements[k])
@@ -733,7 +733,7 @@ def get_srcrev(d, method_name='sortable_revision'):
733 In the multi SCM case, we build a value based on SRCREV_FORMAT which must 733 In the multi SCM case, we build a value based on SRCREV_FORMAT which must
734 have been set. 734 have been set.
735 735
736 The idea here is that we put the string "AUTOINC+" into return value if the revisions are not 736 The idea here is that we put the string "AUTOINC+" into return value if the revisions are not
737 incremental, other code is then responsible for turning that into an increasing value (if needed) 737 incremental, other code is then responsible for turning that into an increasing value (if needed)
738 738
739 A method_name can be supplied to retrieve an alternatively formatted revision from a fetcher, if 739 A method_name can be supplied to retrieve an alternatively formatted revision from a fetcher, if
@@ -785,7 +785,7 @@ def get_srcrev(d, method_name='sortable_revision'):
785 format = re.sub(name_to_rev_re, lambda match: name_to_rev[match.group(0)], format) 785 format = re.sub(name_to_rev_re, lambda match: name_to_rev[match.group(0)], format)
786 786
787 if seenautoinc: 787 if seenautoinc:
788 format = "AUTOINC+" + format 788 format = "AUTOINC+" + format
789 789
790 return format 790 return format
791 791
@@ -921,7 +921,7 @@ def build_mirroruris(origud, mirrors, ld):
921 logger.debug(1, "Mirror fetch failure for url %s (original url: %s)" % (newuri, origud.url)) 921 logger.debug(1, "Mirror fetch failure for url %s (original url: %s)" % (newuri, origud.url))
922 logger.debug(1, str(e)) 922 logger.debug(1, str(e))
923 try: 923 try:
924 # setup_localpath of file:// urls may fail, we should still see 924 # setup_localpath of file:// urls may fail, we should still see
925 # if mirrors of the url exist 925 # if mirrors of the url exist
926 adduri(newud, uris, uds, localmirrors, tarballs) 926 adduri(newud, uris, uds, localmirrors, tarballs)
927 except UnboundLocalError: 927 except UnboundLocalError:
@@ -1117,7 +1117,7 @@ def srcrev_internal_helper(ud, d, name):
1117 attempts.append("SRCREV") 1117 attempts.append("SRCREV")
1118 1118
1119 for a in attempts: 1119 for a in attempts:
1120 srcrev = d.getVar(a) 1120 srcrev = d.getVar(a)
1121 if srcrev and srcrev != "INVALID": 1121 if srcrev and srcrev != "INVALID":
1122 break 1122 break
1123 1123
@@ -1230,7 +1230,7 @@ class FetchData(object):
1230 for m in methods: 1230 for m in methods:
1231 if m.supports(self, d): 1231 if m.supports(self, d):
1232 self.method = m 1232 self.method = m
1233 break 1233 break
1234 1234
1235 if not self.method: 1235 if not self.method:
1236 raise NoMethodError(url) 1236 raise NoMethodError(url)
@@ -1265,7 +1265,7 @@ class FetchData(object):
1265 elif self.basepath or self.basename: 1265 elif self.basepath or self.basename:
1266 basepath = dldir + os.sep + (self.basepath or self.basename) 1266 basepath = dldir + os.sep + (self.basepath or self.basename)
1267 else: 1267 else:
1268 bb.fatal("Can't determine lock path for url %s" % url) 1268 bb.fatal("Can't determine lock path for url %s" % url)
1269 1269
1270 self.donestamp = basepath + '.done' 1270 self.donestamp = basepath + '.done'
1271 self.lockfile = basepath + '.lock' 1271 self.lockfile = basepath + '.lock'
@@ -1328,13 +1328,13 @@ class FetchMethod(object):
1328 if os.path.isdir(urldata.localpath) == True: 1328 if os.path.isdir(urldata.localpath) == True:
1329 return False 1329 return False
1330 if urldata.localpath.find("*") != -1: 1330 if urldata.localpath.find("*") != -1:
1331 return False 1331 return False
1332 1332
1333 return True 1333 return True
1334 1334
1335 def recommends_checksum(self, urldata): 1335 def recommends_checksum(self, urldata):
1336 """ 1336 """
1337 Is the backend on where checksumming is recommended (should warnings 1337 Is the backend on where checksumming is recommended (should warnings
1338 be displayed if there is no checksum)? 1338 be displayed if there is no checksum)?
1339 """ 1339 """
1340 return False 1340 return False
@@ -1614,7 +1614,7 @@ class Fetch(object):
1614 1614
1615 try: 1615 try:
1616 self.d.setVar("BB_NO_NETWORK", network) 1616 self.d.setVar("BB_NO_NETWORK", network)
1617 1617
1618 if verify_donestamp(ud, self.d) and not m.need_update(ud, self.d): 1618 if verify_donestamp(ud, self.d) and not m.need_update(ud, self.d):
1619 localpath = ud.localpath 1619 localpath = ud.localpath
1620 elif m.try_premirror(ud, self.d): 1620 elif m.try_premirror(ud, self.d):