hybrid: Only include modules that are not in lookaside
If we want to include the -devel modules, the original modules should be present for the solver. However if we put them in both local and lookaside repos, fus will get confused. Let's not include modules that are in lookaside in the module repo created for the solving job. Even if the modular packages are present in the local repo, they are identical to the ones in lookaside, and so they should not make it into the result anyway. Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
parent
814103d87f
commit
ce9ac35640
@ -18,6 +18,7 @@ import os
|
|||||||
from kobo.shortcuts import run
|
from kobo.shortcuts import run
|
||||||
import kobo.rpmlib
|
import kobo.rpmlib
|
||||||
from fnmatch import fnmatch
|
from fnmatch import fnmatch
|
||||||
|
import gzip
|
||||||
|
|
||||||
import pungi.phases.gather.method
|
import pungi.phases.gather.method
|
||||||
from pungi import Modulemd, multilib_dnf
|
from pungi import Modulemd, multilib_dnf
|
||||||
@ -283,6 +284,33 @@ class GatherMethodHybrid(pungi.phases.gather.method.GatherMethodBase):
|
|||||||
return sorted(added)
|
return sorted(added)
|
||||||
|
|
||||||
|
|
||||||
|
def get_lookaside_modules(lookasides):
|
||||||
|
"""Get list of NSVC of all modules in all lookaside repos."""
|
||||||
|
modules = set()
|
||||||
|
for repo in lookasides:
|
||||||
|
repo = fus._prep_path(repo)
|
||||||
|
repomd = cr.Repomd(os.path.join(repo, "repodata/repomd.xml"))
|
||||||
|
for rec in repomd.records:
|
||||||
|
if rec.type != "modules":
|
||||||
|
continue
|
||||||
|
with gzip.GzipFile(os.path.join(repo, rec.location_href), "r") as f:
|
||||||
|
# This can't use _from_stream, since gobject-introspection
|
||||||
|
# refuses to pass a file object.
|
||||||
|
mmds = Modulemd.objects_from_string(f.read())
|
||||||
|
for mmd in mmds:
|
||||||
|
if isinstance(mmd, Modulemd.Module):
|
||||||
|
modules.add(
|
||||||
|
"%s:%s:%s:%s"
|
||||||
|
% (
|
||||||
|
mmd.peek_name(),
|
||||||
|
mmd.peek_stream(),
|
||||||
|
mmd.peek_version(),
|
||||||
|
mmd.peek_context(),
|
||||||
|
)
|
||||||
|
)
|
||||||
|
return modules
|
||||||
|
|
||||||
|
|
||||||
def create_module_repo(compose, variant, arch):
|
def create_module_repo(compose, variant, arch):
|
||||||
"""Create repository with module metadata. There are no packages otherwise."""
|
"""Create repository with module metadata. There are no packages otherwise."""
|
||||||
createrepo_c = compose.conf["createrepo_c"]
|
createrepo_c = compose.conf["createrepo_c"]
|
||||||
@ -299,6 +327,10 @@ def create_module_repo(compose, variant, arch):
|
|||||||
|
|
||||||
repo_path = compose.paths.work.module_repo(arch, variant)
|
repo_path = compose.paths.work.module_repo(arch, variant)
|
||||||
|
|
||||||
|
lookaside_modules = get_lookaside_modules(
|
||||||
|
pungi.phases.gather.get_lookaside_repos(compose, arch, variant)
|
||||||
|
)
|
||||||
|
|
||||||
# Add modular metadata to it
|
# Add modular metadata to it
|
||||||
modules = []
|
modules = []
|
||||||
|
|
||||||
@ -312,6 +344,13 @@ def create_module_repo(compose, variant, arch):
|
|||||||
if streams:
|
if streams:
|
||||||
platforms.update(streams.dup())
|
platforms.update(streams.dup())
|
||||||
|
|
||||||
|
nsvc = "%s:%s:%s:%s" % (
|
||||||
|
repo_mmd.peek_name(),
|
||||||
|
repo_mmd.peek_stream(),
|
||||||
|
repo_mmd.peek_version(),
|
||||||
|
repo_mmd.peek_context(),
|
||||||
|
)
|
||||||
|
if nsvc not in lookaside_modules:
|
||||||
modules.append(repo_mmd)
|
modules.append(repo_mmd)
|
||||||
|
|
||||||
if len(platforms) > 1:
|
if len(platforms) > 1:
|
||||||
|
Loading…
Reference in New Issue
Block a user