[PATCH 6/7] patman: Correct parsing of branch names
Simon Glass
sjg at chromium.org
Sat May 24 19:06:54 CEST 2025
The name 'x86a' must be parsed as a branch name, not as versio 86 of
branch 'x'. Correct the regex and add a test for this.
Signed-off-by: Simon Glass <sjg at chromium.org>
---
tools/patman/patchstream.py | 2 +-
tools/patman/test_cseries.py | 4 ++++
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/tools/patman/patchstream.py b/tools/patman/patchstream.py
index aec7643838c..37c66cf5a7e 100644
--- a/tools/patman/patchstream.py
+++ b/tools/patman/patchstream.py
@@ -83,7 +83,7 @@ def split_name_version(in_name):
str: series name
int: series version, or None if there is none in in_name
"""
- m_ver = re.match(r'([^0-9]*)(\d*)', in_name)
+ m_ver = re.match(r'([^0-9]*)(\d*)$', in_name)
version = None
if m_ver:
name = m_ver.group(1)
diff --git a/tools/patman/test_cseries.py b/tools/patman/test_cseries.py
index 1189a1344e8..aa9160bcb66 100644
--- a/tools/patman/test_cseries.py
+++ b/tools/patman/test_cseries.py
@@ -3255,6 +3255,10 @@ Date: .*
self.assertEqual('No branch detected: please use -s <series>',
str(exc.exception))
+ name, version = patchstream.split_name_version('x86a')
+ self.assertEqual('x86a', name)
+ self.assertEqual(None, version)
+
def test_name_version_extra(self):
"""More tests for some corner cases"""
cser, _ = self.setup_second()
--
2.43.0
base-commit: e3ced530e543c9f24cbc66430abc6109ce8df015
branch: pate
More information about the U-Boot
mailing list