From ba6f7429eee6a745f894a31f63f4527fbbd5453d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubom=C3=ADr=20Sedl=C3=A1=C5=99?= Date: Tue, 14 Sep 2021 09:57:32 +0200 Subject: [PATCH] buildinstall: Add easy way to check if previous result was reused MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Lubomír Sedlář --- pungi/phases/buildinstall.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/pungi/phases/buildinstall.py b/pungi/phases/buildinstall.py index a43e3707..9f34423c 100644 --- a/pungi/phases/buildinstall.py +++ b/pungi/phases/buildinstall.py @@ -50,6 +50,9 @@ class BuildinstallPhase(PhaseBase): # A set of (variant_uid, arch) pairs that completed successfully. This # is needed to skip copying files for failed tasks. self.pool.finished_tasks = set() + # A set of (variant_uid, arch) pairs that were reused from previous + # compose. + self.pool.reused_tasks = set() self.buildinstall_method = self.compose.conf.get("buildinstall_method") self.lorax_use_koji_plugin = self.compose.conf.get("lorax_use_koji_plugin") self.used_lorax = self.buildinstall_method == "lorax" @@ -312,6 +315,18 @@ class BuildinstallPhase(PhaseBase): in self.pool.finished_tasks ) + def reused(self, variant, arch): + """ + Check if buildinstall phase reused previous results for given variant + and arch. If the phase is skipped, the results will be considered + reused as well. + """ + return ( + super(BuildinstallPhase, self).skip() + or (variant.uid if self.used_lorax else None, arch) + in self.pool.reused_tasks + ) + def get_kickstart_file(compose): scm_dict = compose.conf.get("buildinstall_kickstart") @@ -800,6 +815,7 @@ class BuildinstallThread(WorkerThread): ): self.copy_files(compose, variant, arch) self.pool.finished_tasks.add((variant.uid if variant else None, arch)) + self.pool.reused_tasks.add((variant.uid if variant else None, arch)) self.pool.log_info("[DONE ] %s" % msg) return