From 10fa53a6acb501020cdf206077aa95eb49698f0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubom=C3=ADr=20Sedl=C3=A1=C5=99?= Date: Thu, 18 Oct 2018 13:43:02 +0200 Subject: [PATCH] gather: Prepare module metadata before starting depsolving MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Without this we don't have artifacts from all modules when the first modular variant is solved. That makes some modular packages appear as bare. Signed-off-by: Lubomír Sedlář --- pungi/phases/gather/__init__.py | 21 ++++++++++++++++----- tests/test_gather_phase.py | 1 - 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/pungi/phases/gather/__init__.py b/pungi/phases/gather/__init__.py index be7ebf74..5a1d0b9f 100644 --- a/pungi/phases/gather/__init__.py +++ b/pungi/phases/gather/__init__.py @@ -121,6 +121,20 @@ def _mk_pkg_map(rpm=None, srpm=None, debuginfo=None, iterable_class=list): } +def prepare_module_metadata(compose, package_sets): + """Populate metadata about modules in each variant. This has to be done + before we try running the hybrid solver for any variant. Otherwise there + will be modular packages without metadata and they will be incorrectly + considered as bare RPMs. + """ + for arch in compose.get_arches(): + for variant in compose.get_variants(arch=arch): + # Run the module source. This is needed to set up module metadata + # for the variant, but we don't really care about the returned + # packages. They will be pulled in based on the actual module. + get_variant_packages(compose, arch, variant, "module", package_sets) + + def get_parent_pkgs(arch, variant, result_dict): """Find packages for parent variant (if any). @@ -175,11 +189,6 @@ def gather_packages(compose, arch, variant, package_sets, fulltree_excludes=None groups = [] filter_packages = [] - # Run the module source. This is needed to set up module metadata for - # the variant, but we don't really care about the returned packages. - # They will be pulled in based on the actual module. - get_variant_packages(compose, arch, variant, "module", package_sets) - # Here we do want to get list of comps groups and additional packages. packages, groups, filter_packages = get_variant_packages( compose, arch, variant, "comps", package_sets @@ -484,6 +493,8 @@ def _trim_variants(result, compose, variant_type, remove_pkgs=None, move_to_pare def gather_wrapper(compose, package_sets, path_prefix): result = {} + prepare_module_metadata(compose, package_sets) + _gather_variants(result, compose, 'variant', package_sets) _gather_variants(result, compose, 'addon', package_sets, exclude_fulltree=True) _gather_variants(result, compose, 'layered-product', package_sets, exclude_fulltree=True) diff --git a/tests/test_gather_phase.py b/tests/test_gather_phase.py index d2e492cb..7e6083c3 100644 --- a/tests/test_gather_phase.py +++ b/tests/test_gather_phase.py @@ -727,7 +727,6 @@ class TestGatherPackages(helpers.PungiTestCase): self.assertItemsEqual( get_variant_packages.call_args_list, [ - mock.call(compose, "x86_64", variant, "module", pkg_set), mock.call(compose, "x86_64", variant, "comps", pkg_set) ], )