Patchwork [bitbake-devel,PATCHv2] fetch2: print checksums when they are different then expected

login
register
mail settings
Submitter Martin Jansa
Date July 31, 2012, 11:33 p.m.
Message ID <1343777621-27958-1-git-send-email-Martin.Jansa@gmail.com>
Download mbox | patch
Permalink /patch/33471/
State Accepted
Commit 9eb34fc866775fd8310759a0111f232a9dc98981
Headers show

Comments

Martin Jansa - July 31, 2012, 11:33 p.m.
* in form which can be copied into a recipe without modification
* like oe-classic did since:
  http://git.openembedded.org/openembedded/commit/?id=68abc465559a68e9201c9525be3c4acc6297eaed
* it shows them in right form when they are missing completely, but in
  more verbose form when different
* it needs to print that only when checksums were requested, e.g.
  fetching from sstate mirror sets both md5mismatch and sha256mismatch,
  but your checksums shouldn't be shown

Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
---
 lib/bb/fetch2/__init__.py |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
Richard Purdie - Aug. 2, 2012, 4:06 p.m.
On Wed, 2012-08-01 at 01:33 +0200, Martin Jansa wrote:
> * in form which can be copied into a recipe without modification
> * like oe-classic did since:
>   http://git.openembedded.org/openembedded/commit/?id=68abc465559a68e9201c9525be3c4acc6297eaed
> * it shows them in right form when they are missing completely, but in
>   more verbose form when different
> * it needs to print that only when checksums were requested, e.g.
>   fetching from sstate mirror sets both md5mismatch and sha256mismatch,
>   but your checksums shouldn't be shown
> 
> Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
> ---
>  lib/bb/fetch2/__init__.py |    6 ++++++
>  1 files changed, 6 insertions(+), 0 deletions(-)

Merged to master, thanks.

Richard
Richard Purdie - Aug. 2, 2012, 4:06 p.m.
On Wed, 2012-08-01 at 01:33 +0200, Martin Jansa wrote:
> * in form which can be copied into a recipe without modification
> * like oe-classic did since:
>   http://git.openembedded.org/openembedded/commit/?id=68abc465559a68e9201c9525be3c4acc6297eaed
> * it shows them in right form when they are missing completely, but in
>   more verbose form when different
> * it needs to print that only when checksums were requested, e.g.
>   fetching from sstate mirror sets both md5mismatch and sha256mismatch,
>   but your checksums shouldn't be shown
> 
> Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
> ---
>  lib/bb/fetch2/__init__.py |    6 ++++++
>  1 files changed, 6 insertions(+), 0 deletions(-)

Merged to master, thanks.

Richard

Patch

diff --git a/lib/bb/fetch2/__init__.py b/lib/bb/fetch2/__init__.py
index fa963be..31602fe 100644
--- a/lib/bb/fetch2/__init__.py
+++ b/lib/bb/fetch2/__init__.py
@@ -342,11 +342,17 @@  def verify_checksum(u, ud, d):
     # We want to alert the user if a checksum is defined in the recipe but
     # it does not match.
     msg = ""
+    mismatch = False
     if md5mismatch and ud.md5_expected:
         msg = msg + "\nFile: '%s' has %s checksum %s when %s was expected" % (ud.localpath, 'md5', md5data, ud.md5_expected)
+        mismatch = True;
 
     if sha256mismatch and ud.sha256_expected:
         msg = msg + "\nFile: '%s' has %s checksum %s when %s was expected" % (ud.localpath, 'sha256', sha256data, ud.sha256_expected)
+        mismatch = True;
+
+    if mismatch:
+        msg = msg + '\nYour checksums:\nSRC_URI[%s] = "%s"\nSRC_URI[%s] = "%s"' % (ud.md5_name, md5data, ud.sha256_name, sha256data)
 
     if len(msg):
         raise ChecksumError('Checksum mismatch!%s' % msg, u)