From 4f96164ec7f05e37c8c88dc92c28c45e69dbe39d Mon Sep 17 00:00:00 2001 From: Haibo Lin Date: Tue, 22 Oct 2019 16:26:28 +0800 Subject: [PATCH] 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 --- bin/pungi-koji | 2 ++ pungi/checks.py | 20 ++++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/bin/pungi-koji b/bin/pungi-koji index 86437ee9..8d1f15bd 100755 --- a/bin/pungi-koji +++ b/bin/pungi-koji @@ -226,6 +226,8 @@ def main(): if not pungi.checks.check(conf): sys.exit(1) 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) if not opts.quiet: for warning in warnings: diff --git a/pungi/checks.py b/pungi/checks.py index 513728de..b6502179 100644 --- a/pungi/checks.py +++ b/pungi/checks.py @@ -135,6 +135,26 @@ def check_umask(logger): '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): """ Check if all requires and conflicts are ok in configuration.