[OE-core] [PATCH 4/4] sanity.bbclass: fix check_connectivity() for BB_NO_NETWORK = "0"
Christopher Larson
clarson at kergoth.com
Mon Nov 14 15:38:46 UTC 2016
On Mon, Nov 14, 2016 at 8:37 AM, Robert Yang <liezhi.yang at windriver.com>
wrote:
> On 11/14/2016 11:03 PM, Christopher Larson wrote:
>
>>
>> On Mon, Nov 14, 2016 at 7:34 AM, Robert Yang <liezhi.yang at windriver.com
>> <mailto:liezhi.yang at windriver.com>> wrote:
>>
>> The old code:
>> network_enabled = not d.getVar('BB_NO_NETWORK', True)
>>
>> It is True only when BB_NO_NETWORK is not set (None),
>> but BB_NO_NETWORK = "0" should also be True while "1" means no
>> network,
>> "0" means need network in a normal case.
>>
>> Signed-off-by: Robert Yang <liezhi.yang at windriver.com
>> <mailto:liezhi.yang at windriver.com>>
>> ---
>> meta/classes/sanity.bbclass | 14 +++++++++-----
>> 1 file changed, 9 insertions(+), 5 deletions(-)
>>
>> diff --git a/meta/classes/sanity.bbclass b/meta/classes/sanity.bbclass
>> index 7e383f9..c5e3809 100644
>> --- a/meta/classes/sanity.bbclass
>> +++ b/meta/classes/sanity.bbclass
>> @@ -363,15 +363,19 @@ def check_connectivity(d):
>> test_uris = (d.getVar('CONNECTIVITY_CHECK_URIS', True) or
>> "").split()
>> retval = ""
>>
>> + bbn = d.getVar('BB_NO_NETWORK', True)
>> + if bbn not in (None, '0', '1'):
>> + return 'BB_NO_NETWORK should be "0" or "1", but it is "%s"'
>> % bbn
>>
>>
>> Does this mirror the same logic used in bitbake? What’s the behavior if
>> it’s
>> set, but to the empty string?
>>
>
> bitbake only checks whether it equals "1" or not. Without this patch, an
> empty
> string is the same as not set since it doesn't equal to "1". But if it is
> set to "0", bitbake uses it as enable network, sanity.bbclass uses it
> as disable netowrk, which are conflicted. We can add checking for empty
> string,
> but do we have to ? Limit it to "0" or "1" makes things clear.
IMO if we’re going to change the semantics, we should do it in bitbake and
then mirror that in the metadata. Sanity checking should mirror the actual
variable behavior where it’s used.
--
Christopher Larson
clarson at kergoth dot com
Founder - BitBake, OpenEmbedded, OpenZaurus
Maintainer - Tslib
Senior Software Engineer, Mentor Graphics
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openembedded.org/pipermail/openembedded-core/attachments/20161114/d4bf66b6/attachment-0002.html>
More information about the Openembedded-core
mailing list