[yum-git] yum/rpmtrans.py

Seth Vidal skvidal at linux.duke.edu
Thu Feb 21 20:13:01 UTC 2008


 yum/rpmtrans.py |   25 +++++++++++++------------
 1 file changed, 13 insertions(+), 12 deletions(-)

New commits:
commit 4509f98171b4675ebfd3f84127016cc579566393
Author: Seth Vidal <skvidal at fedoraproject.org>
Date:   Thu Feb 21 15:08:44 2008 -0500

    this patch makes pretrans inside packages not cause the transaction to explode
    thanks(?) to Bill Nottingham for pointing it out.

diff --git a/yum/rpmtrans.py b/yum/rpmtrans.py
index 05d7fbd..7afb001 100644
--- a/yum/rpmtrans.py
+++ b/yum/rpmtrans.py
@@ -144,7 +144,7 @@ class RPMTransaction:
             self.display = display() # display callback
         self.base = base # base yum object b/c we need so much
         self.test = test # are we a test?
-        
+        self.trans_running = False
         self.filehandles = {}
         self.total_actions = 0
         self.total_installed = 0
@@ -337,7 +337,7 @@ class RPMTransaction:
         if bytes == 6:
             self.total_actions = total
             if self.test: return
-
+            self.trans_running = True
             self.ts_all() # write out what transaction will do
 
     def _transProgress(self, bytes, total, h):
@@ -354,9 +354,10 @@ class RPMTransaction:
             handle = self._makeHandle(hdr)
             fd = os.open(rpmloc, os.O_RDONLY)
             self.filehandles[handle]=fd
-            self.total_installed += 1
-            self.complete_actions += 1
-            self.installed_pkg_names.append(hdr['name'])
+            if self.trans_running:
+                self.total_installed += 1
+                self.complete_actions += 1
+                self.installed_pkg_names.append(hdr['name'])
             return fd
         else:
             self.display.errorlog("Error: No Header to INST_OPEN_FILE")
@@ -369,13 +370,13 @@ class RPMTransaction:
             os.close(self.filehandles[handle])
             fd = 0
             if self.test: return
-            
-            pkgtup = self._dopkgtup(hdr)
-            txmbrs = self.base.tsInfo.getMembers(pkgtup=pkgtup)
-            for txmbr in txmbrs:
-                self.display.filelog(txmbr.po, txmbr.output_state)
-                self.display.scriptout(txmbr.po, self._scriptOutput())
-                self.ts_done(txmbr.po, txmbr.output_state)
+            if self.trans_running:
+                pkgtup = self._dopkgtup(hdr)
+                txmbrs = self.base.tsInfo.getMembers(pkgtup=pkgtup)
+                for txmbr in txmbrs:
+                    self.display.filelog(txmbr.po, txmbr.output_state)
+                    self.display.scriptout(txmbr.po, self._scriptOutput())
+                    self.ts_done(txmbr.po, txmbr.output_state)
                 
                 
     



More information about the Yum-cvs-commits mailing list