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"] createrepo_checksum = compose.conf["createrepo_checksum"]
msg = "Creating repo with modular metadata for %s.%s" % (variant, arch) msg = "Creating repo with modular metadata for %s.%s" % (variant, arch)
if not variant.arch_mmds.get(arch): repo_path = compose.paths.work.module_repo(arch, variant)
compose.log_debug("[SKIP ] %s: no modules found" % msg)
return None, []
compose.log_debug("[BEGIN] %s" % msg) compose.log_debug("[BEGIN] %s" % msg)
platforms = set() platforms = set()
repo_path = compose.paths.work.module_repo(arch, variant)
lookaside_modules = 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)
) )
@ -345,7 +341,10 @@ def create_module_repo(compose, variant, arch):
# Add modular metadata to it # Add modular metadata to it
modules = [] 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. # Set the arch field, but no other changes are needed.
repo_mmd = mmd.copy() repo_mmd = mmd.copy()
repo_mmd.set_arch(tree_arch_to_yum_arch(arch)) 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: if mmddef.peek_module_name() in module_names:
modules.append(mmddef) modules.append(mmddef)
if modules:
# Initialize empty repo # Initialize empty repo
repo = CreaterepoWrapper(createrepo_c=createrepo_c) repo = CreaterepoWrapper(createrepo_c=createrepo_c)
cmd = repo.get_createrepo_cmd( cmd = repo.get_createrepo_cmd(

View File

@ -243,10 +243,9 @@ class TestCreateModuleRepo(HelperMixin, helpers.PungiTestCase):
self.variant = self.compose.variants["Server"] self.variant = self.compose.variants["Server"]
def test_no_modules(self, run, Modulemd): 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.assertIsNone(plat)
self.assertItemsEqual(pkgs, [])
self.assertEqual(run.call_args_list, []) self.assertEqual(run.call_args_list, [])
self.assertEqual(Modulemd.mock_calls, []) self.assertEqual(Modulemd.mock_calls, [])