From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mail.openembedded.org (Postfix) with ESMTP id 7FD9165D58 for ; Thu, 9 Oct 2014 20:22:21 +0000 (UTC) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga103.fm.intel.com with ESMTP; 09 Oct 2014 13:12:21 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.97,862,1389772800"; d="scan'208,217";a="397822637" Received: from aehernan-devstation.zpn.intel.com (HELO [10.219.4.60]) ([10.219.4.60]) by FMSMGA003.fm.intel.com with ESMTP; 09 Oct 2014 13:15:15 -0700 Message-ID: <5436EE92.1010308@linux.intel.com> Date: Thu, 09 Oct 2014 15:22:42 -0500 From: Alejandro Hernandez User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.0 MIME-Version: 1.0 To: Christopher Larson References: <1412094118-27406-1-git-send-email-alejandro.hernandez@linux.intel.com> In-Reply-To: Cc: bitbake-devel@lists.openembedded.org Subject: Re: [PATCH v2] fetcher: fix BB_STRICT_CHECKSUM datatype check X-BeenThere: bitbake-devel@lists.openembedded.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: Patches and discussion that advance bitbake development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Oct 2014 20:22:27 -0000 Content-Type: multipart/alternative; boundary="------------070805080502050304080406" --------------070805080502050304080406 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit 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 > > wrote: > > Forcing strict to be a string, to avoid problems when performing > comparisons > > [YOCTO #6762] > > Signed-off-by: Alejandro Hernandez > > > --- > 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 --------------070805080502050304080406 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 8bit 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> 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

--------------070805080502050304080406--