[PATCH] Process update info <collection> element correctly

Libor Pechacek lpechacek at suse.cz
Thu Nov 6 09:37:07 UTC 2014


Hello,

Any feedback on this change?  This is a bugfix for mergerepo going to knees on
openSUSE updateinfos.

Libor

On Wed 15-10-14 15:56:22, Libor Pechacek wrote:
> 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

-- 
Libor Pechacek
SUSE Labs


More information about the Yum-devel mailing list