diff mbox series

[v2] sstatesig: Fix pn and taskname derivation in find_siginfo

Message ID 20230704035806.2937-1-yang.xu@mediatek.com
State New
Headers show
Series [v2] sstatesig: Fix pn and taskname derivation in find_siginfo | expand

Commit Message

Yang Xu (徐扬) July 4, 2023, 3:58 a.m. UTC
From: Yang Xu <yang.xu@mediatek.com>

The `bb.siggen.compare_sigfiles` method transforms the key format from
`[mc:<mc_name>:][virtual:][native:]<recipe path>:<taskname>` to
`<recipe dir>/<recipe name>:<taskname>[:virtual][:native][:mc:<mc_name>]`
by `clean_basepaths`. However, `find_siginfo` uses the original format
to get the package name (pn) and task name.

This commit corrects the method for deriving the pn and task name in
`find_siginfo` and adds handling for multilib name.

Signed-off-by: Yang Xu <yang.xu@mediatek.com>
---
 meta/lib/oe/sstatesig.py | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

Comments

Ross Burton July 4, 2023, 11:19 a.m. UTC | #1
On 4 Jul 2023, at 04:58, Yang Xu via lists.openembedded.org <yang.xu=mediatek.com@lists.openembedded.org> wrote:
> 
> From: Yang Xu <yang.xu@mediatek.com>
> 
> The `bb.siggen.compare_sigfiles` method transforms the key format from
> `[mc:<mc_name>:][virtual:][native:]<recipe path>:<taskname>` to
> `<recipe dir>/<recipe name>:<taskname>[:virtual][:native][:mc:<mc_name>]`
> by `clean_basepaths`. However, `find_siginfo` uses the original format
> to get the package name (pn) and task name.
> 
> This commit corrects the method for deriving the pn and task name in
> `find_siginfo` and adds handling for multilib name.
> 
> Signed-off-by: Yang Xu <yang.xu@mediatek.com>
> ---
> meta/lib/oe/sstatesig.py | 17 ++++++++++++-----
> 1 file changed, 12 insertions(+), 5 deletions(-)
> 
> diff --git a/meta/lib/oe/sstatesig.py b/meta/lib/oe/sstatesig.py
> index f943df181e..f041a0c430 100644
> --- a/meta/lib/oe/sstatesig.py
> +++ b/meta/lib/oe/sstatesig.py
> @@ -321,11 +321,18 @@ def find_siginfo(pn, taskname, taskhashlist, d):
>     if not taskname:
>         # We have to derive pn and taskname
>         key = pn
> -        splitit = key.split('.bb:')
> -        taskname = splitit[1]
> -        pn = os.path.basename(splitit[0]).split('_')[0]
> -        if key.startswith('virtual:native:'):
> -            pn = pn + '-native'
> +        if key.count(':') >= 2:
> +            splitit, taskname, affix = key.split(':', 2)
> +        else:
> +            splitit, taskname = key.split(':', 1)
> +            affix = ''
> +        pn = os.path.splitext(os.path.basename(splitit))[0].split('_')[0]
> +        affixitems = affix.split(':')
> +        if affixitems[0] == 'virtual':
> +            if affixitems[1] == 'native':
> +                pn = pn + '-native'
> +            if affixitems[1] == 'multilib':
> +                pn = affixitems[2] + '-' + pn

How did you notice this problem, what’s the actual change between this and v1, and more importantly can we add a test case for this obviously complex code?

Ross
Yang Xu (徐扬) July 4, 2023, 1:56 p.m. UTC | #2
When I investiage some package tasks cache missing problem by bitbake-diffsigs, I found that 'find_siginfo' called by bitbake-diffsigs is unable to construct the correct package name(pn) when dealing with virtual targets.

Patch v2 introduces handling for 'lib64-' and 'lib32-' case besides '-native' case.

And for test case, I'm currently not familiar with oe-selftest.However, I will learn how to add test case to oe-selftest and will attempt to write a test case for this.

Thank you.

Yang

On Tue, 2023-07-04 at 11:19 +0000, Ross Burton wrote:

> The `bb.siggen.compare_sigfiles` method transforms the key format from

> `[mc:<mc_name>:][virtual:][native:]<recipe path>:<taskname>` to

> `<recipe dir>/<recipe name>:<taskname>[:virtual][:native][:mc:<mc_name>]`

> by `clean_basepaths`. However, `find_siginfo` uses the original format

> to get the package name (pn) and task name.

>

> This commit corrects the method for deriving the pn and task name in

> `find_siginfo` and adds handling for multilib name.

>

> Signed-off-by: Yang Xu <yang.xu@mediatek.com>

> ---

> meta/lib/oe/sstatesig.py | 17 ++++++++++++-----

> 1 file changed, 12 insertions(+), 5 deletions(-)

>

> diff --git a/meta/lib/oe/sstatesig.py b/meta/lib/oe/sstatesig.py

> index f943df181e..f041a0c430 100644

> --- a/meta/lib/oe/sstatesig.py

> +++ b/meta/lib/oe/sstatesig.py

> @@ -321,11 +321,18 @@ def find_siginfo(pn, taskname, taskhashlist, d):

>     if not taskname:

>         # We have to derive pn and taskname

>         key = pn

> -        splitit = key.split('.bb:')

> -        taskname = splitit[1]

> -        pn = os.path.basename(splitit[0]).split('_')[0]

> -        if key.startswith('virtual:native:'):

> -            pn = pn + '-native'

> +        if key.count(':') >= 2:

> +            splitit, taskname, affix = key.split(':', 2)

> +        else:

> +            splitit, taskname = key.split(':', 1)

> +            affix = ''

> +        pn = os.path.splitext(os.path.basename(splitit))[0].split('_')[0]

> +        affixitems = affix.split(':')

> +        if affixitems[0] == 'virtual':

> +            if affixitems[1] == 'native':

> +                pn = pn + '-native'

> +            if affixitems[1] == 'multilib':

> +                pn = affixitems[2] + '-' + pn


How did you notice this problem, what’s the actual change between this and v1, and more importantly can we add a test case for this obviously complex code?


Ross
diff mbox series

Patch

diff --git a/meta/lib/oe/sstatesig.py b/meta/lib/oe/sstatesig.py
index f943df181e..f041a0c430 100644
--- a/meta/lib/oe/sstatesig.py
+++ b/meta/lib/oe/sstatesig.py
@@ -321,11 +321,18 @@  def find_siginfo(pn, taskname, taskhashlist, d):
     if not taskname:
         # We have to derive pn and taskname
         key = pn
-        splitit = key.split('.bb:')
-        taskname = splitit[1]
-        pn = os.path.basename(splitit[0]).split('_')[0]
-        if key.startswith('virtual:native:'):
-            pn = pn + '-native'
+        if key.count(':') >= 2:
+            splitit, taskname, affix = key.split(':', 2)
+        else:
+            splitit, taskname = key.split(':', 1)
+            affix = ''
+        pn = os.path.splitext(os.path.basename(splitit))[0].split('_')[0]
+        affixitems = affix.split(':')
+        if affixitems[0] == 'virtual':
+            if affixitems[1] == 'native':
+                pn = pn + '-native'
+            if affixitems[1] == 'multilib':
+                pn = affixitems[2] + '-' + pn
 
     hashfiles = {}
     filedates = {}