[yum-cvs] yum/rpmUtils transaction.py,1.23,1.24

Menno Smits mjs at linux.duke.edu
Sun Sep 3 21:11:07 UTC 2006


Update of /home/groups/yum/cvs/yum/rpmUtils
In directory login1.linux.duke.edu:/tmp/cvs-serv2539/rpmUtils

Modified Files:
	transaction.py 
Log Message:
Fixes so that CTRL-C finally works properly:
    - rpmdb transactions are only kept open when strictly necessary so that
      SIGINT handler is left alone by rpm during downloads etc
    - added a simple interrupt_callback for package downloads. A single CTRL-C
      will push the download to the next mirror. Two quick CTRL-C's will
      terminate Yum. This needs cleaning up to not upset Yum API clients.


Index: transaction.py
===================================================================
RCS file: /home/groups/yum/cvs/yum/rpmUtils/transaction.py,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- transaction.py	10 Feb 2006 05:53:43 -0000	1.23
+++ transaction.py	3 Sep 2006 21:11:05 -0000	1.24
@@ -42,6 +42,17 @@
                          'next',
                          'clean']
         self.tsflags = []
+        self.open = True
+
+    def __del__(self):
+        # Automatically close the rpm transaction when the reference is lost
+        self.close()
+
+    def close(self):
+        if self.open:
+            self.ts.closeDB()
+            self.ts = None
+            self.open = False
 
     def __getattr__(self, attr):
         if attr in self._methods:




More information about the Yum-cvs-commits mailing list