summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/fetch2/__init__.py
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/lib/bb/fetch2/__init__.py')
-rw-r--r--bitbake/lib/bb/fetch2/__init__.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/bitbake/lib/bb/fetch2/__init__.py b/bitbake/lib/bb/fetch2/__init__.py
index fa963bed59..a7da899c22 100644
--- a/bitbake/lib/bb/fetch2/__init__.py
+++ b/bitbake/lib/bb/fetch2/__init__.py
@@ -70,6 +70,9 @@ class FetchError(BBFetchException):
70class ChecksumError(FetchError): 70class ChecksumError(FetchError):
71 """Exception when mismatched checksum encountered""" 71 """Exception when mismatched checksum encountered"""
72 72
73class NoChecksumError(FetchError):
74 """Exception when no checksum is specified, but BB_STRICT_CHECKSUM is set"""
75
73class UnpackError(BBFetchException): 76class UnpackError(BBFetchException):
74 """General fetcher exception when something happens incorrectly when unpacking""" 77 """General fetcher exception when something happens incorrectly when unpacking"""
75 def __init__(self, message, url): 78 def __init__(self, message, url):
@@ -314,7 +317,7 @@ def verify_checksum(u, ud, d):
314 # If strict checking enabled and neither sum defined, raise error 317 # If strict checking enabled and neither sum defined, raise error
315 strict = d.getVar("BB_STRICT_CHECKSUM", True) or None 318 strict = d.getVar("BB_STRICT_CHECKSUM", True) or None
316 if (strict and ud.md5_expected == None and ud.sha256_expected == None): 319 if (strict and ud.md5_expected == None and ud.sha256_expected == None):
317 raise FetchError('No checksum specified for %s, please add at least one to the recipe:\n' 320 raise NoChecksumError('No checksum specified for %s, please add at least one to the recipe:\n'
318 'SRC_URI[%s] = "%s"\nSRC_URI[%s] = "%s"' % 321 'SRC_URI[%s] = "%s"\nSRC_URI[%s] = "%s"' %
319 (ud.localpath, ud.md5_name, md5data, 322 (ud.localpath, ud.md5_name, md5data,
320 ud.sha256_name, sha256data), u) 323 ud.sha256_name, sha256data), u)
@@ -568,6 +571,8 @@ def try_mirror_url(newuri, origud, ud, ld, check = False):
568 if isinstance(e, ChecksumError): 571 if isinstance(e, ChecksumError):
569 logger.warn("Mirror checksum failure for url %s (original url: %s)\nCleaning and trying again." % (newuri, origud.url)) 572 logger.warn("Mirror checksum failure for url %s (original url: %s)\nCleaning and trying again." % (newuri, origud.url))
570 logger.warn(str(e)) 573 logger.warn(str(e))
574 elif isinstance(e, NoChecksumError):
575 raise
571 else: 576 else:
572 logger.debug(1, "Mirror fetch failure for url %s (original url: %s)" % (newuri, origud.url)) 577 logger.debug(1, "Mirror fetch failure for url %s (original url: %s)" % (newuri, origud.url))
573 logger.debug(1, str(e)) 578 logger.debug(1, str(e))
@@ -1179,6 +1184,8 @@ class Fetch(object):
1179 except BBFetchException as e: 1184 except BBFetchException as e:
1180 if isinstance(e, ChecksumError): 1185 if isinstance(e, ChecksumError):
1181 logger.warn("Checksum error encountered with download (will attempt other sources): %s" % str(e)) 1186 logger.warn("Checksum error encountered with download (will attempt other sources): %s" % str(e))
1187 if isinstance(e, NoChecksumError):
1188 raise
1182 else: 1189 else:
1183 logger.warn('Failed to fetch URL %s, attempting MIRRORS if available' % u) 1190 logger.warn('Failed to fetch URL %s, attempting MIRRORS if available' % u)
1184 logger.debug(1, str(e)) 1191 logger.debug(1, str(e))
@@ -1196,6 +1203,11 @@ class Fetch(object):
1196 1203
1197 update_stamp(u, ud, self.d) 1204 update_stamp(u, ud, self.d)
1198 1205
1206 except BBFetchException as e:
1207 if isinstance(e, NoChecksumError):
1208 logger.error("%s" % str(e))
1209 raise
1210
1199 finally: 1211 finally:
1200 bb.utils.unlockfile(lf) 1212 bb.utils.unlockfile(lf)
1201 1213