2018-03-14 14:01:30 +00:00
|
|
|
From 4481d1145e1ea4b0bc3ac3696491a01e633f6397 Mon Sep 17 00:00:00 2001
|
|
|
|
From: =?UTF-8?q?Lubom=C3=ADr=20Sedl=C3=A1=C5=99?= <lsedlar@redhat.com>
|
|
|
|
Date: Wed, 14 Mar 2018 08:17:50 +0100
|
2018-03-16 13:52:42 +00:00
|
|
|
Subject: [PATCH 11/12] pkgset: Allow empty list of modules
|
2018-03-14 14:01:30 +00:00
|
|
|
MIME-Version: 1.0
|
|
|
|
Content-Type: text/plain; charset=UTF-8
|
|
|
|
Content-Transfer-Encoding: 8bit
|
|
|
|
|
|
|
|
This should indicate that it's a modular variant, but there is no
|
|
|
|
modular content yet. We don't want to treat that as Everything.
|
|
|
|
|
|
|
|
The end result will be an empty repository.
|
|
|
|
|
|
|
|
Fixes: https://pagure.io/pungi/issue/871
|
|
|
|
Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
|
|
|
|
---
|
|
|
|
pungi/phases/gather/sources/source_comps.py | 2 +-
|
|
|
|
pungi/phases/gather/sources/source_module.py | 2 +-
|
|
|
|
pungi/phases/pkgset/sources/source_koji.py | 2 +-
|
|
|
|
pungi/wrappers/variants.py | 8 ++++++--
|
|
|
|
share/variants.dtd | 2 +-
|
|
|
|
tests/helpers.py | 1 +
|
|
|
|
6 files changed, 11 insertions(+), 6 deletions(-)
|
|
|
|
|
|
|
|
diff --git a/pungi/phases/gather/sources/source_comps.py b/pungi/phases/gather/sources/source_comps.py
|
|
|
|
index 447e0a47..0b4a87d5 100644
|
|
|
|
--- a/pungi/phases/gather/sources/source_comps.py
|
|
|
|
+++ b/pungi/phases/gather/sources/source_comps.py
|
|
|
|
@@ -39,7 +39,7 @@ class GatherSourceComps(pungi.phases.gather.source.GatherSourceBase):
|
|
|
|
|
|
|
|
comps = CompsWrapper(self.compose.paths.work.comps(arch=arch))
|
|
|
|
|
|
|
|
- is_modular = variant and not variant.groups and variant.modules
|
|
|
|
+ is_modular = variant and not variant.groups and variant.modules is not None
|
|
|
|
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
|
|
|
|
diff --git a/pungi/phases/gather/sources/source_module.py b/pungi/phases/gather/sources/source_module.py
|
|
|
|
index 57740fca..ba6db442 100644
|
|
|
|
--- a/pungi/phases/gather/sources/source_module.py
|
|
|
|
+++ b/pungi/phases/gather/sources/source_module.py
|
|
|
|
@@ -41,7 +41,7 @@ class GatherSourceModule(pungi.phases.gather.source.GatherSourceBase):
|
|
|
|
|
|
|
|
compatible_arches = pungi.arch.get_compatible_arches(arch, multilib=True)
|
|
|
|
|
|
|
|
- if variant is not None and variant.modules:
|
|
|
|
+ if variant is not None and variant.modules is not None:
|
|
|
|
variant.arch_mmds.setdefault(arch, {})
|
|
|
|
|
|
|
|
# Contains per-module RPMs added to variant.
|
|
|
|
diff --git a/pungi/phases/pkgset/sources/source_koji.py b/pungi/phases/pkgset/sources/source_koji.py
|
|
|
|
index 2ce14be6..4d97b020 100644
|
|
|
|
--- a/pungi/phases/pkgset/sources/source_koji.py
|
|
|
|
+++ b/pungi/phases/pkgset/sources/source_koji.py
|
|
|
|
@@ -260,7 +260,7 @@ def populate_global_pkgset(compose, koji_wrapper, path_prefix, event_id):
|
|
|
|
if pdc_modules:
|
|
|
|
with open(pdc_module_file, 'w') as f:
|
|
|
|
json.dump(pdc_modules, f)
|
|
|
|
- if not variant_tags[variant]:
|
|
|
|
+ if not variant_tags[variant] and variant.modules is None:
|
|
|
|
variant_tags[variant].extend(force_list(compose.conf["pkgset_koji_tag"]))
|
|
|
|
|
|
|
|
# Add global tag(s) if supplied.
|
|
|
|
diff --git a/pungi/wrappers/variants.py b/pungi/wrappers/variants.py
|
|
|
|
index b32b1f59..6bd00800 100755
|
|
|
|
--- a/pungi/wrappers/variants.py
|
|
|
|
+++ b/pungi/wrappers/variants.py
|
|
|
|
@@ -71,7 +71,7 @@ class VariantsXmlParser(object):
|
|
|
|
"type": str(variant_node.attrib["type"]),
|
|
|
|
"arches": [str(i) for i in variant_node.xpath("arches/arch/text()")],
|
|
|
|
"groups": [],
|
|
|
|
- "modules": [],
|
|
|
|
+ "modules": None,
|
|
|
|
"environments": [],
|
|
|
|
"buildinstallpackages": [],
|
|
|
|
"is_empty": bool(variant_node.attrib.get("is_empty", False)),
|
|
|
|
@@ -110,6 +110,7 @@ class VariantsXmlParser(object):
|
|
|
|
"glob": self._is_true(module_node.attrib.get("glob", "false"))
|
|
|
|
}
|
|
|
|
|
|
|
|
+ variant_dict["modules"] = variant_dict["modules"] or []
|
|
|
|
variant_dict["modules"].append(module)
|
|
|
|
|
|
|
|
for environments_node in variant_node.xpath("environments"):
|
|
|
|
@@ -283,7 +284,10 @@ class Variant(object):
|
|
|
|
return result
|
|
|
|
|
|
|
|
def get_modules(self, arch=None, types=None, recursive=False):
|
|
|
|
- """Return list of groups, default types is ["self"]"""
|
|
|
|
+ """Return list of modules, default types is ["self"]"""
|
|
|
|
+
|
|
|
|
+ if self.modules is None:
|
|
|
|
+ return []
|
|
|
|
|
|
|
|
types = types or ["self"]
|
|
|
|
result = copy.deepcopy(self.modules)
|
|
|
|
diff --git a/share/variants.dtd b/share/variants.dtd
|
|
|
|
index 197e4c4b..f8e4a5f3 100644
|
|
|
|
--- a/share/variants.dtd
|
|
|
|
+++ b/share/variants.dtd
|
|
|
|
@@ -27,7 +27,7 @@
|
|
|
|
uservisible (true|false) #IMPLIED
|
|
|
|
>
|
|
|
|
|
|
|
|
-<!ELEMENT modules (module)+>
|
|
|
|
+<!ELEMENT modules (module)*>
|
|
|
|
|
|
|
|
<!ELEMENT module (#PCDATA)>
|
|
|
|
<!ATTLIST module
|
|
|
|
diff --git a/tests/helpers.py b/tests/helpers.py
|
|
|
|
index b82de42f..4ed0ae3f 100644
|
|
|
|
--- a/tests/helpers.py
|
|
|
|
+++ b/tests/helpers.py
|
|
|
|
@@ -39,6 +39,7 @@ class MockVariant(mock.Mock):
|
|
|
|
self.arch_mmds = {}
|
|
|
|
self.variants = {}
|
|
|
|
self.pkgset = mock.Mock(rpms_by_arch={})
|
|
|
|
+ self.modules = None
|
|
|
|
|
|
|
|
def __str__(self):
|
|
|
|
return self.uid
|
|
|
|
--
|
|
|
|
2.13.6
|
|
|
|
|