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

James Antill james at osuosl.org
Tue Oct 21 19:00:24 UTC 2008


 yum/repoMDObject.py |   23 +++++++++++++++++++++++
 yumcommands.py      |   18 +++++++++++++++++-
 2 files changed, 40 insertions(+), 1 deletion(-)

New commits:
commit 8405eb545a9698a95322c9717407d73e6d5d3c18
Author: James Antill <james at and.org>
Date:   Tue Oct 21 15:00:17 2008 -0400

    Show revision/tags in repolist -v

diff --git a/yumcommands.py b/yumcommands.py
index 916feb0..d3ce5ee 100644
--- a/yumcommands.py
+++ b/yumcommands.py
@@ -761,12 +761,28 @@ class RepoListCommand(YumCommand):
                                             _('repo name'), _('status'), "")
                 done = True
                 if verbose:
+                    md = repo.repoXML
                     out = [base.fmtKeyValFill(_("Repo-id     : "), repo),
                            base.fmtKeyValFill(_("Repo-name   : "), repo.name),
                            base.fmtKeyValFill(_("Repo-status : "), ui_enabled)]
+                    if md.revision is not None:
+                        out += [base.fmtKeyValFill(_("Repo-revision: "),
+                                                   md.revision)]
+                    if md.tags['content']:
+                        tags = md.tags['content']
+                        out += [base.fmtKeyValFill(_("Repo-tags   : "),
+                                                   ", ".join(sorted(tags)))]
+
+                    if md.tags['distro']:
+                        for distro in sorted(md.tags['distro']):
+                            tags = md.tags['distro'][distro]
+                            out += [base.fmtKeyValFill(_("Repo-distro-tags: "),
+                                                       "[%s]: %s" % (distro,
+                                                       ", ".join(sorted(tags))))]
+
                     if enabled:
                         out += [base.fmtKeyValFill(_("Repo-updated: "),
-                                                   time.ctime(repo.repoXML.timestamp)),
+                                                   time.ctime(md.timestamp)),
                                 base.fmtKeyValFill(_("Repo-pkgs   : "), ui_num),
                                 base.fmtKeyValFill(_("Repo-size   : "),ui_size)]
 
commit bca1f21b3fca934035dc07e3f16b5527e80badc9
Author: James Antill <james at and.org>
Date:   Tue Oct 21 14:50:26 2008 -0400

    Parse out revision and tags from repomd.xml

diff --git a/yum/repoMDObject.py b/yum/repoMDObject.py
index 0ec8a04..76d9834 100755
--- a/yum/repoMDObject.py
+++ b/yum/repoMDObject.py
@@ -75,6 +75,8 @@ class RepoMD:
         self.repoData = {}
         self.checksums = {}
         self.length    = 0
+        self.revision  = None
+        self.tags      = {'content' : set(), 'distro' : {}}
         
         if type(srcfile) == type('str'):
             # srcfile is a filename string
@@ -100,6 +102,17 @@ class RepoMD:
                             self.timestamp = nts
                     except:
                         pass
+                elif elem_name == "revision":
+                    self.revision = elem.text
+                elif elem_name == "tags":
+                    for child in elem:
+                        child_name = ns_cleanup(child.tag)
+                        if child_name == 'content':
+                            self.tags['content'].add(child.text)
+                        if child_name == 'distro':
+                            cpeid = child.attrib.get('cpeid', '')
+                            distro = self.tags['distro'].setdefault(cpeid,set())
+                            distro.add(child.text)
 
             self.checksums = infile.checksums.hexdigests()
             self.length    = len(infile.checksums)
@@ -123,6 +136,16 @@ class RepoMD:
         print "file length   : %s" % self.length
         for csum in sorted(self.checksums):
             print "file checksum : %s/%s" % (csum, self.checksums[csum])
+        if self.revision is not None:
+            print 'revision: %s' % self.revision
+        if self.tags['content']:
+            print 'tags content: %s' % ", ".join(sorted(self.tags['content']))
+        if self.tags['distro']:
+            for distro in sorted(self.tags['distro']):
+                print 'tags distro: %s' % distro
+                tags = self.tags['distro'][distro]
+                print '  tags: %s' % ", ".join(sorted(tags))
+        print '\n---- Data ----'
         for ft in sorted(self.fileTypes()):
             thisdata = self.repoData[ft]
             print '  datatype: %s' % thisdata.type


More information about the Yum-commits mailing list