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ář <lsedlar@redhat.com>
This commit is contained in:
parent
95bb147015
commit
5c902592ae
@ -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
|
||||
|
@ -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
|
||||
|
@ -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.
|
||||
|
@ -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)
|
||||
|
@ -27,7 +27,7 @@
|
||||
uservisible (true|false) #IMPLIED
|
||||
>
|
||||
|
||||
<!ELEMENT modules (module)+>
|
||||
<!ELEMENT modules (module)*>
|
||||
|
||||
<!ELEMENT module (#PCDATA)>
|
||||
<!ATTLIST module
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user