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

James Antill james at osuosl.org
Mon Jan 25 16:31:40 UTC 2010


 yum/update_md.py |   25 ++++++++++++++++---------
 yumcommands.py   |    2 +-
 2 files changed, 17 insertions(+), 10 deletions(-)

New commits:
commit b4b8e6e52a6f6a11e5f1236bb7b5eceff43199aa
Author: James Antill <james at and.org>
Date:   Mon Jan 25 11:31:28 2010 -0500

    Add add_notice() API to UpdateMetadata class

diff --git a/yum/update_md.py b/yum/update_md.py
index e0ae3ba..54d4cd7 100644
--- a/yum/update_md.py
+++ b/yum/update_md.py
@@ -360,6 +360,21 @@ class UpdateMetadata(object):
         ret.sort(cmp=_rpm_tup_vercmp, key=lambda x: x[0], reverse=True)
         return ret
 
+    def add_notice(self, un):
+        """ Add an UpdateNotice object. This should be fully populated with
+            data, esp. update_id and pkglist/packages. """
+        if not un or not un["update_id"] or un['update_id'] in self._notices:
+            return
+
+        self._notices[un['update_id']] = un
+        for pkg in un['pkglist']:
+            for filedata in pkg['packages']:
+                self._cache['%s-%s-%s' % (filedata['name'],
+                                          filedata['version'],
+                                          filedata['release'])] = un
+                no = self._no_cache.setdefault(filedata['name'], set())
+                no.add(un)
+
     def add(self, obj, mdtype='updateinfo'):
         """ Parse a metadata from a given YumRepository, file, or filename. """
         if not obj:
@@ -386,15 +401,7 @@ class UpdateMetadata(object):
                     print >> sys.stderr, "An update notice is broken, skipping."
                     # what else should we do?
                     continue
-                if un['update_id'] not in self._notices:
-                    self._notices[un['update_id']] = un
-                    for pkg in un['pkglist']:
-                        for file in pkg['packages']:
-                            self._cache['%s-%s-%s' % (file['name'],
-                                                      file['version'],
-                                                      file['release'])] = un
-                            no = self._no_cache.setdefault(file['name'], set())
-                            no.add(un)
+                self.add_notice(un)
 
     def __unicode__(self):
         ret = u''
commit 6d567c5bce2a6a07992219ab800bb6f3b7ab45b9
Author: James Antill <james at and.org>
Date:   Mon Jan 25 11:23:56 2010 -0500

    Fix stupid typo, use rid which we change instead of str(repo)

diff --git a/yumcommands.py b/yumcommands.py
index 6e410d0..35bd97c 100644
--- a/yumcommands.py
+++ b/yumcommands.py
@@ -856,7 +856,7 @@ class RepoListCommand(YumCommand):
                         mdts = repo.metalink_data.repomd.timestamp
                         if mdts > repo.repoXML.timestamp:
                             rid = '*' + rid
-                    cols.append((str(repo), repo.name,
+                    cols.append((rid, repo.name,
                                  (ui_enabled, ui_endis_wid), ui_num))
                 else:
                     if enabled:


More information about the Yum-commits mailing list