[PATCH] Process update info <collection> element correctly
Libor Pechacek
lpechacek at suse.cz
Wed Oct 15 13:56:22 UTC 2014
Attribute `short' and element `name' are optional in collections. Take that
into account when generating XML.
Signed-off-by: Libor Pechacek <lpechacek at suse.cz>
---
yum/update_md.py | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/yum/update_md.py b/yum/update_md.py
index 7dcfce550990..19ed43718870 100644
--- a/yum/update_md.py
+++ b/yum/update_md.py
@@ -380,9 +380,12 @@ class UpdateNotice(object):
if self._md['pkglist']:
msg += """ <pkglist>\n"""
for coll in self._md['pkglist']:
- msg += """ <collection short="%s">\n <name>%s</name>\n""" % (
- to_xml(coll['short'], attrib=True),
- to_xml(coll['name']))
+ msg += """ <collection"""
+ if 'short' in coll:
+ msg += """ short="%s\"""" % (to_xml(coll['short'], attrib=True))
+ msg += """>\n"""
+ if 'name' in coll:
+ msg += """ <name>%s</name>\n""" % (to_xml(coll['name']))
for pkg in coll['packages']:
msg += """ <package arch="%s" name="%s" release="%s" src="%s" version="%s" epoch="%s">
--
1.7.12.4
More information about the Yum-devel
mailing list