[yum-cvs] yum cli.py,1.166,1.167

Seth Vidal skvidal at login.linux.duke.edu
Fri Mar 11 03:17:57 UTC 2005


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

Modified Files:
	cli.py 
Log Message:

merge in the "turn off the confirm in 'expected' situations" patch from
Matt Miller


Index: cli.py
===================================================================
RCS file: /home/groups/yum/cvs/yum/cli.py,v
retrieving revision 1.166
retrieving revision 1.167
diff -u -r1.166 -r1.167
--- cli.py	8 Mar 2005 09:17:12 -0000	1.166
+++ cli.py	11 Mar 2005 03:17:55 -0000	1.167
@@ -654,7 +654,7 @@
         self.reportDownloadSize(downloadpkgs)
         
         # confirm with user
-        if not self.conf.getConfigOption('assumeyes'):
+        if self._promptWanted():
             if not self.userconfirm():
                 self.log(0, 'Exiting on user Command')
                 return
@@ -1439,6 +1439,27 @@
             return 0, ['No packages to remove from groups']
 
 
+    def _promptWanted(self):
+        # shortcut for the always-off/always-on options
+        if self.conf.getConfigOption('assumeyes'):
+            return False
+        if self.conf.getConfigOption('alwaysprompt'):
+            return True
+        
+        # prompt if:
+        #  package was added to fill a dependency
+        #  package is being removed
+        #  package wasn't explictly given on the command line
+        for txmbr in self.tsInfo.getMembers():
+            if txmbr.isDep or \
+                   txmbr.ts_state == 'e' or \
+                   txmbr.name not in self.extcmds:
+                return True
+        
+        # otherwise, don't prompt        
+        return False
+
+
 
             
         




More information about the Yum-cvs-commits mailing list