aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMagnus Granberg <zorry@gentoo.org>2023-10-28 09:03:48 +0200
committerMagnus Granberg <zorry@gentoo.org>2023-10-28 09:03:48 +0200
commit684420873cc8bd4319c4379a78a76be25abe1e15 (patch)
tree61f4d58e8389e2fb21a24c801bbc8383bbe8ba0e
parentMove nice regex's to a file (diff)
downloadtinderbox-cluster-684420873cc8bd4319c4379a78a76be25abe1e15.tar.gz
tinderbox-cluster-684420873cc8bd4319c4379a78a76be25abe1e15.tar.bz2
tinderbox-cluster-684420873cc8bd4319c4379a78a76be25abe1e15.zip
Match min words
Signed-off-by: Magnus Granberg <zorry@gentoo.org>
-rw-r--r--buildbot_gentoo_ci/steps/bugs.py34
-rw-r--r--gentooci.cfg3
2 files changed, 18 insertions, 19 deletions
diff --git a/buildbot_gentoo_ci/steps/bugs.py b/buildbot_gentoo_ci/steps/bugs.py
index 4d958b7..6a097d4 100644
--- a/buildbot_gentoo_ci/steps/bugs.py
+++ b/buildbot_gentoo_ci/steps/bugs.py
@@ -16,6 +16,8 @@ from buildbot.process.results import FAILURE
from buildbot.process.results import SKIPPED
from buildbot.plugins import util
+from buildbot_gentoo_ci.utils.regex import stripQuotesAndMore, finishTitle
+
from bugz.cli import check_bugz_token, login, list_bugs
from bugz.cli_argparser import make_arg_parser
from bugz.configfile import load_config
@@ -120,28 +122,23 @@ class GetBugs(BuildStep):
yield log.addStdout(f"Bug: {str(bug['id'])} Summary: {bug['summary']}\n")
# we splite the lines to lists and try to match the words
matches = 0
- match_search_text = list(self.getProperty('error_dict')['title_issue'].split())
- match_bug_text = list(bug['summary'].split())
- #FIXME: add check for cp
- for match_word in match_search_text:
- if match_word in match_bug_text:
- matches = matches + 1
- # try to match the nice words
- matches_nice = 0
- match_search_text_nice = list(self.getProperty('error_dict')['title_issue_nice'].split())
- #FIXME: add check for cp
- for match_word in match_search_text_nice:
- if match_word in match_bug_text:
- matches_nice = matches_nice + 1
- print(f"Bug: {str(bug['id'])} Matched words: {str(matches)} {str(matches_nice)} Summary: {bug['summary']}")
- #FIXME: set it in bug_config
- if matches >= 6 or matches_nice >= 6:
+ bug_words = list(bug['summary'].split())
+ print(bug_words)
+ print(self.getProperty('error_dict')['words'])
+ for word in bug_words:
+ # clean the word
+ word = finishTitle(stripQuotesAndMore(word))
+ print(word)
+ for match_word in self.getProperty('error_dict')['words']:
+ if match_word in word:
+ matches = matches + 1
+ print(f"Bug: {str(bug['id'])} Matched words: {str(matches)} Summary: {bug['summary']}")
+ if matches >= len(self.getProperty('error_dict')['title_nice']) - self.bug_config['min_match_word']:
match = {}
match['match'] = True
match['id'] = bug['id']
match['summary'] = bug['summary']
yield log.addStdout(f"Line to match: {self.getProperty('error_dict')['title_issue']}\n")
- yield log.addStdout(f"Line to match: {self.getProperty('error_dict')['title_issue_nice']}\n")
if match:
yield log.addStdout('Match bug: YES\n')
yield log.addStdout(f"Bug: {str(match['id'])} Summary: {match['summary']}\n")
@@ -152,7 +149,8 @@ class GetBugs(BuildStep):
@defer.inlineCallbacks
def run(self):
- # self.gentooci = self.master.namedServices['services'].namedServices['gentooci']
+ self.gentooci = self.master.namedServices['services'].namedServices['gentooci']
+ self.bug_config = self.gentooci.config.project['bug_config']
cpv = self.getProperty('error_dict')['cpv']
c = yield catpkgsplit(cpv)[0]
p = yield catpkgsplit(cpv)[1]
diff --git a/gentooci.cfg b/gentooci.cfg
index 474da76..4aecf35 100644
--- a/gentooci.cfg
+++ b/gentooci.cfg
@@ -49,9 +49,10 @@ c['worker_config'] = {
# This specifies bug configs
c['bug_config'] = {
'enable' : True,
- 'aout_assignee' : False,
+ 'auto_assignee' : False,
'user' : 'LarryTheCow@Cow.mu',
'extra_summery' : '',
+ 'min_match_word' : 2,
'buildbot_comment' : [
'This was build on a tinderbox that use Buildbot API[1].',
'We use docker images to build on.',