commit:     ebac67eedbc65afaa3e3ae2abb22fba8a9277728
Author:     Magnus Granberg <zorry <AT> gentoo <DOT> org>
AuthorDate: Sat Mar 16 10:09:12 2024 +0000
Commit:     Magnus Granberg <zorry <AT> gentoo <DOT> org>
CommitDate: Sat Mar 16 10:09:12 2024 +0000
URL:        
https://gitweb.gentoo.org/proj/tinderbox-cluster.git/commit/?id=ebac67ee

Add support for rules on title_line and fix regex on .patch

Signed-off-by: Magnus Granberg <zorry <AT> gentoo.org>

 buildbot_gentoo_ci/steps/logs.py  | 12 +++++++++++-
 buildbot_gentoo_ci/utils/regex.py |  2 ++
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/buildbot_gentoo_ci/steps/logs.py b/buildbot_gentoo_ci/steps/logs.py
index a261dac..64bd3e7 100644
--- a/buildbot_gentoo_ci/steps/logs.py
+++ b/buildbot_gentoo_ci/steps/logs.py
@@ -216,6 +216,14 @@ class MakeIssue(BuildStep):
             word_list.append(word)
         return word_list
 
+    def title_line_rules(self, text_issue_list):
+        for text_issue in text_issue_list:
+            # patch fail
+            if re.search(' \*   patch .* failed with /', text_issue):
+                return text_issue.replace('*', '').strip()
+        title_line = text_issue_list[0].replace('*', '').strip()
+        return title_line
+
     def ClassifyIssue(self):
         # get the title for the issue
         text_issue_list = []
@@ -228,7 +236,9 @@ class MakeIssue(BuildStep):
         # add the issue error
         self.error_dict['cpv'] = self.getProperty('log_cpv')
         if text_issue_list != []:
-            title_line = text_issue_list[0].replace('*', '').strip()
+            print(f"text_issue_list: {text_issue_list}")
+            title_line = self.title_line_rules(text_issue_list)
+            print(f"title_line: {title_line}")
             self.error_dict['title_issue'] = title_line
             self.error_dict['title_issue_nice'] = 
self.getNiceErrorLine(title_line)
             self.error_dict['title_found'] = True

diff --git a/buildbot_gentoo_ci/utils/regex.py 
b/buildbot_gentoo_ci/utils/regex.py
index c8d19d0..f9ed284 100644
--- a/buildbot_gentoo_ci/utils/regex.py
+++ b/buildbot_gentoo_ci/utils/regex.py
@@ -25,5 +25,7 @@ def finishTitle(word):
     # ghyfv.v:78:9876: -> ghyfv.v
     if word.endswith(':') and any(i.isdigit() for i in word):
         word = word.split(':')[0]
+    if word.startswith('/') and word.endswith('.patch'):
+        word = word.split('/')[-1]
     print(f"Word: {word2} Finish Word: {word}")
     return word

Reply via email to