extra-files: Simplify iterating over variants

Finding variants with particular architecture is not simple. Swapping
the two loops makes it faster, and additionally it fixes to correctly
work with sources.

JIRA: COMPOSE-3787
Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
Lubomír Sedlář 2019-09-02 14:52:19 +02:00
parent b8e41d9b1b
commit dfd4ff6016

View File

@ -35,10 +35,10 @@ class ExtraFilesPhase(ConfigGuardedPhase):
self.pkgset_phase = pkgset_phase self.pkgset_phase = pkgset_phase
def run(self): def run(self):
for arch in self.compose.get_arches() + ["src"]: for variant in self.compose.get_variants():
for variant in self.compose.get_variants(arch=arch):
if variant.is_empty: if variant.is_empty:
continue continue
for arch in variant.arches + ["src"]:
cfg = get_arch_variant_data(self.compose.conf, self.name, arch, variant) cfg = get_arch_variant_data(self.compose.conf, self.name, arch, variant)
if cfg: if cfg:
copy_extra_files(self.compose, cfg, arch, variant, self.pkgset_phase.package_sets) copy_extra_files(self.compose, cfg, arch, variant, self.pkgset_phase.package_sets)