[Yum-devel] [PATCH] Eliminate an unnecessary round of transaction re-population

Panu Matilainen pmatilai at laiskiainen.org
Wed Feb 9 12:53:52 UTC 2011


Initialize + populate the transaction set to be used for the test-run
before calling rpm_check_debug to let them use the same set, avoiding
one round of the fairly expensive re-population of the entire transaction.
---
 cli.py          |   12 ++++++------
 yum/__init__.py |   18 ++++++------------
 2 files changed, 12 insertions(+), 18 deletions(-)

diff --git a/cli.py b/cli.py
index 640f190..23ef686 100644
--- a/cli.py
+++ b/cli.py
@@ -504,6 +504,12 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
         if self.gpgsigcheck(downloadpkgs) != 0:
             return 1
         
+        self.initActionTs()
+        # save our dsCallback out
+        dscb = self.dsCallback
+        self.dsCallback = None # dumb, dumb dumb dumb!
+        self.populateTs(keepold=0) # sigh
+
         if self.conf.rpm_check_debug:
             rcd_st = time.time()
             self.verbose_logger.log(yum.logginglevels.INFO_2, 
@@ -537,12 +543,6 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
             
         
         testcb = RPMTransaction(self, test=True)
-        
-        self.initActionTs()
-        # save our dsCallback out
-        dscb = self.dsCallback
-        self.dsCallback = None # dumb, dumb dumb dumb!
-        self.populateTs(keepold=0) # sigh
         tserrors = self.ts.test(testcb)
         del testcb
 
diff --git a/yum/__init__.py b/yum/__init__.py
index de393f1..4147678 100644
--- a/yum/__init__.py
+++ b/yum/__init__.py
@@ -4804,6 +4804,12 @@ class YumBase(depsolve.Depsolve):
     
     def _doTestTransaction(self,callback,display=None):
         ''' Do the RPM test transaction '''
+        self.initActionTs()
+        # save our dsCallback out
+        dscb = self.dsCallback
+        self.dsCallback = None # dumb, dumb dumb dumb!
+        self.populateTs( keepold=0 ) # sigh
+
         # This can be overloaded by a subclass.    
         if self.conf.rpm_check_debug:
             self.verbose_logger.log(logginglevels.INFO_2, 
@@ -4833,14 +4839,7 @@ class YumBase(depsolve.Depsolve):
         # overwrite the default display class
         if display:
             testcb.display = display
-        # clean out the ts b/c we have to give it new paths to the rpms 
-        del self.ts
   
-        self.initActionTs()
-        # save our dsCallback out
-        dscb = self.dsCallback
-        self.dsCallback = None # dumb, dumb dumb dumb!
-        self.populateTs( keepold=0 ) # sigh
         tserrors = self.ts.test( testcb, conf=tsConf )
         del testcb
   
@@ -4870,10 +4869,6 @@ class YumBase(depsolve.Depsolve):
 
     def _run_rpm_check_debug(self):
         results = []
-        # save our dsCallback out
-        dscb = self.dsCallback
-        self.dsCallback = None # dumb, dumb dumb dumb!
-        self.populateTs(test=1)
         self.ts.check()
         for prob in self.ts.problems():
             #  Newer rpm (4.8.0+) has problem objects, older have just strings.
@@ -4881,7 +4876,6 @@ class YumBase(depsolve.Depsolve):
             # now just be compatible.
             results.append(to_str(prob))
 
-        self.dsCallback = dscb
         return results
 
     def add_enable_repo(self, repoid, baseurls=[], mirrorlist=None, **kwargs):
-- 
1.7.4



More information about the Yum-devel mailing list