[Yum-devel] [PATCH 2/2] Sort the pkgs. in depListOutput, also only print the latest unless -v.

James Antill james at and.org
Tue Mar 15 14:48:25 UTC 2011


---
 output.py |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/output.py b/output.py
index 1613c29..e61cca9 100755
--- a/output.py
+++ b/output.py
@@ -809,6 +809,7 @@ class YumOutput:
     def depListOutput(self, results):
         """take a list of findDeps results and 'pretty print' the output"""
         
+        verb = self.verbose_logger.isEnabledFor(logginglevels.DEBUG_3)
         for pkg in results:
             print _("package: %s") % pkg.compactPrint()
             if len(results[pkg]) == 0:
@@ -822,7 +823,12 @@ class YumOutput:
                     print _("   Unsatisfied dependency")
                     continue
                 
-                for po in reqlist:
+                seen = {}
+                for po in reversed(sorted(reqlist)):
+                    key = (po.name, po.arch)
+                    if not verb and key in seen:
+                        continue
+                    seen[key] = po
                     print "   provider: %s" % po.compactPrint()
 
     def format_number(self, number, SI=0, space=' '):
-- 
1.7.3.4



More information about the Yum-devel mailing list