comps-wrapper: Fix crash on conditional packages

A `requires` attribute is taken from a wrong package (because of a wrong
variable used: `pkg` vs. `package`). On RHEL 6 this actually leads to a
crash. Let's use only one name to avoid such problems.

Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
Lubomír Sedlář 2017-05-18 10:57:47 +02:00
parent f27f3ce4ba
commit 77ee882c21

View File

@ -91,8 +91,8 @@ class CompsWrapper(object):
packages_by_type[TYPE_MAPPING[pkg.type]].append(pkg) packages_by_type[TYPE_MAPPING[pkg.type]].append(pkg)
for type_name in TYPE_MAPPING.values(): for type_name in TYPE_MAPPING.values():
for package in sorted(packages_by_type[type_name], key=attrgetter('name')): for pkg in sorted(packages_by_type[type_name], key=attrgetter('name')):
node = append(doc, packagelist, "packagereq", package.name, type=type_name) node = append(doc, packagelist, "packagereq", pkg.name, type=type_name)
if type_name == "conditional": if type_name == "conditional":
node.setAttribute("requires", pkg.requires) node.setAttribute("requires", pkg.requires)