Openembedded Bitbake Development
 help / color / mirror / Atom feed
From: Richard Purdie <richard.purdie@linuxfoundation.org>
To: Alejandro Hernandez <alejandro.hernandez@linux.intel.com>
Cc: bitbake-devel@lists.openembedded.org
Subject: Re: [PATCH] fetcher: fix BB_STRICT_CHECKSUM datatype check
Date: Fri, 26 Sep 2014 13:10:18 +0100	[thread overview]
Message-ID: <1411733418.4189.116.camel@ted> (raw)
In-Reply-To: <1411686885-8169-1-git-send-email-alejandro.hernandez@linux.intel.com>

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



      parent reply	other threads:[~2014-09-26 12:10 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1411733418.4189.116.camel@ted \
    --to=richard.purdie@linuxfoundation.org \
    --cc=alejandro.hernandez@linux.intel.com \
    --cc=bitbake-devel@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox