Skip to contentSkip to conversation

oe-build-perf-report: accept parenthesis in tag names

PATCH New Markus Lehtonen 1 participant 2 messages May 4, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 oe-build-perf-report: accept parenthesis in tag names

---
 scripts/oe-build-perf-report | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
scripts/oe-build-perf-report +4 -2
index ced5ff2e12..876e3b1a76 100755
@@ -62,11 +62,13 @@ def get_test_runs(repo, tag_name, **kwargs):
     log.debug("Found %d tags matching pattern '%s'", len(tags), tag_pattern)
 
     # Parse undefined fields from tag names
-    str_fields = dict([(f, r'(?P<{}>[\w\-.]+)'.format(f)) for f in field_names])
+    str_fields = dict([(f, r'(?P<{}>[\w\-.()]+)'.format(f)) for f in field_names])
     str_fields['commit'] = '(?P<commit>[0-9a-f]{7,40})'
     str_fields['commit_number'] = '(?P<commit_number>[0-9]{1,7})'
     str_fields['tag_number'] = '(?P<tag_number>[0-9]{1,5})'
-    str_fields.update(kwargs)
+    # escape parenthesis in fields in order to not messa up the regexp
+    fixed_fields = dict([(k, v.replace('(', r'\(').replace(')', r'\)')) for k, v in kwargs.items()])
+    str_fields.update(fixed_fields)
     tag_re = re.compile(tag_name.format(**str_fields))
 
     # Parse fields from tags
Signature · 1 line
2.12.0
#1 lore raw

PATCH 2/2 oe-build-perf-report: allow slashes in {branch} field in tag names

The target branch name might contain slashes.

---
 scripts/oe-build-perf-report | 1 +
 1 file changed, 1 insertion(+)
scripts/oe-build-perf-report +1 -0
index 876e3b1a76..d460caae18 100755
@@ -63,6 +63,7 @@ def get_test_runs(repo, tag_name, **kwargs):
 
     # Parse undefined fields from tag names
     str_fields = dict([(f, r'(?P<{}>[\w\-.()]+)'.format(f)) for f in field_names])
+    str_fields['branch'] = r'(?P<branch>[\w\-.()/]+)'
     str_fields['commit'] = '(?P<commit>[0-9a-f]{7,40})'
     str_fields['commit_number'] = '(?P<commit_number>[0-9]{1,7})'
     str_fields['tag_number'] = '(?P<tag_number>[0-9]{1,5})'
Signature · 1 line
2.12.0