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ář <lsedlar@redhat.com>
This commit is contained in:
Lubomír Sedlář 2019-02-08 14:11:58 +01:00
parent c3aa297d8c
commit e573246a2a

View File

@ -344,6 +344,7 @@ class GatherMethodHybrid(pungi.phases.gather.method.GatherMethodBase):
def get_lookaside_modules(lookasides): def get_lookaside_modules(lookasides):
"""Get list of NSVC of all modules in all lookaside repos.""" """Get list of NSVC of all modules in all lookaside repos."""
modules = set() modules = set()
platforms = set()
for repo in lookasides: for repo in lookasides:
repo = fus._prep_path(repo) repo = fus._prep_path(repo)
repomd = cr.Repomd(os.path.join(repo, "repodata/repomd.xml")) repomd = cr.Repomd(os.path.join(repo, "repodata/repomd.xml"))
@ -365,7 +366,11 @@ def get_lookaside_modules(lookasides):
mmd.peek_context(), 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): def create_module_repo(compose, variant, arch):
@ -378,9 +383,7 @@ def create_module_repo(compose, variant, arch):
compose.log_debug("[BEGIN] %s" % msg) compose.log_debug("[BEGIN] %s" % msg)
platforms = set() lookaside_modules, platforms = get_lookaside_modules(
lookaside_modules = get_lookaside_modules(
pungi.phases.gather.get_lookaside_repos(compose, arch, variant) pungi.phases.gather.get_lookaside_repos(compose, arch, variant)
) )