aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'buildbot_gentoo_ci/steps/bugs.py')
-rw-r--r--buildbot_gentoo_ci/steps/bugs.py34
1 files changed, 16 insertions, 18 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]