Skip to contentSkip to conversation

sstatesig: Fix pn and taskname derivation in find_siginfo

PATCH Superseded [email protected] 3 participants 6 messages Jul 7, 2023 – Jul 10, 2023

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 sstatesig: Fix pn and taskname derivation in find_siginfo

From: Yang Xu <[email protected]>

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.
And add test for compare_sigfiles and find_siginfo working together.

---
 .../recipes-test/binutils/binutils_%.bbappend |  2 +
 meta/lib/oe/sstatesig.py                      | 17 ++++--
 meta/lib/oeqa/selftest/cases/sstatetests.py   | 53 +++++++++++++++++++
 3 files changed, 67 insertions(+), 5 deletions(-)
 create mode 100644 meta-selftest/recipes-test/binutils/binutils_%.bbappend
meta-selftest/recipes-test/binutils/binutils_%.bbappend new file +2 -0
new file mode 100644
index 0000000000..205720982c
@@ -0,0 +1,2 @@
+# This bbappend is used to alter the recipe using the test_recipe.inc file created by tests.
+include test_recipe.inc
meta/lib/oe/sstatesig.py +12 -5
index f943df181e..f041a0c430 100644
@@ -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 = {}
meta/lib/oeqa/selftest/cases/sstatetests.py +53 -0

56 lines not on this page · raw message

Signature · 1 line
2.25.1
#1 lore raw

Hello,

Quoted 8 lines · Yang Xu via lists.openembedded.org

From: Yang Xu <[email protected]>

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.

Quoted 6 lines

This commit corrects the method for deriving the pn and task name in find_siginfo and adds handling for multilib name.
And add test for compare_sigfiles and find_siginfo working together.

---

Please always include a changelog in this location, else we can't know easily what changed since v2.

Quoted 116 lines
 .../recipes-test/binutils/binutils_%.bbappend |  2 +
 meta/lib/oe/sstatesig.py                      | 17 ++++--
 meta/lib/oeqa/selftest/cases/sstatetests.py   | 53 +++++++++++++++++++
 3 files changed, 67 insertions(+), 5 deletions(-)
 create mode 100644 meta-selftest/recipes-test/binutils/binutils_%.bbappend
meta-selftest/recipes-test/binutils/binutils_%.bbappend new file +2 -0
new file mode 100644
index 0000000000..205720982c
@@ -0,0 +1,2 @@
+# This bbappend is used to alter the recipe using the test_recipe.inc file created by tests.
+include test_recipe.inc
meta/lib/oe/sstatesig.py +12 -5
index f943df181e..f041a0c430 100644
@@ -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 = {}
meta/lib/oeqa/selftest/cases/sstatetests.py +53 -0
index febafdb2f7..818d8b623d 100644
@@ -691,3 +691,56 @@ TMPDIR = "${TOPDIR}/tmp-sstatesamehash2"
         self.maxDiff = None
         self.assertCountEqual(files1, files2)
 
+class SStateFindSiginfo(SStateBase):
+    def test_sstate_compare_sigfiles_and_find_siginfo(self):
+        """
+        Test the functionality of the find_siginfo: basic function and callback in compare_sigfiles
+        """
+        self.write_config("""
+TMPDIR = \"${TOPDIR}/tmp-sstates-findsiginfo\"
+TCLIBCAPPEND = \"\"
+MACHINE = \"qemux86\"
+require conf/multilib.conf
+MULTILIBS = "multilib:lib32"
+DEFAULTTUNE:virtclass-multilib-lib32 = "x86"
+BB_SIGNATURE_HANDLER = "OEBasicHash"
+""")
+        self.track_for_cleanup(self.topdir + "/tmp-sstates-findsiginfo")
+
+        pns = ["binutils", "binutils-native", "lib32-binutils"]
+
+        #forcing generate different stamps for binutils every time
+        self.write_recipeinc("binutils", 'do_fetch[nostamp] = "1"')
+        for pn in pns*2:
+            bitbake("%s -S none" % pn)
+        self.delete_recipeinc("binutils")
+
+        with bb.tinfoil.Tinfoil() as tinfoil:
+            tinfoil.prepare(config_only=True)
+
+            def find_siginfo(pn, taskname, sigs=None):
+                result = None
+                tinfoil.set_event_mask(["bb.event.FindSigInfoResult",
+                                "bb.command.CommandCompleted"])
+                ret = tinfoil.run_command("findSigInfo", pn, taskname, sigs)
+                if ret:
+                    while True:
+                        event = tinfoil.wait_event(1)
+                        if event:
+                            if isinstance(event, bb.command.CommandCompleted):
+                                break
+                            elif isinstance(event, bb.event.FindSigInfoResult):
+                                result = event.result
+                return result
+
+            def recursecb(key, hash1, hash2):
+                hashes = [hash1, hash2]
+                hashfiles = find_siginfo(key, None, hashes)
+                self.assertCountEqual(hashes, hashfiles)
+                bb.siggen.compare_sigfiles(hashfiles[hash1], hashfiles[hash2], recursecb)
+
+            for pn in pns:
+                filedates = find_siginfo(pn, "do_compile")
+                self.assertGreaterEqual(len(filedates), 2)
+                latestfiles = sorted(filedates.keys(), key=lambda f: filedates[f])[-2:]
+                bb.siggen.compare_sigfiles(latestfiles[-2], latestfiles[-1], recursecb)
Signature · 11 lines
2.25.1



