diff options
author | Paul Eggleton <paul.eggleton@linux.intel.com> | 2012-09-23 18:05:36 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2012-09-24 12:13:20 +0100 |
commit | 2793413106c925b06783beb7413aa87cbcf246c3 (patch) | |
tree | 0a26456a9929ace2fa7fcd257036ace6e5d28772 /lib | |
parent | a75505a52e4da918222100221f79e8a658f90446 (diff) | |
download | bitbake-2793413106c925b06783beb7413aa87cbcf246c3.tar.gz |
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.
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/bb/fetch2/__init__.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/bb/fetch2/__init__.py b/lib/bb/fetch2/__init__.py index 1acb0a4f8..a71341831 100644 --- a/lib/bb/fetch2/__init__.py +++ b/lib/bb/fetch2/__init__.py @@ -358,7 +358,7 @@ def verify_checksum(u, ud, d): mismatch = True; if mismatch: - msg = msg + '\nYour checksums:\nSRC_URI[%s] = "%s"\nSRC_URI[%s] = "%s"' % (ud.md5_name, md5data, ud.sha256_name, sha256data) + 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) if len(msg): raise ChecksumError('Checksum mismatch!%s' % msg, u) @@ -1204,8 +1204,9 @@ class Fetch(object): except BBFetchException as e: if isinstance(e, ChecksumError): - logger.warn("Checksum error encountered with download (will attempt other sources): %s" % str(e)) - if isinstance(e, NoChecksumError): + logger.warn("Checksum failure encountered with download of %s - will attempt other sources if available" % u) + logger.debug(1, str(e)) + elif isinstance(e, NoChecksumError): raise else: logger.warn('Failed to fetch URL %s, attempting MIRRORS if available' % u) @@ -1227,6 +1228,8 @@ class Fetch(object): except BBFetchException as e: if isinstance(e, NoChecksumError): logger.error("%s" % str(e)) + elif isinstance(e, ChecksumError): + logger.error("Checksum failure fetching %s" % u) raise finally: |