summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2012-09-23 18:05:36 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-09-24 12:13:52 +0100
commit90b7683f782a99ecf080ae8a09e0fd9164bf44ae (patch)
tree4212bcb4c91701e9df4e0c284fa27988bd0d267b
parent683d3b9cfbbc5a93e9eb1423cfbdfe3538e26087 (diff)
downloadpoky-90b7683f782a99ecf080ae8a09e0fd9164bf44ae.tar.gz
bitbake: fetch2: improve error output for checksum failures
* Don't print the full exception in the initial warning - if we later succeed in fetching the file from a mirror, we won't usually need the details (which are in the fetch log if they are needed); otherwise the full error will be printed when the fetch operation fails. Also adjust the conditional block so that we don't print another warning just mentioning we're going to try mirrors. * Call logger.error() so that with knotty the full log is not printed * Provide an explanation around the lines we print for easily updating the checksums in the recipe. We don't want users to be just blindly updating the recipe in case of a transient failure or deliberately altered remote file. (Bitbake rev: 2793413106c925b06783beb7413aa87cbcf246c3) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--bitbake/lib/bb/fetch2/__init__.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/bitbake/lib/bb/fetch2/__init__.py b/bitbake/lib/bb/fetch2/__init__.py
index 1acb0a4f8c..a713418317 100644
--- a/bitbake/lib/bb/fetch2/__init__.py
+++ b/bitbake/lib/bb/fetch2/__init__.py
@@ -358,7 +358,7 @@ def verify_checksum(u, ud, d):
358 mismatch = True; 358 mismatch = True;
359 359
360 if mismatch: 360 if mismatch:
361 msg = msg + '\nYour checksums:\nSRC_URI[%s] = "%s"\nSRC_URI[%s] = "%s"' % (ud.md5_name, md5data, ud.sha256_name, sha256data) 361 msg = msg + '\nIf this change is expected (e.g. you have upgraded to a new version without updating the checksums) then you can use these lines within the recipe:\nSRC_URI[%s] = "%s"\nSRC_URI[%s] = "%s"\nOtherwise you should retry the download and/or check with upstream to determine if the file has become corrupted or otherwise unexpectedly modified.\n' % (ud.md5_name, md5data, ud.sha256_name, sha256data)
362 362
363 if len(msg): 363 if len(msg):
364 raise ChecksumError('Checksum mismatch!%s' % msg, u) 364 raise ChecksumError('Checksum mismatch!%s' % msg, u)
@@ -1204,8 +1204,9 @@ class Fetch(object):
1204 1204
1205 except BBFetchException as e: 1205 except BBFetchException as e:
1206 if isinstance(e, ChecksumError): 1206 if isinstance(e, ChecksumError):
1207 logger.warn("Checksum error encountered with download (will attempt other sources): %s" % str(e)) 1207 logger.warn("Checksum failure encountered with download of %s - will attempt other sources if available" % u)
1208 if isinstance(e, NoChecksumError): 1208 logger.debug(1, str(e))
1209 elif isinstance(e, NoChecksumError):
1209 raise 1210 raise
1210 else: 1211 else:
1211 logger.warn('Failed to fetch URL %s, attempting MIRRORS if available' % u) 1212 logger.warn('Failed to fetch URL %s, attempting MIRRORS if available' % u)
@@ -1227,6 +1228,8 @@ class Fetch(object):
1227 except BBFetchException as e: 1228 except BBFetchException as e:
1228 if isinstance(e, NoChecksumError): 1229 if isinstance(e, NoChecksumError):
1229 logger.error("%s" % str(e)) 1230 logger.error("%s" % str(e))
1231 elif isinstance(e, ChecksumError):
1232 logger.error("Checksum failure fetching %s" % u)
1230 raise 1233 raise
1231 1234
1232 finally: 1235 finally: