[Toaster] [PATCH] toaster: resolve missing 'native[sdk]:' prefixes

Joshua Lock joshua.g.lock at linux.intel.com
Mon Jan 23 08:50:24 PST 2017


On Fri, 2017-01-20 at 21:18 +0000, Reyna, David wrote:
> Some task events are missing the 'virtual:native[sdk]:' prefixes.
> The Toaster has code to help match missing prefixes, but needs
> additional help resolving between 'native:' and 'nativesdk:', by
> way of the '_package' event field.
> 
> [YOCTO #10849]
> 
> Signed-off-by: David Reyna <David.Reyna at windriver.com>
> ---
>  bitbake/lib/bb/ui/buildinfohelper.py | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/bitbake/lib/bb/ui/buildinfohelper.py
> b/bitbake/lib/bb/ui/buildinfohelper.py
> index 5ed150d..f1fc551 100644
> --- a/bitbake/lib/bb/ui/buildinfohelper.py
> +++ b/bitbake/lib/bb/ui/buildinfohelper.py
> @@ -1258,6 +1258,15 @@ class BuildInfoHelper(object):
>                  candidates = [x for x in
> self.internal_state['taskdata'].keys() if x.endswith(identifier)]
>                  if len(candidates) == 1:
>                      identifier = candidates[0]
> +                # break tie if missing 'native[sdk]:' prefix
> +                if (len(candidates) == 2) and
> hasattr(event,'_package'):
> +                    if (0 <= str(event._package).find('native-')):

Do we really need to create a new string object frmo event._package?
Isn't it already a string? What else might it be? None?

I think this might be more idiomatic Python if it were something like:

if event._package and event._package.startswith("native-"):

or, if the native- component isn't at the start

if event._package and "native-" in event._package:

> +                        identifier = 'native:' + identifier
> +                    if (0 <= str(event._package).find('nativesdk-
> ')):
> +                        identifier = 'nativesdk:' + identifier
> +                    candidates = [x for x in
> self.internal_state['taskdata'].keys() if x.endswith(identifier)]
> +                    if len(candidates) == 1:
> +                        identifier = candidates[0]
>  
>          assert identifier in self.internal_state['taskdata']
>          identifierlist = identifier.split(":")
> -- 
> 1.9.1


More information about the toaster mailing list