From 6fa478e68873c55b4c15ae1aef1f2c1caac87f5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubom=C3=ADr=20Sedl=C3=A1=C5=99?= Date: Mon, 29 Jul 2019 14:43:56 +0200 Subject: [PATCH] gather: Port hybrid method MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Update the code to consume multiple source repos. Signed-off-by: Lubomír Sedlář --- pungi/phases/gather/methods/method_hybrid.py | 25 +++++++++++++------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/pungi/phases/gather/methods/method_hybrid.py b/pungi/phases/gather/methods/method_hybrid.py index 7c3e0868..c30e1be4 100644 --- a/pungi/phases/gather/methods/method_hybrid.py +++ b/pungi/phases/gather/methods/method_hybrid.py @@ -100,13 +100,13 @@ class GatherMethodHybrid(pungi.phases.gather.method.GatherMethodBase): return self.package_maps[arch] def _prepare_packages(self): - repo_path = self.compose.paths.work.arch_repo(arch=self.arch) - md = cr.Metadata() - md.locate_and_load_xml(repo_path) - for key in md.keys(): - pkg = md.get(key) - if pkg.arch in self.valid_arches: - self.packages[_fmt_nevra(pkg, arch=pkg.arch)] = FakePackage(pkg) + for repo_path in self.get_repos(): + md = cr.Metadata() + md.locate_and_load_xml(repo_path) + for key in md.keys(): + pkg = md.get(key) + if pkg.arch in self.valid_arches: + self.packages[_fmt_nevra(pkg, arch=pkg.arch)] = FakePackage(pkg) def _get_package(self, nevra): if not self.packages: @@ -183,6 +183,7 @@ class GatherMethodHybrid(pungi.phases.gather.method.GatherMethodBase): **kwargs ): self.arch = arch + self.variant = variant self.valid_arches = get_valid_arches(arch, multilib=True) self.package_sets = package_sets @@ -220,8 +221,16 @@ class GatherMethodHybrid(pungi.phases.gather.method.GatherMethodBase): ) # maybe check invalid sigkeys + def get_repos(self): + repos = [] + for pkgset in self.package_sets: + if self.variant.pkgsets and pkgset.name not in self.variant.pkgsets: + continue + repos.append(pkgset.paths[self.arch]) + return repos + def run_solver(self, variant, arch, packages, platform, filter_packages): - repos = [self.compose.paths.work.arch_repo(arch=arch)] + repos = self.get_repos() results = set() result_modules = set()