public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/tinderbox-cluster:master commit in: /, buildbot_gentoo_ci/steps/
@ 2023-10-28  7:04 Magnus Granberg
  0 siblings, 0 replies; only message in thread
From: Magnus Granberg @ 2023-10-28  7:04 UTC (permalink / raw
  To: gentoo-commits

commit:     684420873cc8bd4319c4379a78a76be25abe1e15
Author:     Magnus Granberg <zorry <AT> gentoo <DOT> org>
AuthorDate: Sat Oct 28 07:03:48 2023 +0000
Commit:     Magnus Granberg <zorry <AT> gentoo <DOT> org>
CommitDate: Sat Oct 28 07:03:48 2023 +0000
URL:        https://gitweb.gentoo.org/proj/tinderbox-cluster.git/commit/?id=68442087

Match min words

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

 buildbot_gentoo_ci/steps/bugs.py | 34 ++++++++++++++++------------------
 gentooci.cfg                     |  3 ++-
 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.',


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2023-10-28  7:04 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-28  7:04 [gentoo-commits] proj/tinderbox-cluster:master commit in: /, buildbot_gentoo_ci/steps/ Magnus Granberg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox