diff options
Diffstat (limited to 'bitbake/lib')
| -rw-r--r-- | bitbake/lib/bb/fetch2/__init__.py | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/bitbake/lib/bb/fetch2/__init__.py b/bitbake/lib/bb/fetch2/__init__.py index ba6849e09d..9b5ba5a395 100644 --- a/bitbake/lib/bb/fetch2/__init__.py +++ b/bitbake/lib/bb/fetch2/__init__.py | |||
| @@ -63,6 +63,9 @@ class FetchError(BBFetchException): | |||
| 63 | BBFetchException.__init__(self, msg) | 63 | BBFetchException.__init__(self, msg) |
| 64 | self.args = (message, url) | 64 | self.args = (message, url) |
| 65 | 65 | ||
| 66 | class ChecksumError(FetchError): | ||
| 67 | """Exception when mismatched checksum encountered""" | ||
| 68 | |||
| 66 | class UnpackError(BBFetchException): | 69 | class UnpackError(BBFetchException): |
| 67 | """General fetcher exception when something happens incorrectly when unpacking""" | 70 | """General fetcher exception when something happens incorrectly when unpacking""" |
| 68 | def __init__(self, message, url): | 71 | def __init__(self, message, url): |
| @@ -312,7 +315,7 @@ def verify_checksum(u, ud, d): | |||
| 312 | msg = msg + "\nFile: '%s' has %s checksum %s when %s was expected" % (ud.localpath, 'sha256', sha256data, ud.sha256_expected) | 315 | msg = msg + "\nFile: '%s' has %s checksum %s when %s was expected" % (ud.localpath, 'sha256', sha256data, ud.sha256_expected) |
| 313 | 316 | ||
| 314 | if len(msg): | 317 | if len(msg): |
| 315 | raise FetchError('Checksum mismatch!%s' % msg, u) | 318 | raise ChecksumError('Checksum mismatch!%s' % msg, u) |
| 316 | 319 | ||
| 317 | 320 | ||
| 318 | def update_stamp(u, ud, d): | 321 | def update_stamp(u, ud, d): |
| @@ -504,8 +507,12 @@ def try_mirrors(d, origud, mirrors, check = False): | |||
| 504 | raise | 507 | raise |
| 505 | 508 | ||
| 506 | except bb.fetch2.BBFetchException as e: | 509 | except bb.fetch2.BBFetchException as e: |
| 507 | logger.debug(1, "Mirror fetch failure for url %s (original url: %s)" % (newuri, origud.url)) | 510 | if isinstance(e, ChecksumError): |
| 508 | logger.debug(1, str(e)) | 511 | logger.warn("Mirror checksum failure for url %s (original url: %s)\nCleaning and trying again." % (newuri, origud.url)) |
| 512 | logger.warn(str(e)) | ||
| 513 | else: | ||
| 514 | logger.debug(1, "Mirror fetch failure for url %s (original url: %s)" % (newuri, origud.url)) | ||
| 515 | logger.debug(1, str(e)) | ||
| 509 | try: | 516 | try: |
| 510 | ud.method.clean(ud, ld) | 517 | ud.method.clean(ud, ld) |
| 511 | except UnboundLocalError: | 518 | except UnboundLocalError: |
| @@ -979,8 +986,11 @@ class Fetch(object): | |||
| 979 | raise | 986 | raise |
| 980 | 987 | ||
| 981 | except BBFetchException as e: | 988 | except BBFetchException as e: |
| 982 | logger.warn('Failed to fetch URL %s' % u) | 989 | if isinstance(e, ChecksumError): |
| 983 | logger.debug(1, str(e)) | 990 | logger.warn("Checksum error encountered with download (will attempt other sources): %s" % str(e)) |
| 991 | else: | ||
| 992 | logger.warn('Failed to fetch URL %s, attempting MIRRORS if available' % u) | ||
| 993 | logger.debug(1, str(e)) | ||
| 984 | firsterr = e | 994 | firsterr = e |
| 985 | # Remove any incomplete fetch | 995 | # Remove any incomplete fetch |
| 986 | m.clean(ud, self.d) | 996 | m.clean(ud, self.d) |
