All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] SRC_URI checksum handling fixes
@ 2013-12-20 14:48 Paul Eggleton
  2013-12-20 14:48 ` [PATCH 1/2] fetch2: fail checksum validation if SRC_URI checksums set to "" Paul Eggleton
  2013-12-20 14:48 ` [PATCH 2/2] fetch2: avoid printing "no checksum" error message twice Paul Eggleton
  0 siblings, 2 replies; 3+ messages in thread
From: Paul Eggleton @ 2013-12-20 14:48 UTC (permalink / raw)
  To: bitbake-devel

The following changes since commit 4cc6e61fe11eb233bdba7c1bdc110b8cdafa56f8:

  Update to version 1.21.1 for master (2013-12-20 12:23:12 +0000)

are available in the git repository at:

  git://git.yoctoproject.org/poky-contrib paule/bb-fetch-checksums
  http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=paule/bb-fetch-checksums

Paul Eggleton (2):
  fetch2: fail checksum validation if SRC_URI checksums set to ""
  fetch2: avoid printing "no checksum" error message twice

 lib/bb/fetch2/__init__.py | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

-- 
1.8.1.2



^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 1/2] fetch2: fail checksum validation if SRC_URI checksums set to ""
  2013-12-20 14:48 [PATCH 0/2] SRC_URI checksum handling fixes Paul Eggleton
@ 2013-12-20 14:48 ` Paul Eggleton
  2013-12-20 14:48 ` [PATCH 2/2] fetch2: avoid printing "no checksum" error message twice Paul Eggleton
  1 sibling, 0 replies; 3+ messages in thread
From: Paul Eggleton @ 2013-12-20 14:48 UTC (permalink / raw)
  To: bitbake-devel

We were checking SRC_URI md5sum/sha256sum values against None here, so
if they were set to "" then no error was produced. Since the value is
still effectively unset in this case, this is not the right behaviour;
just check if the value doesn't evaluate to False instead.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
---
 lib/bb/fetch2/__init__.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/bb/fetch2/__init__.py b/lib/bb/fetch2/__init__.py
index 199cdca..6c6915c 100644
--- a/lib/bb/fetch2/__init__.py
+++ b/lib/bb/fetch2/__init__.py
@@ -526,19 +526,19 @@ def verify_checksum(ud, d):
     if ud.method.recommends_checksum(ud):
         # If strict checking enabled and neither sum defined, raise error
         strict = d.getVar("BB_STRICT_CHECKSUM", True) or None
-        if (strict and ud.md5_expected == None and ud.sha256_expected == None):
+        if strict and not (ud.md5_expected or ud.sha256_expected):
             raise NoChecksumError('No checksum specified for %s, please add at least one to the recipe:\n'
                              'SRC_URI[%s] = "%s"\nSRC_URI[%s] = "%s"' %
                              (ud.localpath, ud.md5_name, md5data,
                               ud.sha256_name, sha256data), ud.url)
 
         # Log missing sums so user can more easily add them
-        if ud.md5_expected == None:
+        if not ud.md5_expected:
             logger.warn('Missing md5 SRC_URI checksum for %s, consider adding to the recipe:\n'
                         'SRC_URI[%s] = "%s"',
                         ud.localpath, ud.md5_name, md5data)
 
-        if ud.sha256_expected == None:
+        if not ud.sha256_expected:
             logger.warn('Missing sha256 SRC_URI checksum for %s, consider adding to the recipe:\n'
                         'SRC_URI[%s] = "%s"',
                         ud.localpath, ud.sha256_name, sha256data)
-- 
1.8.1.2



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/2] fetch2: avoid printing "no checksum" error message twice
  2013-12-20 14:48 [PATCH 0/2] SRC_URI checksum handling fixes Paul Eggleton
  2013-12-20 14:48 ` [PATCH 1/2] fetch2: fail checksum validation if SRC_URI checksums set to "" Paul Eggleton
@ 2013-12-20 14:48 ` Paul Eggleton
  1 sibling, 0 replies; 3+ messages in thread
From: Paul Eggleton @ 2013-12-20 14:48 UTC (permalink / raw)
  To: bitbake-devel

Because of the way we were handling this error, it was printed twice -
once via logger.error() (to avoid the log being printed) and a second
time when the exception gets wrapped in a FuncFailed at a higher level.
Call logger.error() earlier and change the text we send in the
exception to be more brief, so it more closely resembles the behaviour
when there is an invalid checksum.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
---
 lib/bb/fetch2/__init__.py | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/lib/bb/fetch2/__init__.py b/lib/bb/fetch2/__init__.py
index 6c6915c..8fdf59c 100644
--- a/lib/bb/fetch2/__init__.py
+++ b/lib/bb/fetch2/__init__.py
@@ -527,10 +527,11 @@ def verify_checksum(ud, d):
         # If strict checking enabled and neither sum defined, raise error
         strict = d.getVar("BB_STRICT_CHECKSUM", True) or None
         if strict and not (ud.md5_expected or ud.sha256_expected):
-            raise NoChecksumError('No checksum specified for %s, please add at least one to the recipe:\n'
+            logger.error('No checksum specified for %s, please add at least one to the recipe:\n'
                              'SRC_URI[%s] = "%s"\nSRC_URI[%s] = "%s"' %
                              (ud.localpath, ud.md5_name, md5data,
-                              ud.sha256_name, sha256data), ud.url)
+                              ud.sha256_name, sha256data))
+            raise NoChecksumError('Missing SRC_URI checksum', ud.url)
 
         # Log missing sums so user can more easily add them
         if not ud.md5_expected:
@@ -1424,9 +1425,7 @@ class Fetch(object):
                 update_stamp(ud, self.d)
 
             except BBFetchException as e:
-                if isinstance(e, NoChecksumError):
-                    logger.error("%s" % str(e))
-                elif isinstance(e, ChecksumError):
+                if isinstance(e, ChecksumError):
                     logger.error("Checksum failure fetching %s" % u)
                 raise
 
-- 
1.8.1.2



^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-12-20 14:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-20 14:48 [PATCH 0/2] SRC_URI checksum handling fixes Paul Eggleton
2013-12-20 14:48 ` [PATCH 1/2] fetch2: fail checksum validation if SRC_URI checksums set to "" Paul Eggleton
2013-12-20 14:48 ` [PATCH 2/2] fetch2: avoid printing "no checksum" error message twice Paul Eggleton

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.