-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#184001): https://lists.openembedded.org/g/openembedded-core/message/184001
Mute This Topic: https://lists.openembedded.org/mt/100001305/3617179
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-
Signature · 3 lines
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
author
#2 lore raw

Dear Alexandre,

Thank you for your reminder.

v1: correct handling for pn and taskname for native target in find_siginfo
v2: add handling for multilib target in find_siginfo
v3: add testcase for compare_sigfiles and find_siginfo work together.

Do I need submit a patch v4 to add these changlog information?

Thank you

#3 lore raw

No need, but please do add it in future patches.

Ross

Quoted 23 lines · Yang Xu via lists.openembedded.org

Dear Alexandre,

Thank you for your reminder.

v1: correct handling for pn and taskname for native target in find_siginfo
v2: add handling for multilib target in find_siginfo
v3: add testcase for compare_sigfiles and find_siginfo work together.

Do I need submit a patch v4 to add these changlog information?

Thank you

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#184039): https://lists.openembedded.org/g/openembedded-core/message/184039
Mute This Topic: https://lists.openembedded.org/mt/100001305/6875888
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#4 lore raw
In reply to Alexandre Belloni

Dear Alexandre,

Thank you for your reminder.

v1: correct handing for pn and taskname for native target in find_siginfo
v2: add handling for multilib target in find_siginfo
v3: add test for compare_sigfiles and find_siginfo work together

Do I need submit a patch v4 to add these changelog information?

Thank you

Quoted 172 lines · Alexandre Belloni

External email : Please do not click links or open attachments until you have verified the sender or the content.
Hello,

Quoted 3 lines · Yang Xu via lists.openembedded.org

From: Yang Xu <[email protected]>

The bb.siggen.compare_sigfiles method transforms the key format

from

Quoted 2 lines

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

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

Quoted 1 line

by clean_basepaths. However, find_siginfo uses the original

format

Quoted 3 lines

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

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

in

Quoted 2 lines

find_siginfo and adds handling for multilib name. And add test for compare_sigfiles and find_siginfo working

together.

Quoted 3 lines

---

Please always include a changelog in this location, else we can't know
easily what changed since v2.

Quoted 3 lines
 .../recipes-test/binutils/binutils_%.bbappend |  2 +
 meta/lib/oe/sstatesig.py                      | 17 ++++--
 meta/lib/oeqa/selftest/cases/sstatetests.py   | 53

+++++++++++++++++++

Quoted 2 lines
 3 files changed, 67 insertions(+), 5 deletions(-)
 create mode 100644 meta-selftest/recipes-

test/binutils/binutils_%.bbappend

Review

Quoted 2 lines
(quoted diff) +0 -0

test/binutils/binutils_%.bbappend b/meta-selftest/recipes- test/binutils/binutils_%.bbappend

meta-selftest/recipes-test/binutils/binutils_%.bbappend line 1

Quoted 6 lines

new file mode 100644
index 0000000000..205720982c

meta-selftest/recipes-test/binutils/binutils_%.bbappend new file +1 -0
@@ -0,0 +1,2 @@
+# This bbappend is used to alter the recipe using the

test_recipe.inc file created by tests.

meta/lib/oe/sstatesig.py def find_siginfo(pn, taskname, taskhashlist,

Quoted 6 lines
meta-selftest/recipes-test/binutils/binutils_%.bbappend new file +1 -0
+include test_recipe.inc
meta/lib/oe/sstatesig.py +0 -0
index f943df181e..f041a0c430 100644
@@ -321,11 +321,18 @@ def find_siginfo(pn, taskname, taskhashlist,

d):

Quoted 4 lines
meta/lib/oe/sstatesig.py +0 -1
     if not taskname:
         # We have to derive pn and taskname
         key = pn
-        splitit = key.split('.bb:')

meta/lib/oe/sstatesig.py def find_siginfo(pn, taskname, taskhashlist, d):

Quoted 10 lines
meta/lib/oe/sstatesig.py +6 -4
-        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]

