From 5c902592aeb240066a74c6e43cdfff34cba181cf Mon Sep 17 00:00:00 2001 From: Lubomír Sedlář Date: Mar 14 2018 13:49:09 +0000 Subject: pkgset: Allow empty list of modules 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ář --- diff --git a/pungi/phases/gather/sources/source_comps.py b/pungi/phases/gather/sources/source_comps.py index 447e0a4..0b4a87d 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 4fdaa7d..f7dc8f2 100644 --- a/pungi/phases/gather/sources/source_module.py +++ b/pungi/phases/gather/sources/source_module.py @@ -44,7 +44,7 @@ class GatherSourceModule(pungi.phases.gather.source.GatherSourceBase): # it is not clear what is semantic of that modulemd section. compatible_arches = pungi.arch.get_compatible_arches(arch, multilib=False) - if variant is not None and variant.modules: + if variant is not None and variant.modules is not None: variant.arch_mmds.setdefault(arch, {}) # Generate architecture specific modulemd metadata, so we can diff --git a/pungi/phases/pkgset/sources/source_koji.py b/pungi/phases/pkgset/sources/source_koji.py index 4582a7f..27fa893 100644 --- a/pungi/phases/pkgset/sources/source_koji.py +++ b/pungi/phases/pkgset/sources/source_koji.py @@ -276,7 +276,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 b32b1f5..6bd0080 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 197e4c4..f8e4a5f 100644 --- a/share/variants.dtd +++ b/share/variants.dtd @@ -27,7 +27,7 @@ uservisible (true|false) #IMPLIED > - +