From ba6f7429eee6a745f894a31f63f4527fbbd5453d Mon Sep 17 00:00:00 2001 From: Lubomír Sedlář Date: Sep 14 2021 08:09:44 +0000 Subject: buildinstall: Add easy way to check if previous result was reused Signed-off-by: Lubomír Sedlář --- diff --git a/pungi/phases/buildinstall.py b/pungi/phases/buildinstall.py index a43e370..9f34423 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