From e573246a2ac08463529db26b1889bf0acc49ef00 Mon Sep 17 00:00:00 2001 From: Lubomír Sedlář Date: Feb 08 2019 13:41:56 +0000 Subject: hybrid: Get platform from lookaside repos If the hybrid solver is used in a situation where there are modules in lookaside repo, but not in the compose itself, it will fail to detect any platform. Since we are already opening the module repodata, we can retrieve platforms from all modules in there as well. If there are conflicts (e.g. multiple modules depending on different platforms), an error will be reported. JIRA: COMPOSE-3277 Signed-off-by: Lubomír Sedlář --- diff --git a/pungi/phases/gather/methods/method_hybrid.py b/pungi/phases/gather/methods/method_hybrid.py index d996236..830f7cd 100644 --- a/pungi/phases/gather/methods/method_hybrid.py +++ b/pungi/phases/gather/methods/method_hybrid.py @@ -344,6 +344,7 @@ class GatherMethodHybrid(pungi.phases.gather.method.GatherMethodBase): def get_lookaside_modules(lookasides): """Get list of NSVC of all modules in all lookaside repos.""" modules = set() + platforms = set() for repo in lookasides: repo = fus._prep_path(repo) repomd = cr.Repomd(os.path.join(repo, "repodata/repomd.xml")) @@ -365,7 +366,11 @@ def get_lookaside_modules(lookasides): mmd.peek_context(), ) ) - return modules + for dep in mmd.peek_dependencies(): + streams = dep.peek_requires().get("platform") + if streams: + platforms.update(streams.dup()) + return modules, platforms def create_module_repo(compose, variant, arch): @@ -378,9 +383,7 @@ def create_module_repo(compose, variant, arch): compose.log_debug("[BEGIN] %s" % msg) - platforms = set() - - lookaside_modules = get_lookaside_modules( + lookaside_modules, platforms = get_lookaside_modules( pungi.phases.gather.get_lookaside_repos(compose, arch, variant) )