aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMagnus Granberg <zorry@gentoo.org>2023-09-22 00:22:00 +0200
committerMagnus Granberg <zorry@gentoo.org>2023-09-22 00:22:00 +0200
commitd35e389caa0fe40ffaf6ec8e6e460148716ed092 (patch)
treeb10c0fafaff78d9f4f46e914fb0816d7b22a9c29
parentCheck issue titel nice (diff)
downloadtinderbox-cluster-d35e389caa0fe40ffaf6ec8e6e460148716ed092.tar.gz
tinderbox-cluster-d35e389caa0fe40ffaf6ec8e6e460148716ed092.tar.bz2
tinderbox-cluster-d35e389caa0fe40ffaf6ec8e6e460148716ed092.zip
Move nice regex's to a file
Signed-off-by: Magnus Granberg <zorry@gentoo.org>
-rw-r--r--buildbot_gentoo_ci/steps/logs.py38
-rw-r--r--buildbot_gentoo_ci/utils/regex.py22
2 files changed, 45 insertions, 15 deletions
diff --git a/buildbot_gentoo_ci/steps/logs.py b/buildbot_gentoo_ci/steps/logs.py
index d71eb99..85017a5 100644
--- a/buildbot_gentoo_ci/steps/logs.py
+++ b/buildbot_gentoo_ci/steps/logs.py
@@ -25,6 +25,7 @@ from buildbot.plugins import util
#from buildbot_gentoo_ci.steps import minio
from buildbot_gentoo_ci.steps import master as master_steps
from buildbot_gentoo_ci.steps import bugs
+from buildbot_gentoo_ci.utils.regex import stripQuotesAndMore, finishTitle
def PersOutputOfLogParser(rc, stdout, stderr):
build_summery_output = {}
@@ -185,17 +186,23 @@ class MakeIssue(BuildStep):
super().__init__(**kwargs)
def getNiceErrorLine(self, full_line):
- # strip away hex addresses, loong path names, line and time numbers and other stuff
- # https://github.com/toralf/tinderbox/blob/main/bin/job.sh#L469
- # FIXME: Add the needed line when needed
- new_line = []
- for line in full_line.split(' '):
- # Shorten the path
- if line.startswith('/usr/') or line.startswith('/var/') or line.startswith('../'):
- split_path_line = os.path.split(line)
- line = line.replace(split_path_line[0], '...')
- new_line.append(line)
- return ' '.join(new_line)
+ new_words = []
+ for word in full_line.split(' '):
+ new_words.append(finishTitle(stripQuotesAndMore(word)))
+ return ' '.join(new_words)
+
+ def BuildWordList(self):
+ word_list = []
+ word_list.append(self.error_dict['cpv'])
+ c = catpkgsplit(self.error_dict['cpv'])[0]
+ p = catpkgsplit(self.error_dict['cpv'])[1]
+ cp = c + '/' + p
+ word_list.append(cp)
+ for word in self.error_dict['title_phase'].split(' '):
+ word_list.append(word)
+ for word in self.error_dict['title_issue_nice'].split(' '):
+ word_list.append(word)
+ return word_list
def ClassifyIssue(self):
# get the title for the issue
@@ -217,10 +224,11 @@ class MakeIssue(BuildStep):
self.error_dict['title_issue'] = 'title_issue : None'
self.error_dict['title_issue_nice'] = 'title_issue_nice : None'
self.error_dict['title_found'] = False
- self.error_dict['title_phase'] = 'fails to '+ self.error_dict['phase'] + ':'
+ self.error_dict['title_phase'] = 'fails to '+ self.error_dict['phase']
#set the error title
- self.error_dict['title'] = ' '.join([self.error_dict['title_phase'], self.error_dict['title_issue']])
- self.error_dict['title_nice'] = ' '.join([self.error_dict['title_phase'], self.error_dict['title_issue_nice']])
+ self.error_dict['title'] = ' '.join([self.error_dict['title_phase'] + ':', self.error_dict['title_issue']])
+ self.error_dict['title_nice'] = ' '.join([self.error_dict['title_phase'] + ':', self.error_dict['title_issue_nice']])
+ self.error_dict['words'] = self.BuildWordList()
@defer.inlineCallbacks
def run(self):
@@ -247,7 +255,7 @@ class MakeIssue(BuildStep):
#FIXME: write summary_log_list to a file
# add issue/bug/pr report
if error:
- yield self.ClassifyIssue()
+ self.ClassifyIssue()
print(self.error_dict)
self.setProperty("status", 'failed', 'status')
self.setProperty("error_dict", self.error_dict, 'error_dict')
diff --git a/buildbot_gentoo_ci/utils/regex.py b/buildbot_gentoo_ci/utils/regex.py
new file mode 100644
index 0000000..29372e0
--- /dev/null
+++ b/buildbot_gentoo_ci/utils/regex.py
@@ -0,0 +1,22 @@
+# Copyright 2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+import re
+
+# https://github.com/toralf/tinderbox/blob/main/bin/job.sh#L12
+def stripQuotesAndMore(word):
+ word = re.sub(r"b'", "", word)
+ word = re.sub(r"'", "", word)
+ word = re.sub(r'`', '', word)
+ word = re.sub(r'"', '', word)
+ word = re.sub(r'\\', '', word)
+ return word
+
+# strip away hex addresses, loong path names, line and time numbers and other stuff
+# https://github.com/toralf/tinderbox/blob/main/bin/job.sh#L469
+# FIXME: Add the needed line when needed
+def finishTitle(word):
+ if word.startswith('/'):
+ word = word.split('/')[-1]
+ word = re.sub(":\d+:\d+:", "", word)
+ return word