diff mbox series

[1/1] base.bbclass: Fix dangling NATIVELSBSTRING

Message ID 8e3f56d34bb5941970bce8e43bfa43d38b2ba4b8.1676363155.git.liezhi.yang@windriver.com
State New
Headers show
Series [1/1] base.bbclass: Fix dangling NATIVELSBSTRING | expand

Commit Message

Robert Yang Feb. 14, 2023, 8:28 a.m. UTC
Fixed:
$ rm -fr tmp; bitbake quilt-native -n
Build Configuration:
[snip]
NATIVELSBSTRING      = "ubuntu-18.04"
[snip]

And when run bitbake again:
$ bitbake quilt-native -n
Build Configuration:
NATIVELSBSTRING      = "universal"

It has been changed from ubuntu-18.04 to universal on the same host and build
directory, this is because it is overridded by NATIVELSBSTRING. This patch
makes it print the correct value.

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
---
 meta/classes-global/base.bbclass | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

Comments

Richard Purdie Feb. 14, 2023, 8:44 a.m. UTC | #1
On Tue, 2023-02-14 at 00:28 -0800, Robert Yang wrote:
> Fixed:
> $ rm -fr tmp; bitbake quilt-native -n
> Build Configuration:
> [snip]
> NATIVELSBSTRING      = "ubuntu-18.04"
> [snip]
> 
> And when run bitbake again:
> $ bitbake quilt-native -n
> Build Configuration:
> NATIVELSBSTRING      = "universal"
> 
> It has been changed from ubuntu-18.04 to universal on the same host and build
> directory, this is because it is overridded by NATIVELSBSTRING. This patch
> makes it print the correct value.
> 
> Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
> ---
>  meta/classes-global/base.bbclass | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/meta/classes-global/base.bbclass b/meta/classes-global/base.bbclass
> index 64e805c947..cf42d9d4d2 100644
> --- a/meta/classes-global/base.bbclass
> +++ b/meta/classes-global/base.bbclass
> @@ -226,7 +226,12 @@ BUILDCFG_FUNCS[type] = "list"
>  def buildcfg_vars(d):
>      statusvars = oe.data.typed_value('BUILDCFG_VARS', d)
>      for var in statusvars:
> -        value = d.getVar(var)
> +        # NATIVELSBSTRING var may have been overridden with "universal", so
> +        # get actual host distribution id and version
> +        if var == 'NATIVELSBSTRING':
> +            value = lsb_distro_identifier(d)
> +        else:
> +            value = d.getVar(var)
>          if value is not None:
>              yield '%-20s = "%s"' % (var, value)

The uninative code runs "late" and this is an known issue, there is an
open bug for it if I remember correctly. 

I don't really want to put hacks into the BUILDCFG display code to work
around it since it is just going to make it less clear what is going on
and is also likely to break if we evern change the way NATIVELSBSTRING
is set. If you really don't like this, we should fix it properly some
other way rather than work around it.

Cheers,

Richard
Robert Yang Feb. 14, 2023, 9:44 a.m. UTC | #2
Hi RP,

On 2/14/23 16:44, Richard Purdie wrote:
> On Tue, 2023-02-14 at 00:28 -0800, Robert Yang wrote:
>> Fixed:
>> $ rm -fr tmp; bitbake quilt-native -n
>> Build Configuration:
>> [snip]
>> NATIVELSBSTRING      = "ubuntu-18.04"
>> [snip]
>>
>> And when run bitbake again:
>> $ bitbake quilt-native -n
>> Build Configuration:
>> NATIVELSBSTRING      = "universal"
>>
>> It has been changed from ubuntu-18.04 to universal on the same host and build
>> directory, this is because it is overridded by NATIVELSBSTRING. This patch
>> makes it print the correct value.
>>
>> Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
>> ---
>>   meta/classes-global/base.bbclass | 7 ++++++-
>>   1 file changed, 6 insertions(+), 1 deletion(-)
>>
>> diff --git a/meta/classes-global/base.bbclass b/meta/classes-global/base.bbclass
>> index 64e805c947..cf42d9d4d2 100644
>> --- a/meta/classes-global/base.bbclass
>> +++ b/meta/classes-global/base.bbclass
>> @@ -226,7 +226,12 @@ BUILDCFG_FUNCS[type] = "list"
>>   def buildcfg_vars(d):
>>       statusvars = oe.data.typed_value('BUILDCFG_VARS', d)
>>       for var in statusvars:
>> -        value = d.getVar(var)
>> +        # NATIVELSBSTRING var may have been overridden with "universal", so
>> +        # get actual host distribution id and version
>> +        if var == 'NATIVELSBSTRING':
>> +            value = lsb_distro_identifier(d)
>> +        else:
>> +            value = d.getVar(var)
>>           if value is not None:
>>               yield '%-20s = "%s"' % (var, value)
> 
> The uninative code runs "late" and this is an known issue, there is an
> open bug for it if I remember correctly.
> 
> I don't really want to put hacks into the BUILDCFG display code to work
> around it since it is just going to make it less clear what is going on
> and is also likely to break if we evern change the way NATIVELSBSTRING
> is set. If you really don't like this, we should fix it properly some
> other way rather than work around it.

I'd like to drop the patch since it doesn't affect the build.

// Robert

> 
> Cheers,
> 
> Richard
diff mbox series

Patch

diff --git a/meta/classes-global/base.bbclass b/meta/classes-global/base.bbclass
index 64e805c947..cf42d9d4d2 100644
--- a/meta/classes-global/base.bbclass
+++ b/meta/classes-global/base.bbclass
@@ -226,7 +226,12 @@  BUILDCFG_FUNCS[type] = "list"
 def buildcfg_vars(d):
     statusvars = oe.data.typed_value('BUILDCFG_VARS', d)
     for var in statusvars:
-        value = d.getVar(var)
+        # NATIVELSBSTRING var may have been overridden with "universal", so
+        # get actual host distribution id and version
+        if var == 'NATIVELSBSTRING':
+            value = lsb_distro_identifier(d)
+        else:
+            value = d.getVar(var)
         if value is not None:
             yield '%-20s = "%s"' % (var, value)