pungi/0002-Remove-comps-groups-from-purely-modular-variants.patch
2018-03-16 14:52:42 +01:00

75 lines
3.4 KiB
Diff

From de5dcc7e9ebb3c5b7201b404f302b9ac7dcab722 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Lubom=C3=ADr=20Sedl=C3=A1=C5=99?= <lsedlar@redhat.com>
Date: Fri, 2 Mar 2018 08:33:37 +0100
Subject: [PATCH 02/12] Remove comps groups from purely modular variants
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The comps source should not return all groups when there are only
modules defined. This fixes part of the problem: non-modular packages
will not go in by default.
The second part is the comps file in the created repository. It will be
filtered to not contain any groups (because packages from there will not
be in the repo).
Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
---
pungi/phases/gather/sources/source_comps.py | 3 ++-
pungi/phases/init.py | 6 +++++-
tests/test_initphase.py | 1 +
3 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/pungi/phases/gather/sources/source_comps.py b/pungi/phases/gather/sources/source_comps.py
index 655c7673..447e0a47 100644
--- a/pungi/phases/gather/sources/source_comps.py
+++ b/pungi/phases/gather/sources/source_comps.py
@@ -39,7 +39,8 @@ class GatherSourceComps(pungi.phases.gather.source.GatherSourceBase):
comps = CompsWrapper(self.compose.paths.work.comps(arch=arch))
- if variant is not None and (variant.groups or variant.type != 'variant'):
+ is_modular = variant and not variant.groups and variant.modules
+ if variant is not None and (variant.groups or variant.type != 'variant' or is_modular):
# Get packages for a particular variant. We want to skip the
# filtering if the variant is top-level and has no groups (to use
# all of them).
diff --git a/pungi/phases/init.py b/pungi/phases/init.py
index cbda4949..a01168a9 100644
--- a/pungi/phases/init.py
+++ b/pungi/phases/init.py
@@ -45,12 +45,16 @@ class InitPhase(PhaseBase):
# write variant comps
for variant in self.compose.get_variants():
+ is_modular = not variant.groups and variant.modules
for arch in variant.arches:
- if variant.groups or variant.type == 'optional':
+ if variant.groups or variant.type == 'optional' or is_modular:
# The variant lists only some groups, run filter. Other
# option is that it's optional variant, in which case
# we want to filter everything (unless there was
# explicit list in which case it will be used).
+ # For fully modular variant (one without groups but
+ # with modules) we also want to filter (effectively
+ # producing empty comps).
write_variant_comps(self.compose, arch, variant)
else:
# The variant does not mention any groups, copy
diff --git a/tests/test_initphase.py b/tests/test_initphase.py
index 7d8b639a..ae6c4e52 100644
--- a/tests/test_initphase.py
+++ b/tests/test_initphase.py
@@ -53,6 +53,7 @@ class TestInitPhase(PungiTestCase):
compose = DummyCompose(self.topdir, {})
compose.has_comps = True
compose.variants['Everything'].groups = []
+ compose.variants['Everything'].modules = []
phase = init.InitPhase(compose)
phase.run()
--
2.13.6