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

James Antill james at osuosl.org
Thu Sep 16 14:34:02 UTC 2010


 rpmUtils/updates.py |    7 +++++--
 yum/update_md.py    |   14 +++++++++++++-
 2 files changed, 18 insertions(+), 3 deletions(-)

New commits:
commit c4c0d928c231ed51b813486d23347fd26e33ef82
Author: James Antill <james at and.org>
Date:   Wed Sep 15 15:44:02 2010 -0400

    Filter "available updates" based on package name, for doUpdate, speedup ~25%.

diff --git a/rpmUtils/updates.py b/rpmUtils/updates.py
index c61788b..3c4bbb4 100644
--- a/rpmUtils/updates.py
+++ b/rpmUtils/updates.py
@@ -56,7 +56,8 @@ class Updates:
 
         # make some dicts from installed and available
         self.installdict = self.makeNADict(self.installed, 1)
-        self.availdict = self.makeNADict(self.available, 0) # Done in doUpdate
+        self.availdict = self.makeNADict(self.available, 0, # Done in doUpdate
+                                         filter=self.installdict)
 
         # holder for our updates dict
         self.updatesdict = {}
@@ -104,13 +105,15 @@ class Updates:
         if self.debug:
             print msg
 
-    def makeNADict(self, pkglist, Nonelists):
+    def makeNADict(self, pkglist, Nonelists, filter=None):
         """return lists of (e,v,r) tuples as value of a dict keyed on (n, a)
             optionally will return a (n, None) entry with all the a for that
             n in tuples of (a,e,v,r)"""
             
         returndict = {}
         for (n, a, e, v, r) in pkglist:
+            if filter and (n, None) not in filter:
+                continue
             if (n, a) not in returndict:
                 returndict[(n, a)] = []
             if (e,v,r) in returndict[(n, a)]:
commit d9fcb373b2c6cd7ca708e146a795ce3f3239692b
Author: James Antill <james at and.org>
Date:   Wed Sep 15 08:30:12 2010 -0400

    Add "severity" to updateinfo parsing, another element from BZ 624079.

diff --git a/yum/update_md.py b/yum/update_md.py
index 3d05d19..74db5ad 100644
--- a/yum/update_md.py
+++ b/yum/update_md.py
@@ -57,6 +57,7 @@ class UpdateNotice(object):
             'updated'          : '',
             'description'      : '',
             'rights'           : '',
+            'severity'         : '',
             'summary'          : '',
             'solution'         : '',
             'references'       : [],
@@ -126,6 +127,11 @@ class UpdateNotice(object):
                                   subsequent_indent=' ' * 12 + ': ')
             head += "     Rights : %s\n" % '\n'.join(data)
 
+        if self._md['severity'] and 'severity' not in skip_data:
+            data = utf8_text_wrap(self._md['severity'], width=64,
+                                  subsequent_indent=' ' * 12 + ': ')
+            head += "   Severity : %s\n" % '\n'.join(data)
+
         if 'files' in skip_data:
             return head[:-1] # chop the last '\n'
 
@@ -156,7 +162,8 @@ class UpdateNotice(object):
         Parse an update element::
 
             <!ELEMENT update (id, synopsis?, issued, updated,
-                              references, description, rights?, summary?, solution?, pkglist)>
+                              references, description, rights?,
+                              severity?, summary?, solution?, pkglist)>
                 <!ATTLIST update type (errata|security) "errata">
                 <!ATTLIST update status (final|testing) "final">
                 <!ATTLIST update version CDATA #REQUIRED>
@@ -182,6 +189,8 @@ class UpdateNotice(object):
                     self._md['description'] = child.text
                 elif child.tag == 'rights':
                     self._md['rights'] = child.text
+                elif child.tag == 'severity':
+                    self._md[child.tag] = child.text
                 elif child.tag == 'summary':
                     self._md['summary'] = child.text
                 elif child.tag == 'solution':
@@ -291,6 +300,9 @@ class UpdateNotice(object):
             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['severity']:
+            msg += """  <severity>%s</severity>\n""" % (to_xml(self._md['severity']))
+
         if self._md['references']:
             msg += """  <references>\n"""
             for ref in self._md['references']:


More information about the Yum-commits mailing list