[yum-cvs] 2 commits - output.py yumcommands.py

Seth Vidal skvidal at linux.duke.edu
Wed Aug 1 15:18:22 UTC 2007


 output.py      |    1 +
 yumcommands.py |   19 +++++++++++++------
 2 files changed, 14 insertions(+), 6 deletions(-)

New commits:
commit 643039c5d7dc18b91a784d1465f5b651c0255b4e
Merge: dacbb88... 809c2bb...
Author: Seth Vidal <skvidal at fedoraproject.org>
Date:   Wed Aug 1 11:18:06 2007 -0400

    Merge branch 'yum-list-cmd-exit' of http://people.redhat.com/jantill/gits/yum
    
    * 'yum-list-cmd-exit' of http://people.redhat.com/jantill/gits/yum:
      exit with non-zero when given a pattern that doesn't match

commit 809c2bb1b5708d7529544c837adaa3a6949e8119
Author: James Antill <james at code.and.org>
Date:   Mon Jul 30 16:11:16 2007 -0400

    exit with non-zero when given a pattern that doesn't match

diff --git a/output.py b/output.py
index 2d8b6c4..6f02ccc 100644
--- a/output.py
+++ b/output.py
@@ -105,6 +105,7 @@ class YumOutput:
     
             if thingslisted == 0:
                 return 1, ['No Packages to list']
+            return 0, []
         
     
         
diff --git a/yumcommands.py b/yumcommands.py
index 35cfd67..cc47562 100644
--- a/yumcommands.py
+++ b/yumcommands.py
@@ -161,18 +161,25 @@ class InfoCommand(YumCommand):
         except yum.Errors.YumBaseError, e:
             return 1, [str(e)]
         else:
-            base.listPkgs(ypl.installed, 'Installed Packages', basecmd)
-            base.listPkgs(ypl.available, 'Available Packages', basecmd)
-            base.listPkgs(ypl.extras, 'Extra Packages', basecmd)
-            base.listPkgs(ypl.updates, 'Updated Packages', basecmd)
+            rip = base.listPkgs(ypl.installed, 'Installed Packages', basecmd)
+            rap = base.listPkgs(ypl.available, 'Available Packages', basecmd)
+            rep = base.listPkgs(ypl.extras, 'Extra Packages', basecmd)
+            rup = base.listPkgs(ypl.updates, 'Updated Packages', basecmd)
             if len(ypl.obsoletes) > 0 and basecmd == 'list': 
             # if we've looked up obsolete lists and it's a list request
+                rop = [0, '']
                 print 'Obsoleting Packages'
                 for obtup in ypl.obsoletesTuples:
                     base.updatesObsoletesList(obtup, 'obsoletes')
             else:
-                base.listPkgs(ypl.obsoletes, 'Obsoleting Packages', basecmd)
-            base.listPkgs(ypl.recent, 'Recently Added Packages', basecmd)
+                rop = base.listPkgs(ypl.obsoletes, 'Obsoleting Packages', basecmd)
+            rrap = base.listPkgs(ypl.recent, 'Recently Added Packages', basecmd)
+            # extcmds is pop(0)'d if they pass a "special" param like "updates"
+            # in returnPkgLists(). This allows us to always return "ok" for
+            # things like "yum list updates".
+            if len(extcmds) and \
+               rrap[0] and rop[0] and rup[0] and rep[0] and rap[0] and rip[0]:
+                return 1, ['No matching Packages to list']
             return 0, []
 
 class EraseCommand(YumCommand):



More information about the Yum-cvs-commits mailing list