hybrid: Include modulemd from all variants in temporary repo

If there are two variants with different module sets, the missing
modulemd from variant B causeing depsolving in variant A to consider the
packages as non-modular. That is wrong.

Related: https://bugzilla.redhat.com/show_bug.cgi?id=1640125
Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
Lubomír Sedlář 2018-10-18 12:48:13 +02:00
parent 66d9c10a6f
commit 0c3e02eeb0
2 changed files with 43 additions and 44 deletions

View File

@ -328,16 +328,12 @@ def create_module_repo(compose, variant, arch):
createrepo_checksum = compose.conf["createrepo_checksum"]
msg = "Creating repo with modular metadata for %s.%s" % (variant, arch)
if not variant.arch_mmds.get(arch):
compose.log_debug("[SKIP ] %s: no modules found" % msg)
return None, []
repo_path = compose.paths.work.module_repo(arch, variant)
compose.log_debug("[BEGIN] %s" % msg)
platforms = set()
repo_path = compose.paths.work.module_repo(arch, variant)
lookaside_modules = get_lookaside_modules(
pungi.phases.gather.get_lookaside_repos(compose, arch, variant)
)
@ -345,7 +341,10 @@ def create_module_repo(compose, variant, arch):
# Add modular metadata to it
modules = []
for mmd in variant.arch_mmds[arch].values():
# We need to include metadata for all variants. The packages are in the
# set, so we need their metadata.
for var in compose.all_variants.values():
for mmd in var.arch_mmds.get(arch, {}).values():
# Set the arch field, but no other changes are needed.
repo_mmd = mmd.copy()
repo_mmd.set_arch(tree_arch_to_yum_arch(arch))
@ -373,6 +372,7 @@ def create_module_repo(compose, variant, arch):
if mmddef.peek_module_name() in module_names:
modules.append(mmddef)
if modules:
# Initialize empty repo
repo = CreaterepoWrapper(createrepo_c=createrepo_c)
cmd = repo.get_createrepo_cmd(

View File

@ -243,10 +243,9 @@ class TestCreateModuleRepo(HelperMixin, helpers.PungiTestCase):
self.variant = self.compose.variants["Server"]
def test_no_modules(self, run, Modulemd):
plat, pkgs = hybrid.create_module_repo(self.compose, self.variant, "x86_64")
plat = hybrid.create_module_repo(self.compose, self.variant, "x86_64")
self.assertIsNone(plat)
self.assertItemsEqual(pkgs, [])
self.assertEqual(run.call_args_list, [])
self.assertEqual(Modulemd.mock_calls, [])