Merge pull request #1281 from lnussel/repochecker

repochecker: add --force and --limit-group options
This commit is contained in:
Ludwig Nussel 2017-12-04 16:28:22 +01:00 committed by GitHub
commit 4661a09b2f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -39,6 +39,8 @@ class RepoChecker(ReviewBot.ReviewBot):
# RepoChecker options. # RepoChecker options.
self.skip_cycle = False self.skip_cycle = False
self.force = False
self.limit_group = None
def project_only(self, project, post_comments=False): def project_only(self, project, post_comments=False):
# self.staging_config needed by target_archs(). # self.staging_config needed by target_archs().
@ -46,7 +48,7 @@ class RepoChecker(ReviewBot.ReviewBot):
root = ET.fromstringlist(show_results_meta( root = ET.fromstringlist(show_results_meta(
self.apiurl, project, multibuild=True, repository=['standard'])) self.apiurl, project, multibuild=True, repository=['standard']))
if len(root.xpath('result[@state!="published"]')): if not self.force and len(root.xpath('result[@state!="published"]')):
self.logger.info('{}/standard not published'.format(project)) self.logger.info('{}/standard not published'.format(project))
return return
@ -119,6 +121,9 @@ class RepoChecker(ReviewBot.ReviewBot):
self.logger.debug('{}: not staged'.format(request.reqid)) self.logger.debug('{}: not staged'.format(request.reqid))
continue continue
if self.limit_group and group != self.limit_group:
continue
# Only interested if group has completed building. # Only interested if group has completed building.
api = self.staging_api(request.actions[0].tgt_project) api = self.staging_api(request.actions[0].tgt_project)
status = api.project_status(group, True) status = api.project_status(group, True)
@ -136,7 +141,7 @@ class RepoChecker(ReviewBot.ReviewBot):
openQA_only = False openQA_only = False
break break
if not openQA_only: if not self.force and not openQA_only:
self.logger.debug('{}: {} not ready'.format(request.reqid, group)) self.logger.debug('{}: {} not ready'.format(request.reqid, group))
continue continue
@ -165,7 +170,7 @@ class RepoChecker(ReviewBot.ReviewBot):
if info and self.groups_build[group] == info.get('build'): if info and self.groups_build[group] == info.get('build'):
skip_build.add(group) skip_build.add(group)
if group in skip_build: if not self.force and group in skip_build:
self.logger.debug('{}: {} build unchanged'.format(request.reqid, group)) self.logger.debug('{}: {} build unchanged'.format(request.reqid, group))
continue continue
@ -451,6 +456,12 @@ class RepoChecker(ReviewBot.ReviewBot):
# TODO Ignore tgt_project packages that depend on this that are part of # TODO Ignore tgt_project packages that depend on this that are part of
# ignore list as and instead look at output from staging for those. # ignore list as and instead look at output from staging for those.
what_depends_on = depends_on(self.apiurl, action.tgt_project, 'standard', [action.tgt_package], True) what_depends_on = depends_on(self.apiurl, action.tgt_project, 'standard', [action.tgt_package], True)
# filter out dependency on package itself (happens with eg
# java bootstrapping itself with previous build)
if action.tgt_package in what_depends_on:
what_depends_on.remove(action.tgt_package)
if len(what_depends_on): if len(what_depends_on):
self.logger.warn('{} is still a build requirement of {}'.format(action.tgt_package, ', '.join(what_depends_on))) self.logger.warn('{} is still a build requirement of {}'.format(action.tgt_package, ', '.join(what_depends_on)))
@ -476,6 +487,8 @@ class CommandLineInterface(ReviewBot.CommandLineInterface):
parser = ReviewBot.CommandLineInterface.get_optparser(self) parser = ReviewBot.CommandLineInterface.get_optparser(self)
parser.add_option('--skip-cycle', action='store_true', help='skip cycle check') parser.add_option('--skip-cycle', action='store_true', help='skip cycle check')
parser.add_option('--force', action='store_true', help='force review even if project is not ready')
parser.add_option('--limit-group', metavar='GROUP', help='only review requests in specific group')
return parser return parser
@ -485,6 +498,9 @@ class CommandLineInterface(ReviewBot.CommandLineInterface):
if self.options.skip_cycle: if self.options.skip_cycle:
bot.skip_cycle = self.options.skip_cycle bot.skip_cycle = self.options.skip_cycle
bot.force = self.options.force
bot.limit_group = self.options.limit_group
return bot return bot
@cmdln.option('--post-comments', action='store_true', help='post comments to packages with issues') @cmdln.option('--post-comments', action='store_true', help='post comments to packages with issues')