[yum-commits] Branch 'yum-3_2_X' - 2 commits - yum/update_md.py

James Antill james at osuosl.org
Mon Aug 16 19:21:59 UTC 2010


 yum/update_md.py |   44 ++++++++++++++++++++++++++++++++++++++++----
 1 file changed, 40 insertions(+), 4 deletions(-)

New commits:
commit 372beb64ffd1d956745178376cf263735b415285
Author: Mark J. Cox <mjc at redhat.com>
Date:   Mon Aug 16 15:15:05 2010 -0400

    Add summary, solution and rights updateinfo data.

diff --git a/yum/update_md.py b/yum/update_md.py
index 6954c7b..9f6ff99 100644
--- a/yum/update_md.py
+++ b/yum/update_md.py
@@ -56,6 +56,9 @@ class UpdateNotice(object):
             'issued'           : '',
             'updated'          : '',
             'description'      : '',
+            'rights'           : '',
+            'summary'          : '',
+            'solution'         : '',
             'references'       : [],
             'pkglist'          : [],
             'reboot_suggested' : False
@@ -103,11 +106,26 @@ class UpdateNotice(object):
                 cvelist += " %s\n\t    :" % cve['id']
             head += cvelist[: - 1].rstrip() + '\n'
 
-        if self._md['description'] is not None:
+        if self._md['summary']:
+            data = utf8_text_wrap(self._md['summary'], width=64,
+                                  subsequent_indent=' ' * 12 + ': ')
+            head += "    Summary : %s\n" % '\n'.join(data)
+
+        if self._md['description']:
             desc = utf8_text_wrap(self._md['description'], width=64,
                                   subsequent_indent=' ' * 12 + ': ')
             head += "Description : %s\n" % '\n'.join(desc)
 
+        if self._md['solution']:
+            data = utf8_text_wrap(self._md['solution'], width=64,
+                                  subsequent_indent=' ' * 12 + ': ')
+            head += "   Solution : %s\n" % '\n'.join(data)
+
+        if self._md['rights']:
+            data = utf8_text_wrap(self._md['rights'], width=64,
+                                  subsequent_indent=' ' * 12 + ': ')
+            head += "     Rights : %s\n" % '\n'.join(data)
+
         #  Get a list of arches we care about:
         #XXX ARCH CHANGE - what happens here if we set the arch - we need to
         # pass this in, perhaps
@@ -132,7 +150,7 @@ class UpdateNotice(object):
         Parse an update element::
 
             <!ELEMENT update (id, synopsis?, issued, updated,
-                              references, description, pkglist)>
+                              references, description, rights?, summary?, solution?, pkglist)>
                 <!ATTLIST update type (errata|security) "errata">
                 <!ATTLIST update status (final|testing) "final">
                 <!ATTLIST update version CDATA #REQUIRED>
@@ -156,6 +174,12 @@ class UpdateNotice(object):
                     self._parse_references(child)
                 elif child.tag == 'description':
                     self._md['description'] = child.text
+                elif child.tag == 'rights':
+                    self._md['rights'] = child.text
+                elif child.tag == 'summary':
+                    self._md['summary'] = child.text
+                elif child.tag == 'solution':
+                    self._md['solution'] = child.text
                 elif child.tag == 'pkglist':
                     self._parse_pkglist(child)
                 elif child.tag == 'title':
@@ -172,7 +196,7 @@ class UpdateNotice(object):
             <!ELEMENT references (reference*)>
             <!ELEMENT reference>
                 <!ATTLIST reference href CDATA #REQUIRED>
-                <!ATTLIST reference type (self|cve|bugzilla) "self">
+                <!ATTLIST reference type (self|other|cve|bugzilla) "self">
                 <!ATTLIST reference id CDATA #IMPLIED>
                 <!ATTLIST reference title CDATA #IMPLIED>
         """
@@ -254,7 +278,13 @@ class UpdateNotice(object):
                 to_xml(self._md['title']), to_xml(self._md['release']),
                 to_xml(self._md['issued'], attrib=True),
                 to_xml(self._md['description']))
-        
+
+        if self._md['summary']:
+            msg += """  <summary>%s</summary>\n""" % (to_xml(self._md['summary']))
+        if self._md['solution']:
+            msg += """  <solution>%s</solution>\n""" % (to_xml(self._md['solution']))
+        if self._md['rights']:
+            msg += """  <rights>%s</rights>\n""" % (to_xml(self._md['rights']))        
         if self._md['references']:
             msg += """  <references>\n"""
             for ref in self._md['references']:
commit 88bde8309a6d55d4ebd167697ea4ea2429c0634d
Author: James Antill <james at and.org>
Date:   Mon Aug 16 15:04:37 2010 -0400

    Work around bad epoch data in updateinfo.

diff --git a/yum/update_md.py b/yum/update_md.py
index 9e492ba..6954c7b 100644
--- a/yum/update_md.py
+++ b/yum/update_md.py
@@ -225,6 +225,12 @@ class UpdateNotice(object):
         package = {}
         for pkgfield in ('arch', 'epoch', 'name', 'version', 'release', 'src'):
             package[pkgfield] = elem.attrib.get(pkgfield)
+
+        #  Bad epoch and arch data is the most common (missed) screwups.
+        # Deal with bad epoch data.
+        if not package['epoch'] or package['epoch'][0] not in '0123456789':
+            package['epoch'] = None
+
         for child in elem:
             if child.tag == 'filename':
                 package['filename'] = child.text


More information about the Yum-commits mailing list