diff options
author | Magnus Granberg <zorry@gentoo.org> | 2024-03-14 22:00:44 +0100 |
---|---|---|
committer | Magnus Granberg <zorry@gentoo.org> | 2024-03-14 22:00:44 +0100 |
commit | 0693e5f1e3191f2b6ecb3938610731c745d69f4a (patch) | |
tree | 7368ae6fa9f9e8621c34d4dc59693159ffdd319a /buildbot_gentoo_ci | |
parent | Fix finishTitle for path regex (diff) | |
download | tinderbox-cluster-0693e5f1e3191f2b6ecb3938610731c745d69f4a.tar.gz tinderbox-cluster-0693e5f1e3191f2b6ecb3938610731c745d69f4a.tar.bz2 tinderbox-cluster-0693e5f1e3191f2b6ecb3938610731c745d69f4a.zip |
Get faild_version_data when faild and add more info in find bugs
Signed-off-by: Magnus Granberg <zorry@gentoo.org>
Diffstat (limited to 'buildbot_gentoo_ci')
-rw-r--r-- | buildbot_gentoo_ci/db/packages.py | 3 | ||||
-rw-r--r-- | buildbot_gentoo_ci/db/versions.py | 3 | ||||
-rw-r--r-- | buildbot_gentoo_ci/steps/bugs.py | 16 | ||||
-rw-r--r-- | buildbot_gentoo_ci/steps/builders.py | 23 | ||||
-rw-r--r-- | buildbot_gentoo_ci/steps/logs.py | 16 |
5 files changed, 43 insertions, 18 deletions
diff --git a/buildbot_gentoo_ci/db/packages.py b/buildbot_gentoo_ci/db/packages.py index 1f68637..ad4a244 100644 --- a/buildbot_gentoo_ci/db/packages.py +++ b/buildbot_gentoo_ci/db/packages.py @@ -27,12 +27,13 @@ from buildbot.db import base class PackagesConnectorComponent(base.DBConnectorComponent): @defer.inlineCallbacks - def getPackageByName(self, name, c_uuid, repo_uuid): + def getPackageByName(self, name, c_uuid, repo_uuid, deleted=False): def thd(conn): tbl = self.db.model.packages q = tbl.select() q = q.where(tbl.c.name == name) q = q.where(tbl.c.category_uuid == c_uuid) + q = q.where(tbl.c.deleted == deleted) q = q.where(tbl.c.repository_uuid == repo_uuid) res = conn.execute(q) row = res.fetchone() diff --git a/buildbot_gentoo_ci/db/versions.py b/buildbot_gentoo_ci/db/versions.py index 8d35602..afb9e52 100644 --- a/buildbot_gentoo_ci/db/versions.py +++ b/buildbot_gentoo_ci/db/versions.py @@ -26,12 +26,13 @@ from buildbot.db import base class VersionsConnectorComponent(base.DBConnectorComponent): @defer.inlineCallbacks - def getVersionByName(self, name, p_uuid): + def getVersionByName(self, name, p_uuid, deleted=False): def thd(conn): tbl = self.db.model.versions q = tbl.select() q = q.where(tbl.c.name == name) q = q.where(tbl.c.package_uuid == p_uuid) + q = q.where(tbl.c.deleted == deleted) res = conn.execute(q) row = res.fetchone() if not row: diff --git a/buildbot_gentoo_ci/steps/bugs.py b/buildbot_gentoo_ci/steps/bugs.py index 6a097d4..52bd08d 100644 --- a/buildbot_gentoo_ci/steps/bugs.py +++ b/buildbot_gentoo_ci/steps/bugs.py @@ -123,26 +123,36 @@ class GetBugs(BuildStep): # we splite the lines to lists and try to match the words matches = 0 bug_words = list(bug['summary'].split()) + # add c/p and v + for word in bug_words: + if pkgsplit(word) is not None: + bug_words.append(pkgsplit(word)[0]) + bug_words.append(cpv_getversion(word)) 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: + if match_word == 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']: + len_match_words = len(self.getProperty('error_dict')['words']) - self.bug_config['min_match_word'] + print(f"Min words to matchs: {str(len_match_words)}") + if matches >= len_match_words or matches >= self.bug_config['max_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"Nice line to match: {self.getProperty('error_dict')['title_nice']}\n") + yield log.addStdout(f"Words to match: {self.getProperty('error_dict')['words']}\n") if match: yield log.addStdout('Match bug: YES\n') yield log.addStdout(f"Bug: {str(match['id'])} Summary: {match['summary']}\n") self.setProperty("bgo", match, 'bgo') + print(f"Match bug: YES") + print(f"Bug: {str(match['id'])} Summary: {match['summary']}") return match yield log.addStdout('Match bug: NO\n') return match diff --git a/buildbot_gentoo_ci/steps/builders.py b/buildbot_gentoo_ci/steps/builders.py index 117fb70..09739d7 100644 --- a/buildbot_gentoo_ci/steps/builders.py +++ b/buildbot_gentoo_ci/steps/builders.py @@ -282,6 +282,7 @@ class GetProjectRepositoryData(BuildStep): continue # check if auto, enabled and not in config.project['project'] if project_data['auto'] is True and project_data['enabled'] is True and project_data['name'] != self.gentooci.config.project['project']['update_db']: + print(project_data) # set Property projectrepository_data so we can use it in the trigger # get name o project keyword project_keyword_data = yield self.gentooci.db.keywords.getKeywordById(project_data['keyword_id']) @@ -729,13 +730,14 @@ class CheckEmergeLogs(BuildStep): self.faild_cpv = False @defer.inlineCallbacks - def getVersionData(self, cpv): + def getVersionData(self, cpv, repository): c = yield catpkgsplit(cpv)[0] p = yield catpkgsplit(cpv)[1] category_data = yield self.gentooci.db.categorys.getCategoryByName(c) + repository_data = yield self.gentooci.db.repositorys.getRepositoryByName(repository) package_data = yield self.gentooci.db.packages.getPackageByName(p, - category_data['uuid'], - self.getProperty('repository_data')['uuid']) + category_data['uuid'], + repository_data['uuid']) if package_data is None: return None version = yield cpv_getversion(cpv) @@ -868,6 +870,7 @@ class CheckEmergeLogs(BuildStep): ] emerge_output = self.getProperty('emerge_output') self.faild_cpv = emerge_output['failed'] + self.faild_version_data = False package_dict = emerge_output['packages'] #FIXME: Prosees the logs and do stuff @@ -1006,7 +1009,6 @@ class CheckEmergeLogs(BuildStep): print('log_dict not emty') # requested cpv cpv = self.getProperty('cpv') - faild_version_data = False if cpv in log_dict or self.faild_cpv in log_dict: print(cpv) print(self.faild_cpv) @@ -1022,14 +1024,19 @@ class CheckEmergeLogs(BuildStep): if not rebuild or self.getProperty('rerun') >= retrays: # failed and build requested cpv if cpv == self.faild_cpv: - faild_version_data = self.getProperty("version_data") + self.faild_version_data = self.getProperty("version_data") else: # failed but not build requested cpv self.log_data[self.faild_cpv] = log_dict[self.faild_cpv] yield self.getLogFile(self.faild_cpv, log_dict) - faild_version_data = yield self.getVersionData(self.faild_cpv) + repository = False + for cpv, v in package_dict.items(): + if cpv == self.faild_cpv: + repository = v['repository'] + if repository: + self.faild_version_data = yield self.getVersionData(self.faild_cpv, repository) self.setProperty('faild_cpv', self.faild_cpv, 'faild_cpv') - print(faild_version_data) + print(self.faild_version_data) print('getEmergeFiles') self.getEmergeFiles(self.faild_cpv) self.getBuildWorkDirs(self.faild_cpv) @@ -1045,7 +1052,7 @@ class CheckEmergeLogs(BuildStep): updateSourceStamp=False, set_properties={ 'cpv' : self.getProperty("cpv"), - 'faild_version_data' : faild_version_data, + 'faild_version_data' : self.faild_version_data, 'project_build_data' : self.getProperty('project_build_data'), 'log_build_data' : self.log_data, 'pkg_check_log_data' : self.getProperty("pkg_check_log_data"), diff --git a/buildbot_gentoo_ci/steps/logs.py b/buildbot_gentoo_ci/steps/logs.py index 84f5058..f214ad6 100644 --- a/buildbot_gentoo_ci/steps/logs.py +++ b/buildbot_gentoo_ci/steps/logs.py @@ -8,7 +8,7 @@ import io import hashlib import json -from portage.versions import catpkgsplit +from portage.versions import catpkgsplit, cpv_getversion from twisted.internet import defer from twisted.python import log @@ -209,6 +209,7 @@ class MakeIssue(BuildStep): p = catpkgsplit(self.error_dict['cpv'])[1] cp = c + '/' + p word_list.append(cp) + word_list.append(cpv_getversion(self.error_dict['cpv'])) for word in self.error_dict['title_phase'].split(' '): word_list.append(word) for word in self.error_dict['title_issue_nice'].split(' '): @@ -273,16 +274,21 @@ class MakeIssue(BuildStep): emails['maintainers'] = Maintainers emails['owners'] = self.getProperty('owners') emails['packages_emails'] = [] - pmail_ids = yield self.gentooci.db.packages.getEmailsIdsByPackageUuid(self.getProperty("version_data")['package_uuid']) + if self.getProperty('failed_version_data'): + version_data = self.getProperty('failed_version_data') + else: + version_data = self.getProperty("version_data") + pmail_ids = yield self.gentooci.db.packages.getEmailsIdsByPackageUuid(version_data['package_uuid']) for pmail_id in pmail_ids: pmail = yield self.gentooci.db.packages.getEmailByEmailId(pmail_id['email_id']) - emails['packages_emails'].append(pmail['email']) - changes = yield self.master.db.changes.getChange(self.getProperty("version_data")['change_id']) + pmail_id['email'] = pmail['email'] + emails['packages_emails'].append(pmail_id) + changes = yield self.master.db.changes.getChange(version_data['change_id']) cemail = {} cemail['authors'] = changes['author'] #cemail['committer'] = changes['committer'] cemail['changes_uids_email'] = [] - changes_uids = yield self.master.db.changes.getChangeUids(self.getProperty("version_data")['change_id']) + changes_uids = yield self.master.db.changes.getChangeUids(version_data['change_id']) for changes_uid in changes_uids: cuemail = yield self.master.db.users.getUser(changes_uid) cemail['changes_uids_email'].append(cuemail['identifier']) |