Skip to contentSkip to conversation

Minor fixes for bitbake-layers & patchtest

PATCH In review Paul Barker 2 participants 4 messages Sep 24, 2025

lore
Share & tools
lore
#0 lore raw

cover Minor fixes for bitbake-layers & patchtest

I spotted these two issues while working on master, they're both fairly trivial fixes.

I've tested bitbake-layers create-layer and patchtest locally after these changes, there should be no impact outside of these two commands.

---
Paul Barker (2):
bitbake-layers/create: Improve help message for layerid argument
patchtest: Use raw strings for regex patterns

 meta/lib/bblayers/create.py              |  2 +-
 meta/lib/patchtest/patchtest_patterns.py | 20 ++++++++++----------
 meta/lib/patchtest/tests/test_mbox.py    |  4 ++--
 3 files changed, 13 insertions(+), 13 deletions(-)

---
base-commit: e18d697e92b55e57124e80234369d46575226386
change-id: 20250924-minor-fixes-b56c96f12ac1

Best regards,

Signature · 1 line
Paul Barker
#1 lore raw

PATCH 1/2 bitbake-layers/create: Improve help message for layerid argument

'Layer ID' isn't a commonly used term in our help messages or documentation, so clarify that this is the identifier used for the new layer in BBFILE_COLLECTIONS.

Also clarify that the default is the basename of the layerdir argument if a layer ID is not separately provided.

---
 meta/lib/bblayers/create.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/lib/bblayers/create.py +1 -1
index 517554c587d76989169c67ec1a2e8bd0713f8b1e..b38c4b5e38a475fe07b40968f168857d565d9722 100644
@@ -83,7 +83,7 @@ class CreatePlugin(LayerPlugin):
         parser_create_layer = self.add_command(sp, 'create-layer', self.do_create_layer, parserecipes=False)
         parser_create_layer.add_argument('layerdir', help='Layer directory to create')
         parser_create_layer.add_argument('--add-layer', '-a', action='store_true', help='Add the layer to bblayers.conf after creation')
-        parser_create_layer.add_argument('--layerid', '-i', help='Layer id to use if different from layername')
+        parser_create_layer.add_argument('--layerid', '-i', help='Layer ID to use in BBFILE_COLLECTIONS, if different from the layerdir basename')
         parser_create_layer.add_argument('--priority', '-p', default=6, help='Priority of recipes in layer')
         parser_create_layer.add_argument('--example-recipe-name', '-e', dest='examplerecipe', default='example', help='Filename of the example recipe')
         parser_create_layer.add_argument('--example-recipe-version', '-v', dest='version', default='0.1', help='Version number for the example recipe')
Signature · 1 line
2.51.0
#2 lore raw

PATCH 2/2 patchtest: Use raw strings for regex patterns

In reply to Paul Barker

This fixes several 'SyntaxWarning: invalid escape sequence' messages printed when running patchtest.

Cc Trevor Gamblin <[email protected]>
---
 meta/lib/patchtest/patchtest_patterns.py | 20 ++++++++++----------
 meta/lib/patchtest/tests/test_mbox.py    |  4 ++--
 2 files changed, 12 insertions(+), 12 deletions(-)
meta/lib/patchtest/patchtest_patterns.py +10 -10
index 655ecfd049191b9b5e1990c31ad1bb7c96811fa6..1a8db92aa5372c481164604c0dee2c2367c9fd87 100644
@@ -33,7 +33,7 @@ closed   = 'CLOSED'
 lictag_re  = pyparsing.AtLineStart("License-Update:")
 lic_chksum_added = pyparsing.AtLineStart("+" + metadata_chksum)
 lic_chksum_removed = pyparsing.AtLineStart("-" + metadata_chksum)
-add_mark = pyparsing.Regex('\\+ ')
+add_mark = pyparsing.Regex(r'\+ ')
 patch_max_line_length = 200
 metadata_src_uri = "SRC_URI"
 metadata_summary = "SUMMARY"
@@ -51,20 +51,20 @@ auh_email = '[email protected]'
 
 invalid_submitters = [pyparsing.Regex("^Upgrade Helper.+"),
             pyparsing.Regex(auh_email),
-            pyparsing.Regex("uh@not\.set"),
-            pyparsing.Regex("\S+@example\.com")]
+            pyparsing.Regex(r"uh@not\.set"),
+            pyparsing.Regex(r"\S+@example\.com")]
 
-mbox_bugzilla = pyparsing.Regex('\[\s?YOCTO.*\]')
-mbox_bugzilla_validation = pyparsing.Regex('\[(\s?YOCTO\s?#\s?(\d+)\s?,?)+\]')
-mbox_revert_shortlog_regex = pyparsing.Regex('Revert\s+".*"')
+mbox_bugzilla = pyparsing.Regex(r'\[\s?YOCTO.*\]')
+mbox_bugzilla_validation = pyparsing.Regex(r'\[(\s?YOCTO\s?#\s?(\d+)\s?,?)+\]')
+mbox_revert_shortlog_regex = pyparsing.Regex(r'Revert\s+".*"')
 mbox_shortlog_maxlength = 90
 # based on https://stackoverflow.com/questions/30281026/regex-parsing-github-usernames-javascript
-mbox_github_username = pyparsing.Regex('\B(?<!\${)@([a-z0-9](?:-(?=[a-z0-9])|[a-z0-9]){0,38}(?<=[a-z0-9]))')
+mbox_github_username = pyparsing.Regex(r'\B(?<!\${)@([a-z0-9](?:-(?=[a-z0-9])|[a-z0-9]){0,38}(?<=[a-z0-9]))')
 
 # patch
 
-cve = pyparsing.Regex("CVE\-\d{4}\-\d+")
-cve_payload_tag = pyparsing.Regex("\+CVE:(\s+CVE\-\d{4}\-\d+)+")
+cve = pyparsing.Regex(r"CVE\-\d{4}\-\d+")
+cve_payload_tag = pyparsing.Regex(r"\+CVE:(\s+CVE\-\d{4}\-\d+)+")
 upstream_status_regex = pyparsing.AtLineStart("+" + "Upstream-Status")
 
 # shortlog
@@ -78,7 +78,7 @@ shortlog = line_start + shortlog_target + colon + shortlog_summary + line_end
 email_pattern = pyparsing.Regex(r"(?P<user>[A-Za-z0-9._%+-]+)@(?P<hostname>[A-Za-z0-9.-]+)\.(?P<domain>[A-Za-z]{2,})")
 
 signed_off_by_prefix = pyparsing.Literal("Signed-off-by:")
-signed_off_by_name = pyparsing.Regex('\S+.*(?= <)')
+signed_off_by_name = pyparsing.Regex(r'\S+.*(?= <)')
 signed_off_by_email = lessthan + email_pattern + greaterthan
 signed_off_by = pyparsing.AtLineStart(signed_off_by_prefix + signed_off_by_name + signed_off_by_email)
 patch_signed_off_by = pyparsing.AtLineStart("+" + signed_off_by_prefix + signed_off_by_name + signed_off_by_email)
meta/lib/patchtest/tests/test_mbox.py +2 -2
index 714c9b30af5c7ad705079a67903e038354de0195..5cf02af7bd5e761ed3f08254897861ec401841b8 100644
@@ -71,7 +71,7 @@ class TestMbox(base.Base):
     def test_shortlog_length(self):
         for commit in self.commits:
             # no reason to re-check on revert shortlogs
-            shortlog = re.sub('^(\[.*?\])+ ', '', commit.shortlog)
+            shortlog = re.sub(r'^(\[.*?\])+ ', '', commit.shortlog)
             if shortlog.startswith('Revert "'):
                 continue
             l = len(shortlog)
@@ -109,7 +109,7 @@ class TestMbox(base.Base):
 
         # a meta project may be indicted in the message subject, if this is the case, just fail
         # TODO: there may be other project with no-meta prefix, we also need to detect these
-        project_regex = pyparsing.Regex("\[(?P<project>meta-.+)\]")
+        project_regex = pyparsing.Regex(r"\[(?P<project>meta-.+)\]")
         for commit in self.commits:
             match = project_regex.search_string(commit.subject)
             if match:
Signature · 1 line
2.51.0
#3 lore raw

Re: [PATCH 2/2] patchtest: Use raw strings for regex patterns

Quoted 5 lines · Paul Barker

This fixes several 'SyntaxWarning: invalid escape sequence' messages printed when running patchtest.

Cc Trevor Gamblin <[email protected]>

Thanks for this! LGTM.

Quoted 79 lines
---
  meta/lib/patchtest/patchtest_patterns.py | 20 ++++++++++----------
  meta/lib/patchtest/tests/test_mbox.py    |  4 ++--
  2 files changed, 12 insertions(+), 12 deletions(-)
meta/lib/patchtest/patchtest_patterns.py +10 -10
index 655ecfd049191b9b5e1990c31ad1bb7c96811fa6..1a8db92aa5372c481164604c0dee2c2367c9fd87 100644
@@ -33,7 +33,7 @@ closed   = 'CLOSED'
  lictag_re  = pyparsing.AtLineStart("License-Update:")
  lic_chksum_added = pyparsing.AtLineStart("+" + metadata_chksum)
  lic_chksum_removed = pyparsing.AtLineStart("-" + metadata_chksum)
