diff mbox series

[01/12] checklayer: Fix regex in get_signatures

Message ID 20260318-fix-checklayer-2-v1-1-388ba6ce47cd@pbarker.dev
State New
Headers show
Series Further check-layer fixes | expand

Commit Message

Paul Barker March 18, 2026, 5:14 p.m. UTC
After commit 11373def3171 ("sstatesig/populate_sdk_ext: Improve unihash
cache handling") in openembedded-core, the locked-sigs.inc file may
contain unihash map entries as well as a list of locked sigs. The
unihash map entries consist of four fields separated by `:` - pn, task,
task hash and unihash. The current regex in get_signatures cannot parse
these correctly, it grabs the first 3 elements into <task> when there
should only be two elements, leading to an error:

    Traceback (most recent call last):
      File "/srv/pokybuild/yocto-worker/check-layer/build/layers/openembedded-core/scripts/yocto-check-layer", line 252, in <module>
        ret =  main()
      File "/srv/pokybuild/yocto-worker/check-layer/build/layers/openembedded-core/scripts/yocto-check-layer", line 215, in main
        td['sigs'], td['tunetasks'] = get_signatures(td['builddir'])
                                      ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^
      File "/srv/pokybuild/yocto-worker/check-layer/build/layers/openembedded-core/scripts/lib/checklayer/__init__.py", line 340, in get_signatures
        (recipe, task) = s.group('task').split(':')
        ^^^^^^^^^^^^^^
    ValueError: too many values to unpack (expected 2)

Modify the regex so that it doesn't accidentally pick up the third field
of the unihash map entries.

Signed-off-by: Paul Barker <paul@pbarker.dev>
---
 scripts/lib/checklayer/__init__.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/scripts/lib/checklayer/__init__.py b/scripts/lib/checklayer/__init__.py
index b70cef1b1441..15459b6e0486 100644
--- a/scripts/lib/checklayer/__init__.py
+++ b/scripts/lib/checklayer/__init__.py
@@ -324,7 +324,7 @@  def get_signatures(builddir, failsafe=False, machine=None, extravars=None):
         else:
             raise
 
-    sig_regex = re.compile(r"^(?P<task>.*:.*):(?P<hash>.*) .$")
+    sig_regex = re.compile(r"^(?P<task>[^:]*:[^:]*):(?P<hash>.*) .$")
     tune_regex = re.compile(r"(^|\s)SIGGEN_LOCKEDSIGS_t-(?P<tune>\S*)\s*=\s*")
     current_tune = None
     with open(sigs_file, 'r') as f: