[yum-git] 3 commits - cli.py docs/yum.8 output.py

James Antill james at linux.duke.edu
Tue Mar 4 05:17:24 UTC 2008


 cli.py     |    8 +++++++-
 docs/yum.8 |    3 +++
 output.py  |   18 ++++++++++++++----
 3 files changed, 24 insertions(+), 5 deletions(-)

New commits:
commit ff6a879ad79a582302241f55b84fb8fd31e48ae0
Author: James Antill <james at and.org>
Date:   Tue Mar 4 00:17:20 2008 -0500

    Add documentation for new option

diff --git a/docs/yum.8 b/docs/yum.8
index 9d3c3b0..1f39a31 100644
--- a/docs/yum.8
+++ b/docs/yum.8
@@ -183,6 +183,9 @@ Tells yum to run entirely from cache - does not download or update any
 headers unless it has to to perform the requested action.
 .IP "\fB\-\-version\fP" 
 Reports the \fByum\fP version number and exits.
+.IP "\fB\-\-showduplicates\fP" 
+Doesn't limit packages to their latest versions in the info, list and search
+commands (will also affect plugins which use the doPackageLists() API).
 .IP "\fB\-\-installroot=root\fP" 
 Specifies an alternative installroot, relative to which all packages will be
 installed.
commit 6fc5187dfc094f14df8696ce418235f545a769b0
Author: James Antill <james at and.org>
Date:   Mon Mar 3 23:42:36 2008 -0500

    Show versions when showing dups, and fix the large key problem

diff --git a/output.py b/output.py
index 187a16c..0b1498b 100644
--- a/output.py
+++ b/output.py
@@ -253,9 +253,16 @@ class YumOutput:
 
     def _outKeyValFill(self, key, val):
         """ Return a key value pair in the common two column output format. """
-        nxt = ' ' * (len(key) - 2) + ': '
-        return fill(val, width=self.term.columns,
-                    initial_indent=key, subsequent_indent=nxt)
+        keylen = len(key)
+        cols = self.term.columns
+        nxt = ' ' * (keylen - 2) + ': '
+        ret = fill(val, width=cols,
+                   initial_indent=key, subsequent_indent=nxt)
+        if ret.count("\n") > 1 and keylen > (cols / 3):
+            # If it's big, redo it again with a smaller subsequent off
+            ret = fill(val, width=cols,
+                       initial_indent=key, subsequent_indent='     ...: ')
+        return ret
     
     def infoOutput(self, pkg):
         def enc(s):
@@ -427,7 +434,10 @@ class YumOutput:
         return(format % (number, space, symbols[depth]))
 
     def matchcallback(self, po, values, matchfor=None):
-        msg = '%s.%s : ' % (po.name, po.arch)
+        if self.conf.showdupesfromrepos:
+            msg = '%s : ' % po
+        else:
+            msg = '%s.%s : ' % (po.name, po.arch)
         msg = self._outKeyValFill(msg, po.summary)
         if matchfor:
             msg = self.term.sub_bold(msg, matchfor)
commit af69c4c90a27b089db9d4b44d1f6f32f4faf4f67
Author: James Antill <james at and.org>
Date:   Mon Mar 3 23:33:46 2008 -0500

    Add --showduplicates option, and make search obey showdupesfromrepos

diff --git a/cli.py b/cli.py
index b4f2b29..431a008 100644
--- a/cli.py
+++ b/cli.py
@@ -681,7 +681,7 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
         # display the list of matches
             
         searchlist = ['name', 'summary', 'description', 'url']
-        matching = self.searchGenerator(searchlist, args, showdups=False)
+        matching = self.searchGenerator(searchlist, args, showdups=self.conf.showdupesfromrepos)
         
         total = 0
         for (po, matched_value) in matching:
@@ -1002,6 +1002,9 @@ class YumOptionParser(OptionParser):
             if opts.skipbroken:
                 self.base.conf.skip_broken = True
 
+            if opts.showdupesfromrepos:
+                self.base.conf.showdupesfromrepos = True
+
             if opts.disableexcludes:
                 disable_excludes = self._splitArg(opts.disableexcludes)
             else:
@@ -1087,6 +1090,9 @@ class YumOptionParser(OptionParser):
         self.add_option("-d", dest="debuglevel", default=None,
                 help=_("debugging output level"), type='int',
                 metavar=' [debug level]')
+        self.add_option("--showduplicates", dest="showdupesfromrepos",
+                        action="store_true",
+                help=_("show duplicates, in repos, in list/search commands"))
         self.add_option("-e", dest="errorlevel", default=None,
                 help=_("error output level"), type='int',
                 metavar=' [error level]')



More information about the Yum-cvs-commits mailing list