All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] fetcher: fix BB_STRICT_CHECKSUM datatype check
@ 2014-09-30 16:21 Alejandro Hernandez
  2014-10-08 16:13 ` Christopher Larson
  0 siblings, 1 reply; 5+ messages in thread
From: Alejandro Hernandez @ 2014-09-30 16:21 UTC (permalink / raw)
  To: bitbake-devel

Forcing strict to be a string, to avoid problems when performing comparisons

[YOCTO #6762]

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

diff --git a/lib/bb/fetch2/__init__.py b/lib/bb/fetch2/__init__.py
index df2f2b0..10c3346 100644
--- a/lib/bb/fetch2/__init__.py
+++ b/lib/bb/fetch2/__init__.py
@@ -543,8 +543,8 @@ 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):
+        strict = d.getVar("BB_STRICT_CHECKSUM", "1") or "0"
+        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] 5+ messages in thread

* Re: [PATCH v2] fetcher: fix BB_STRICT_CHECKSUM datatype check
  2014-09-30 16:21 [PATCH v2] fetcher: fix BB_STRICT_CHECKSUM datatype check Alejandro Hernandez
@ 2014-10-08 16:13 ` Christopher Larson
  2014-10-09 20:22   ` Alejandro Hernandez
  0 siblings, 1 reply; 5+ messages in thread
From: Christopher Larson @ 2014-10-08 16:13 UTC (permalink / raw)
  To: Alejandro Hernandez; +Cc: bitbake-devel@lists.openembedded.org

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

On Tue, Sep 30, 2014 at 9:21 AM, Alejandro Hernandez <
alejandro.hernandez@linux.intel.com> wrote:

> Forcing strict to be a string, to avoid problems when performing
> comparisons
>
> [YOCTO #6762]
>
> Signed-off-by: Alejandro Hernandez <alejandro.hernandez@linux.intel.com>
> ---
>  lib/bb/fetch2/__init__.py | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/lib/bb/fetch2/__init__.py b/lib/bb/fetch2/__init__.py
> index df2f2b0..10c3346 100644
> --- a/lib/bb/fetch2/__init__.py
> +++ b/lib/bb/fetch2/__init__.py
> @@ -543,8 +543,8 @@ 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):
> +        strict = d.getVar("BB_STRICT_CHECKSUM", "1") or "0"
> +        if (strict == "1") and not (ud.md5_expected or
> ud.sha256_expected):
>

Why was True (second argument of getVar) changed to "1" here? It violates
our conventions and doesn't actually change anything in the behavior.
-- 
Christopher Larson
clarson at kergoth dot com
Founder - BitBake, OpenEmbedded, OpenZaurus
Maintainer - Tslib
Senior Software Engineer, Mentor Graphics

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

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

* Re: [PATCH v2] fetcher: fix BB_STRICT_CHECKSUM datatype check
  2014-10-08 16:13 ` Christopher Larson
@ 2014-10-09 20:22   ` Alejandro Hernandez
  2014-10-09 20:27     ` Christopher Larson
  0 siblings, 1 reply; 5+ messages in thread
From: Alejandro Hernandez @ 2014-10-09 20:22 UTC (permalink / raw)
  To: Christopher Larson; +Cc: bitbake-devel

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

It does not change behavior but it forces the value to be a string, 
avoiding related problems when performing comparisons on "strict", 
another option as Richard Purdie suggested would be to import the 
boolean function from /meta/lib/oe/types.py in OE-Core into a new types 
module in bitbake, forcing it to get a "good" value that we could then use.

