[yum-cvs] yum cli.py, 1.180, 1.181 output.py, 1.57, 1.58 shell.py, 1.18, 1.19

Seth Vidal skvidal at login.linux.duke.edu
Sun May 29 06:14:38 UTC 2005


Update of /home/groups/yum/cvs/yum
In directory login:/tmp/cvs-serv3769

Modified Files:
	cli.py output.py shell.py 
Log Message:

deplist function from Chip Turner: yum deplist pkgglob returns a list of
package deps and the packages that satisfy those deps


Index: cli.py
===================================================================
RCS file: /home/groups/yum/cvs/yum/cli.py,v
retrieving revision 1.180
retrieving revision 1.181
diff -u -r1.180 -r1.181
--- cli.py	8 May 2005 03:05:37 -0000	1.180
+++ cli.py	29 May 2005 06:14:36 -0000	1.181
@@ -100,7 +100,7 @@
     clean | provides | search | check-update | groupinstall | 
     groupupdate | grouplist | groupinfo | groupremove |
     makecache | localinstall | erase | upgrade | whatprovides |
-    localupdate | resolvedep | shell >''')
+    localupdate | resolvedep | shell | deplist >''')
 
         self.optparser.add_option("-t", "--tolerant", dest="tolerant",
                 action="store_true", default=False, help="be tolerant of errors")
@@ -342,7 +342,7 @@
                                 'clean', 'remove', 'provides', 'check-update',
                                 'search', 'upgrade', 'whatprovides',
                                 'localinstall', 'localupdate',
-                                'resolvedep', 'shell']:
+                                'resolvedep', 'shell', 'deplist']:
             self.usage()
             raise CliError
     
@@ -378,7 +378,7 @@
                         raise CliError
 
                 
-        if self.basecmd in ['install', 'erase', 'remove', 'localinstall', 'localupdate']:
+        if self.basecmd in ['install', 'erase', 'remove', 'localinstall', 'localupdate', 'deplist']:
             if len(self.extcmds) == 0:
                 self.errorlog(0, _('Error: Need to pass a list of pkgs to %s') % self.basecmd)
                 self.usage()
@@ -429,6 +429,7 @@
             self.usage()
             raise CliError
 
+
     def doShell(self):
         """do a shell-like interface for yum commands"""
 
@@ -536,6 +537,13 @@
             else:
                 return result, []
             
+        elif self.basecmd in ['deplist']:
+           self.log(2, "Finding dependencies: ")
+           try:
+              return self.deplist()
+           except yum.Errors.YumBaseError, e:
+              return 1, [str(e)]
+
         elif self.basecmd == 'clean':
             self.conf.setConfigOption('cache', 1)
             return self.cleanCli()
@@ -1180,6 +1188,18 @@
             return 0, ['No Matches found']
         return 0, []
 
+    def deplist(self, args=None):
+       """cli wrapper method for findDeps method takes a list of packages and 
+       returns a formatted deplist for that package"""
+
+       if not args:
+          args = self.extcmds
+
+       results = self.findDeps(args)
+       self.depListOutput(results)
+
+       return 0, []
+
     def provides(self, args=None):
         """use the provides methods in the rpmdb and pkgsack to produce a list 
            of items matching the provides strings. This is a cli wrapper to the 

Index: output.py
===================================================================
RCS file: /home/groups/yum/cvs/yum/output.py,v
retrieving revision 1.57
retrieving revision 1.58
diff -u -r1.57 -r1.58
--- output.py	20 May 2005 03:10:07 -0000	1.57
+++ output.py	29 May 2005 06:14:36 -0000	1.58
@@ -148,7 +148,28 @@
             for item in self.groupInfo.optional_pkgs[groupid]:
                 print '   %s' % item
 
-           
+
+    def depListOutput(self, results):
+        """take a list of findDeps results and 'pretty print' the output"""
+        
+        for pkg in results.keys():
+            print "package: %s" % pkg.compactPrint()
+            if len(results[pkg].keys()) == 0:
+                print "  No dependencies for this package"
+                continue
+
+            for req in results[pkg].keys():
+                reqlist = results[pkg][req] 
+                print "  dependency: %s" % pkg.prcoPrintable(req)
+                if not reqlist:
+                    print "   Unsatisfied dependency"
+                    continue
+                
+                for po in reqlist:
+                    print "   provider: %s" % po.compactPrint()
+
+
+        
     def format_number(self, number, SI=0, space=' '):
         """Turn numbers into human-readable metric-like numbers"""
         symbols = ['',  # (none)

Index: shell.py
===================================================================
RCS file: /home/groups/yum/cvs/yum/shell.py,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- shell.py	10 May 2005 00:57:15 -0000	1.18
+++ shell.py	29 May 2005 06:14:36 -0000	1.19
@@ -43,7 +43,7 @@
             'groupinstall', 'grouplist', 'groupremove', 'groupupdate',
             'info', 'install', 'list', 'localinstall', 'repository',
             'makecache', 'provides', 'quit', 'remove', 'run', 'search',
-            'transaction', 'ts', 'update', 'config']
+            'transaction', 'ts', 'update', 'config', 'deplist']
 
     def script(self):
         try:
@@ -83,7 +83,7 @@
     commands:  clean, config, exit, groupinfo, groupinstall, grouplist,
                groupremove, groupupdate, info, install, list,
                localinstall, makecache, provides, quit, remove, 
-               repo, run, search, transaction, update
+               repo, run, search, transaction, update, deplist
     """
         if arg in ['transaction', 'ts']:
             msg = """




More information about the Yum-cvs-commits mailing list