Fix modular content in non-modular variant

When allowing empty list of modules, the check for variant tags got
broken, causing Everything to no longer have an associated list of
allowed packages.

Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
Relates: https://pagure.io/pungi/issue/862
This commit is contained in:
Lubomír Sedlář 2018-03-16 13:57:03 +01:00
parent fedce5dff1
commit 6bff4bd10e

View File

@ -104,13 +104,13 @@ class VariantsXmlParser(object):
variant_dict["groups"].append(group) variant_dict["groups"].append(group)
for modulelist_node in variant_node.xpath("modules"): for modulelist_node in variant_node.xpath("modules"):
variant_dict["modules"] = variant_dict["modules"] or []
for module_node in modulelist_node.xpath("module"): for module_node in modulelist_node.xpath("module"):
module = { module = {
"name": str(module_node.text), "name": str(module_node.text),
"glob": self._is_true(module_node.attrib.get("glob", "false")) "glob": self._is_true(module_node.attrib.get("glob", "false"))
} }
variant_dict["modules"] = variant_dict["modules"] or []
variant_dict["modules"].append(module) variant_dict["modules"].append(module)
for environments_node in variant_node.xpath("environments"): for environments_node in variant_node.xpath("environments"):
@ -205,7 +205,6 @@ class Variant(object):
modules=None): modules=None):
environments = environments or [] environments = environments or []
modules = modules or []
buildinstallpackages = buildinstallpackages or [] buildinstallpackages = buildinstallpackages or []
self.id = id self.id = id
@ -214,7 +213,9 @@ class Variant(object):
self.arches = sorted(copy.deepcopy(arches)) self.arches = sorted(copy.deepcopy(arches))
self.groups = sorted(copy.deepcopy(groups), key=lambda x: x["name"]) self.groups = sorted(copy.deepcopy(groups), key=lambda x: x["name"])
self.environments = sorted(copy.deepcopy(environments), key=lambda x: x["name"]) self.environments = sorted(copy.deepcopy(environments), key=lambda x: x["name"])
self.modules = sorted(copy.deepcopy(modules), key=lambda x: x["name"]) self.modules = copy.deepcopy(modules)
if self.modules:
self.modules = sorted(self.modules, key=lambda x: x["name"])
self.buildinstallpackages = sorted(buildinstallpackages) self.buildinstallpackages = sorted(buildinstallpackages)
self.variants = {} self.variants = {}
self.parent = parent self.parent = parent