-add_mark = pyparsing.Regex('\\+ ')
+add_mark = pyparsing.Regex(r'\+ ')
  patch_max_line_length = 200
  metadata_src_uri = "SRC_URI"
  metadata_summary = "SUMMARY"
@@ -51,20 +51,20 @@ auh_email = '[email protected]'
 
  invalid_submitters = [pyparsing.Regex("^Upgrade Helper.+"),
              pyparsing.Regex(auh_email),
-            pyparsing.Regex("uh@not\.set"),
-            pyparsing.Regex("\S+@example\.com")]
+            pyparsing.Regex(r"uh@not\.set"),
+            pyparsing.Regex(r"\S+@example\.com")]
 
-mbox_bugzilla = pyparsing.Regex('\[\s?YOCTO.*\]')
-mbox_bugzilla_validation = pyparsing.Regex('\[(\s?YOCTO\s?#\s?(\d+)\s?,?)+\]')
-mbox_revert_shortlog_regex = pyparsing.Regex('Revert\s+".*"')
+mbox_bugzilla = pyparsing.Regex(r'\[\s?YOCTO.*\]')
+mbox_bugzilla_validation = pyparsing.Regex(r'\[(\s?YOCTO\s?#\s?(\d+)\s?,?)+\]')
+mbox_revert_shortlog_regex = pyparsing.Regex(r'Revert\s+".*"')
  mbox_shortlog_maxlength = 90
  # based on https://stackoverflow.com/questions/30281026/regex-parsing-github-usernames-javascript
-mbox_github_username = pyparsing.Regex('\B(?<!\${)@([a-z0-9](?:-(?=[a-z0-9])|[a-z0-9]){0,38}(?<=[a-z0-9]))')
+mbox_github_username = pyparsing.Regex(r'\B(?<!\${)@([a-z0-9](?:-(?=[a-z0-9])|[a-z0-9]){0,38}(?<=[a-z0-9]))')
 
  # patch
 
-cve = pyparsing.Regex("CVE\-\d{4}\-\d+")
-cve_payload_tag = pyparsing.Regex("\+CVE:(\s+CVE\-\d{4}\-\d+)+")
+cve = pyparsing.Regex(r"CVE\-\d{4}\-\d+")
+cve_payload_tag = pyparsing.Regex(r"\+CVE:(\s+CVE\-\d{4}\-\d+)+")
  upstream_status_regex = pyparsing.AtLineStart("+" + "Upstream-Status")
 
  # shortlog
@@ -78,7 +78,7 @@ shortlog = line_start + shortlog_target + colon + shortlog_summary + line_end
  email_pattern = pyparsing.Regex(r"(?P<user>[A-Za-z0-9._%+-]+)@(?P<hostname>[A-Za-z0-9.-]+)\.(?P<domain>[A-Za-z]{2,})")
 
  signed_off_by_prefix = pyparsing.Literal("Signed-off-by:")
-signed_off_by_name = pyparsing.Regex('\S+.*(?= <)')
+signed_off_by_name = pyparsing.Regex(r'\S+.*(?= <)')
  signed_off_by_email = lessthan + email_pattern + greaterthan
  signed_off_by = pyparsing.AtLineStart(signed_off_by_prefix + signed_off_by_name + signed_off_by_email)
  patch_signed_off_by = pyparsing.AtLineStart("+" + signed_off_by_prefix + signed_off_by_name + signed_off_by_email)
meta/lib/patchtest/tests/test_mbox.py +2 -2
index 714c9b30af5c7ad705079a67903e038354de0195..5cf02af7bd5e761ed3f08254897861ec401841b8 100644
@@ -71,7 +71,7 @@ class TestMbox(base.Base):
      def test_shortlog_length(self):
          for commit in self.commits:
              # no reason to re-check on revert shortlogs
-            shortlog = re.sub('^(\[.*?\])+ ', '', commit.shortlog)
+            shortlog = re.sub(r'^(\[.*?\])+ ', '', commit.shortlog)
              if shortlog.startswith('Revert "'):
                  continue
              l = len(shortlog)
@@ -109,7 +109,7 @@ class TestMbox(base.Base):
 
          # a meta project may be indicted in the message subject, if this is the case, just fail
          # TODO: there may be other project with no-meta prefix, we also need to detect these
-        project_regex = pyparsing.Regex("\[(?P<project>meta-.+)\]")
+        project_regex = pyparsing.Regex(r"\[(?P<project>meta-.+)\]")
          for commit in self.commits:
              match = project_regex.search_string(commit.subject)
              if match: