Clean up skipping phases

It makes no sense to only skip phases needed by other phase.

Fixes: https://pagure.io/pungi/issue/1274
JIRA: COMPOSE-3871
Signed-off-by: Haibo Lin <hlin@redhat.com>
This commit is contained in:
Haibo Lin 2019-10-22 16:26:28 +08:00
parent 3901c227f0
commit 4f96164ec7
2 changed files with 22 additions and 0 deletions

View File

@ -226,6 +226,8 @@ def main():
if not pungi.checks.check(conf): if not pungi.checks.check(conf):
sys.exit(1) sys.exit(1)
pungi.checks.check_umask(logger) pungi.checks.check_umask(logger)
if not pungi.checks.check_skip_phases(logger, opts.skip_phase):
sys.exit(1)
errors, warnings = pungi.checks.validate(conf) errors, warnings = pungi.checks.validate(conf)
if not opts.quiet: if not opts.quiet:
for warning in warnings: for warning in warnings:

View File

@ -135,6 +135,26 @@ def check_umask(logger):
'expect files with broken permissions.', mask) 'expect files with broken permissions.', mask)
def check_skip_phases(logger, skip_phases):
"""Check if skipped phases are needed by other phase.
:param logger: logger instance for reporting error
:param skip_phases: list of skipped phases
:returns: True if checking passed else False
"""
needed_by = {
'pkgset': 'gather',
'gather': 'createrepo',
}
fail = False
for k, v in needed_by.items():
if k in skip_phases and needed_by[k] not in skip_phases:
fail = True
logger.error("%s phase is skipped but it's needed by %s phase" % (k, v))
return not fail
def _validate_requires(schema, conf, valid_options): def _validate_requires(schema, conf, valid_options):
""" """
Check if all requires and conflicts are ok in configuration. Check if all requires and conflicts are ok in configuration.