Review

Quoted 10 lines
meta/lib/oe/sstatesig.py +6 -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 = {}
(quoted diff) +0 -0

b/meta/lib/oeqa/selftest/cases/sstatetests.py

meta/lib/oeqa/selftest/cases/sstatetests.py TMPDIR = "${TOPDIR}/tmp-sstatesamehash2" · line 697

Quoted 11 lines

index febafdb2f7..818d8b623d 100644

meta/lib/oeqa/selftest/cases/sstatetests.py +4 -0
@@ -691,3 +691,56 @@ TMPDIR = "${TOPDIR}/tmp-sstatesamehash2"
         self.maxDiff = None
         self.assertCountEqual(files1, files2)
 
+class SStateFindSiginfo(SStateBase):
+    def test_sstate_compare_sigfiles_and_find_siginfo(self):
+        """
+        Test the functionality of the find_siginfo: basic function

and callback in compare_sigfiles

meta/lib/oeqa/selftest/cases/sstatetests.py TMPDIR = "${TOPDIR}/tmp-sstatesamehash2"

Quoted 11 lines
meta/lib/oeqa/selftest/cases/sstatetests.py +11 -0
+        """
+        self.write_config("""
+TMPDIR = \"${TOPDIR}/tmp-sstates-findsiginfo\"
+TCLIBCAPPEND = \"\"
+MACHINE = \"qemux86\"
+require conf/multilib.conf
+MULTILIBS = "multilib:lib32"
+DEFAULTTUNE:virtclass-multilib-lib32 = "x86"
+BB_SIGNATURE_HANDLER = "OEBasicHash"
+""")
+        self.track_for_cleanup(self.topdir + "/tmp-sstates-

findsiginfo")

meta/lib/oeqa/selftest/cases/sstatetests.py TMPDIR = "${TOPDIR}/tmp-sstatesamehash2"

Quoted 5 lines
meta/lib/oeqa/selftest/cases/sstatetests.py +5 -0
+
+        pns = ["binutils", "binutils-native", "lib32-binutils"]
+
+        #forcing generate different stamps for binutils every time
+        self.write_recipeinc("binutils", 'do_fetch[nostamp] =

"1"')

meta/lib/oeqa/selftest/cases/sstatetests.py TMPDIR = "${TOPDIR}/tmp-sstatesamehash2" · line 722

Quoted 10 lines
meta/lib/oeqa/selftest/cases/sstatetests.py +9 -0
+        for pn in pns*2:
+            bitbake("%s -S none" % pn)
+        self.delete_recipeinc("binutils")
+
+        with bb.tinfoil.Tinfoil() as tinfoil:
+            tinfoil.prepare(config_only=True)
+
+            def find_siginfo(pn, taskname, sigs=None):
+                result = None

+ tinfoil.set_event_mask(["bb.event.FindSigInfoResult"
,

meta/lib/oeqa/selftest/cases/sstatetests.py TMPDIR = "${TOPDIR}/tmp-sstatesamehash2" · line 724

Quoted 2 lines
meta/lib/oeqa/selftest/cases/sstatetests.py +2 -0
+                                "bb.command.CommandCompleted"])
+                ret = tinfoil.run_command("findSigInfo", pn,

taskname, sigs)

meta/lib/oeqa/selftest/cases/sstatetests.py TMPDIR = "${TOPDIR}/tmp-sstatesamehash2"

Quoted 5 lines
meta/lib/oeqa/selftest/cases/sstatetests.py +5 -0
+                if ret:
+                    while True:
+                        event = tinfoil.wait_event(1)
+                        if event:
+                            if isinstance(event,

bb.command.CommandCompleted):

meta/lib/oeqa/selftest/cases/sstatetests.py TMPDIR = "${TOPDIR}/tmp-sstatesamehash2" · line 731

Quoted 2 lines
meta/lib/oeqa/selftest/cases/sstatetests.py +2 -0
+                                break
+                            elif isinstance(event,

bb.event.FindSigInfoResult):

meta/lib/oeqa/selftest/cases/sstatetests.py TMPDIR = "${TOPDIR}/tmp-sstatesamehash2"

Quoted 8 lines
meta/lib/oeqa/selftest/cases/sstatetests.py +8 -0
+                                result = event.result
+                return result
+
+            def recursecb(key, hash1, hash2):
+                hashes = [hash1, hash2]
+                hashfiles = find_siginfo(key, None, hashes)
+                self.assertCountEqual(hashes, hashfiles)
+                bb.siggen.compare_sigfiles(hashfiles[hash1],

hashfiles[hash2], recursecb)

meta/lib/oeqa/selftest/cases/sstatetests.py TMPDIR = "${TOPDIR}/tmp-sstatesamehash2"

Quoted 5 lines
meta/lib/oeqa/selftest/cases/sstatetests.py +5 -0
+
+            for pn in pns:
+                filedates = find_siginfo(pn, "do_compile")
+                self.assertGreaterEqual(len(filedates), 2)
+                latestfiles = sorted(filedates.keys(), key=lambda

f: filedates[f])[-2:]

meta/lib/oeqa/selftest/cases/sstatetests.py TMPDIR = "${TOPDIR}/tmp-sstatesamehash2" · line 745

Quoted 1 line
meta/lib/oeqa/selftest/cases/sstatetests.py +1 -0
+                bb.siggen.compare_sigfiles(latestfiles[-2],

latestfiles[-1], recursecb)

Quoted 8 lines
Signature · 7 lines
2.25.1



-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#184001): 

https://lists.openembedded.org/g/openembedded-core/message/184001

Quoted 1 line

Mute This Topic:

https://lists.openembedded.org/mt/100001305/3617179

Quoted 2 lines

Group Owner: [email protected] Unsubscribe:

https://lists.openembedded.org/g/openembedded-core/unsub
[[email protected]]

Quoted 2 lines

-=-=-=-=-=-=-=-=-=-=-=-

#5 lore raw
In reply to [email protected]

Hello,

This caused the following failure on the AB:

2023-07-10 07:09:07,937 - oe-selftest - INFO - 5: 28/28 427/530 (396.69s) (0 failed) (sstatetests.SStateFindSiginfo.test_sstate_compare_sigfiles_and_find_siginfo)
2023-07-10 07:09:07,937 - oe-selftest - INFO - testtools.testresult.real._StringException: Traceback (most recent call last):
  File "/home/pokybuild/yocto-worker/oe-selftest-debian/build/meta/lib/oeqa/selftest/cases/sstatetests.py", line 746, in test_sstate_compare_sigfiles_and_find_siginfo
    bb.siggen.compare_sigfiles(latestfiles[-2], latestfiles[-1], recursecb)
  File "/home/pokybuild/yocto-worker/oe-selftest-debian/build/bitbake/lib/bb/siggen.py", line 1038, in compare_sigfiles
    recout = recursecb(dep, a[dep], b[dep])
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/pokybuild/yocto-worker/oe-selftest-debian/build/meta/lib/oeqa/selftest/cases/sstatetests.py", line 740, in recursecb
    bb.siggen.compare_sigfiles(hashfiles[hash1], hashfiles[hash2], recursecb)
  File "/home/pokybuild/yocto-worker/oe-selftest-debian/build/bitbake/lib/bb/siggen.py", line 1038, in compare_sigfiles
    recout = recursecb(dep, a[dep], b[dep])
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/pokybuild/yocto-worker/oe-selftest-debian/build/meta/lib/oeqa/selftest/cases/sstatetests.py", line 740, in recursecb
    bb.siggen.compare_sigfiles(hashfiles[hash1], hashfiles[hash2], recursecb)
  File "/home/pokybuild/yocto-worker/oe-selftest-debian/build/bitbake/lib/bb/siggen.py", line 1038, in compare_sigfiles
    recout = recursecb(dep, a[dep], b[dep])
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/pokybuild/yocto-worker/oe-selftest-debian/build/meta/lib/oeqa/selftest/cases/sstatetests.py", line 740, in recursecb
    bb.siggen.compare_sigfiles(hashfiles[hash1], hashfiles[hash2], recursecb)
  File "/home/pokybuild/yocto-worker/oe-selftest-debian/build/bitbake/lib/bb/siggen.py", line 1038, in compare_sigfiles
    recout = recursecb(dep, a[dep], b[dep])
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/pokybuild/yocto-worker/oe-selftest-debian/build/meta/lib/oeqa/selftest/cases/sstatetests.py", line 739, in recursecb
    self.assertCountEqual(hashes, hashfiles)
  File "/usr/lib/python3.11/unittest/case.py", line 1233, in assertCountEqual
    self.fail(msg)
  File "/usr/lib/python3.11/unittest/case.py", line 703, in fail
    raise self.failureException(msg)

AssertionError: Element counts were not equal:
First has 1, Second has 0: '6e2cd26afc5890b8d2ad5eee2cd54e5659ea47de2afd6670b42c25c2d6471045' First has 1, Second has 0: '00877293baa6eba15266664c8a78508fac9114d64a99221176349cad0312f517'

https://autobuilder.yoctoproject.org/typhoon/#/builders/80/builds/5401/steps/14/logs/stdio
https://autobuilder.yoctoproject.org/typhoon/#/builders/127/builds/1727/steps/14/logs/stdio
https://autobuilder.yoctoproject.org/typhoon/#/builders/86/builds/5443/steps/14/logs/stdio
https://autobuilder.yoctoproject.org/typhoon/#/builders/87/builds/5476/steps/14/logs/stdio
https://autobuilder.yoctoproject.org/typhoon/#/builders/79/builds/5450/steps/15/logs/stdio

Quoted 130 lines · Yang Xu via lists.openembedded.org

From: Yang Xu <[email protected]>

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.
And add test for compare_sigfiles and find_siginfo working together.

---
 .../recipes-test/binutils/binutils_%.bbappend |  2 +
 meta/lib/oe/sstatesig.py                      | 17 ++++--
 meta/lib/oeqa/selftest/cases/sstatetests.py   | 53 +++++++++++++++++++
 3 files changed, 67 insertions(+), 5 deletions(-)
 create mode 100644 meta-selftest/recipes-test/binutils/binutils_%.bbappend
meta-selftest/recipes-test/binutils/binutils_%.bbappend new file +2 -0
new file mode 100644
index 0000000000..205720982c
@@ -0,0 +1,2 @@
+# This bbappend is used to alter the recipe using the test_recipe.inc file created by tests.
+include test_recipe.inc
meta/lib/oe/sstatesig.py +12 -5
index f943df181e..f041a0c430 100644
@@ -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 = {}
meta/lib/oeqa/selftest/cases/sstatetests.py +53 -0
index febafdb2f7..818d8b623d 100644
@@ -691,3 +691,56 @@ TMPDIR = "${TOPDIR}/tmp-sstatesamehash2"
         self.maxDiff = None
         self.assertCountEqual(files1, files2)
 
+class SStateFindSiginfo(SStateBase):
+    def test_sstate_compare_sigfiles_and_find_siginfo(self):
+        """
+        Test the functionality of the find_siginfo: basic function and callback in compare_sigfiles
+        """
+        self.write_config("""
+TMPDIR = \"${TOPDIR}/tmp-sstates-findsiginfo\"
+TCLIBCAPPEND = \"\"
+MACHINE = \"qemux86\"
+require conf/multilib.conf
+MULTILIBS = "multilib:lib32"
+DEFAULTTUNE:virtclass-multilib-lib32 = "x86"
+BB_SIGNATURE_HANDLER = "OEBasicHash"
+""")
+        self.track_for_cleanup(self.topdir + "/tmp-sstates-findsiginfo")
+
+        pns = ["binutils", "binutils-native", "lib32-binutils"]
+
+        #forcing generate different stamps for binutils every time
+        self.write_recipeinc("binutils", 'do_fetch[nostamp] = "1"')
+        for pn in pns*2:
+            bitbake("%s -S none" % pn)
+        self.delete_recipeinc("binutils")
+
+        with bb.tinfoil.Tinfoil() as tinfoil:
+            tinfoil.prepare(config_only=True)
+
+            def find_siginfo(pn, taskname, sigs=None):
+                result = None
+                tinfoil.set_event_mask(["bb.event.FindSigInfoResult",
+                                "bb.command.CommandCompleted"])
+                ret = tinfoil.run_command("findSigInfo", pn, taskname, sigs)
+                if ret:
+                    while True:
+                        event = tinfoil.wait_event(1)
+                        if event:
+                            if isinstance(event, bb.command.CommandCompleted):
+                                break
+                            elif isinstance(event, bb.event.FindSigInfoResult):
+                                result = event.result
+                return result
+
+            def recursecb(key, hash1, hash2):
+                hashes = [hash1, hash2]
+                hashfiles = find_siginfo(key, None, hashes)
+                self.assertCountEqual(hashes, hashfiles)
+                bb.siggen.compare_sigfiles(hashfiles[hash1], hashfiles[hash2], recursecb)
+
+            for pn in pns:
+                filedates = find_siginfo(pn, "do_compile")
+                self.assertGreaterEqual(len(filedates), 2)
+                latestfiles = sorted(filedates.keys(), key=lambda f: filedates[f])[-2:]
+                bb.siggen.compare_sigfiles(latestfiles[-2], latestfiles[-1], recursecb)
Signature · 11 lines
2.25.1



-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#184001): https://lists.openembedded.org/g/openembedded-core/message/184001
Mute This Topic: https://lists.openembedded.org/mt/100001305/3617179
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-
Signature · 3 lines
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com