On 08/10/14 11:13, Christopher Larson wrote:
>
> On Tue, Sep 30, 2014 at 9:21 AM, Alejandro Hernandez 
> <alejandro.hernandez@linux.intel.com 
> <mailto:alejandro.hernandez@linux.intel.com>> wrote:
>
>     Forcing strict to be a string, to avoid problems when performing
>     comparisons
>
>     [YOCTO #6762]
>
>     Signed-off-by: Alejandro Hernandez
>     <alejandro.hernandez@linux.intel.com
>     <mailto:alejandro.hernandez@linux.intel.com>>
>     ---
>      lib/bb/fetch2/__init__.py | 4 ++--
>      1 file changed, 2 insertions(+), 2 deletions(-)
>
>     diff --git a/lib/bb/fetch2/__init__.py b/lib/bb/fetch2/__init__.py
>     index df2f2b0..10c3346 100644
>     --- a/lib/bb/fetch2/__init__.py
>     +++ b/lib/bb/fetch2/__init__.py
>     @@ -543,8 +543,8 @@ 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):
>     + strict = d.getVar("BB_STRICT_CHECKSUM", "1") or "0"
>     +        if (strict == "1") and not (ud.md5_expected or
>     ud.sha256_expected):
>
>
> Why was True (second argument of getVar) changed to "1" here? It 
> violates our conventions and doesn't actually change anything in the 
> behavior.
> -- 
> Christopher Larson
> clarson at kergoth dot com
> Founder - BitBake, OpenEmbedded, OpenZaurus
> Maintainer - Tslib
> Senior Software Engineer, Mentor Graphics


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

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

* Re: [PATCH v2] fetcher: fix BB_STRICT_CHECKSUM datatype check
  2014-10-09 20:22   ` Alejandro Hernandez
@ 2014-10-09 20:27     ` Christopher Larson
  2014-10-09 20:38       ` Alejandro Hernandez
  0 siblings, 1 reply; 5+ messages in thread
From: Christopher Larson @ 2014-10-09 20:27 UTC (permalink / raw)
  To: Alejandro Hernandez; +Cc: bitbake-devel@lists.openembedded.org

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

On Thu, Oct 9, 2014 at 1:22 PM, Alejandro Hernandez <
alejandro.hernandez@linux.intel.com> wrote:

> It does not change behavior but it forces the value to be a string,
> avoiding related problems when performing comparisons on "strict", another
> option as Richard Purdie suggested would be to import the boolean function
> from /meta/lib/oe/types.py in OE-Core into a new types module in bitbake,
> forcing it to get a "good" value that we could then use.


No, that's incorrect. The second argument of getVar is a boolean argument
named 'expand', which controls whether you get an expanded or unexpanded
value. You're now passing a string in boolean context.
-- 
Christopher Larson
clarson at kergoth dot com
Founder - BitBake, OpenEmbedded, OpenZaurus
Maintainer - Tslib
Senior Software Engineer, Mentor Graphics

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

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

* Re: [PATCH v2] fetcher: fix BB_STRICT_CHECKSUM datatype check
  2014-10-09 20:27     ` Christopher Larson
@ 2014-10-09 20:38       ` Alejandro Hernandez
  0 siblings, 0 replies; 5+ messages in thread
From: Alejandro Hernandez @ 2014-10-09 20:38 UTC (permalink / raw)
  To: Christopher Larson; +Cc: bitbake-devel@lists.openembedded.org

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

That is very true, I will fix that, thanks for pointing it out.

On 09/10/14 15:27, Christopher Larson wrote:
>
> On Thu, Oct 9, 2014 at 1:22 PM, Alejandro Hernandez 
> <alejandro.hernandez@linux.intel.com 
> <mailto:alejandro.hernandez@linux.intel.com>> wrote:
>
>     It does not change behavior but it forces the value to be a
>     string, avoiding related problems when performing comparisons on
>     "strict", another option as Richard Purdie suggested would be to
>     import the boolean function from /meta/lib/oe/types.py in OE-Core
>     into a new types module in bitbake, forcing it to get a "good"
>     value that we could then use.
>
>
> No, that's incorrect. The second argument of getVar is a boolean 
> argument named 'expand', which controls whether you get an expanded or 
> unexpanded value. You're now passing a string in boolean context.
> -- 
> Christopher Larson
> clarson at kergoth dot com
> Founder - BitBake, OpenEmbedded, OpenZaurus
> Maintainer - Tslib
> Senior Software Engineer, Mentor Graphics


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

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

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

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-30 16:21 [PATCH v2] fetcher: fix BB_STRICT_CHECKSUM datatype check Alejandro Hernandez
2014-10-08 16:13 ` Christopher Larson
2014-10-09 20:22   ` Alejandro Hernandez
2014-10-09 20:27     ` Christopher Larson
2014-10-09 20:38       ` Alejandro Hernandez

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.