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

Submitted by Reyna, David on Jan. 20, 2017, 9:18 p.m. | Patch ID: 136217

Details

Message ID 5E53D14CE4667A45B9A06760DE5D13D0C3311DCC@ALA-MBA.corp.ad.wrs.com
State Superseded
Headers show

Commit Message

Reyna, David Jan. 20, 2017, 9:18 p.m.
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@windriver.com>
---
 bitbake/lib/bb/ui/buildinfohelper.py | 9 +++++++++
 1 file changed, 9 insertions(+)

Patch hide | download patch | download mbox

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-')):
+                        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(":")

Comments

Joshua Lock Jan. 23, 2017, 4:50 p.m.
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@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
Reyna, David Feb. 15, 2017, 5:04 p.m.
This is a system generated Comment: Patch 136217 was automatically marked as superseded by patch 137188.