All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] fetcher: fix BB_STRICT_CHECKSUM datatype check
@ 2014-09-25 23:14 Alejandro Hernandez
  2014-09-25 23:46 ` Christopher Larson
  2014-09-26 12:10 ` Richard Purdie
  0 siblings, 2 replies; 3+ messages in thread
From: Alejandro Hernandez @ 2014-09-25 23:14 UTC (permalink / raw)
  To: bitbake-devel

[YOCTO #6762]

Signed-off-by: Alejandro Hernandez <alejandro.hernandez@linux.intel.com>
---
 lib/bb/fetch2/__init__.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/bb/fetch2/__init__.py b/lib/bb/fetch2/__init__.py
index df2f2b0..e182a9d 100644
--- a/lib/bb/fetch2/__init__.py
+++ b/lib/bb/fetch2/__init__.py
@@ -544,7 +544,7 @@ 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 not (ud.md5_expected or ud.sha256_expected):
+        if (strict == 1) and not (ud.md5_expected or ud.sha256_expected):
             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,
-- 
1.9.1



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

* Re: [PATCH] fetcher: fix BB_STRICT_CHECKSUM datatype check
  2014-09-25 23:14 [PATCH] fetcher: fix BB_STRICT_CHECKSUM datatype check Alejandro Hernandez
@ 2014-09-25 23:46 ` Christopher Larson
  2014-09-26 12:10 ` Richard Purdie
  1 sibling, 0 replies; 3+ messages in thread
From: Christopher Larson @ 2014-09-25 23:46 UTC (permalink / raw)
  To: Alejandro Hernandez; +Cc: bitbake-devel@lists.openembedded.org

[-- Attachment #1: Type: text/plain, Size: 585 bytes --]

On Thu, Sep 25, 2014 at 4:14 PM, Alejandro Hernandez <
alejandro.hernandez@linux.intel.com> wrote:

> -        if strict and not (ud.md5_expected or ud.sha256_expected):
> +        if (strict == 1) and not (ud.md5_expected or ud.sha256_expected):
>

I realize python allows it, but I think it's pretty amusing that the
subject line mentions correcting the data type, and then you compare a
string to an integer ;)
-- 
Christopher Larson
clarson at kergoth dot com
Founder - BitBake, OpenEmbedded, OpenZaurus
Maintainer - Tslib
Senior Software Engineer, Mentor Graphics

[-- Attachment #2: Type: text/html, Size: 960 bytes --]

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

* Re: [PATCH] fetcher: fix BB_STRICT_CHECKSUM datatype check
  2014-09-25 23:14 [PATCH] fetcher: fix BB_STRICT_CHECKSUM datatype check Alejandro Hernandez
  2014-09-25 23:46 ` Christopher Larson
@ 2014-09-26 12:10 ` Richard Purdie
  1 sibling, 0 replies; 3+ messages in thread
From: Richard Purdie @ 2014-09-26 12:10 UTC (permalink / raw)
  To: Alejandro Hernandez; +Cc: bitbake-devel

On Thu, 2014-09-25 at 18:14 -0500, Alejandro Hernandez wrote:
> [YOCTO #6762]
> 
> Signed-off-by: Alejandro Hernandez <alejandro.hernandez@linux.intel.com>
> ---
>  lib/bb/fetch2/__init__.py | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/bb/fetch2/__init__.py b/lib/bb/fetch2/__init__.py
> index df2f2b0..e182a9d 100644
> --- a/lib/bb/fetch2/__init__.py
> +++ b/lib/bb/fetch2/__init__.py
> @@ -544,7 +544,7 @@ 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 not (ud.md5_expected or ud.sha256_expected):
> +        if (strict == 1) and not (ud.md5_expected or ud.sha256_expected):
>              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,

This gets slightly tricky since the value can be a string or an integer
or "None". This needs to work if strict = "1" as well as strict = 1 for
example.

I'm thinking we should perhaps import the boolean function from
meta/lib/oe/types.py in OE-Core into a new types module in bitbake, as
well as perhaps allowing the function to accept integers of 0 (False)
and other than 0 (True) and accepting "None" as False.

We could then use this function here to get a "good" value for the
field. There are a number of other places we should really start using a
standardised function too...

From the bigger picture perspective, we've long since wanted to have
better typed variables, there is a bit more planning needed for that
however this would be a good step towards it IMO.

Cheers,

Richard



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

end of thread, other threads:[~2014-09-26 12:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-25 23:14 [PATCH] fetcher: fix BB_STRICT_CHECKSUM datatype check Alejandro Hernandez
2014-09-25 23:46 ` Christopher Larson
2014-09-26 12:10 ` Richard Purdie

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.