[yum-cvs] yum/depsolve.py yum/transactioninfo.py

Seth Vidal skvidal at linux.duke.edu
Thu Nov 29 22:46:44 UTC 2007


 yum/depsolve.py        |   10 +++++-----
 yum/transactioninfo.py |   23 ++++++++++++++++++++++-
 2 files changed, 27 insertions(+), 6 deletions(-)

New commits:
commit 317a0010f80b1d72e349f0a7027d8cd3ec77ba36
Author: Seth Vidal <skvidal at fedoraproject.org>
Date:   Thu Nov 29 17:40:56 2007 -0500

    make sure pkgs are added to the tsInfo for depsolving in the proper mode
    if they are an installonlypkg then treat them as such. Appears to fix rh bug 330711

diff --git a/yum/depsolve.py b/yum/depsolve.py
index 48dd48c..25f5f76 100644
--- a/yum/depsolve.py
+++ b/yum/depsolve.py
@@ -82,14 +82,14 @@ class Depsolve(object):
         if not self.conf.installroot:
             raise Errors.YumBaseError, 'Setting up TransactionSets before config class is up'
         
-        self._tsInfo = self._transactionDataFactory()
-        self._tsInfo.setDatabases(self.rpmdb, self.pkgSack)
+        self._getTsInfo()
         self.initActionTs()
     
     def _getTsInfo(self):
         if self._tsInfo is None:
             self._tsInfo = self._transactionDataFactory()
             self._tsInfo.setDatabases(self.rpmdb, self.pkgSack)
+            self._tsInfo.installonlypkgs = self.conf.installonlypkgs # this kinda sucks
         return self._tsInfo
 
     def _setTsInfo(self, value):
@@ -178,13 +178,13 @@ class Depsolve(object):
            like kernels and kernel modules, for example"""
            
         if po.name in self.conf.installonlypkgs:
-            return 1
+            return True
         
         provides = po.provides_names
         if filter (lambda prov: prov in self.conf.installonlypkgs, provides):
-            return 1
+            return True
         
-        return 0
+        return False
 
     def populateTs(self, test=0, keepold=1):
         """take transactionData class and populate transaction set"""
diff --git a/yum/transactioninfo.py b/yum/transactioninfo.py
index 8aed378..725789f 100644
--- a/yum/transactioninfo.py
+++ b/yum/transactioninfo.py
@@ -44,6 +44,7 @@ class TransactionData:
         self.removedmembers = {}
         self.debug = 0
         self.changed = False
+        self.installonlypkgs = []
         
         self.conditionals = {} # key = pkgname, val = list of pos to add
 
@@ -157,6 +158,20 @@ class TransactionData:
         # Is this the right criteria?
         return txmember.ts_state in ('u', 'i') and not isinstance(txmember.po, (YumInstalledPackage, YumAvailablePackageSqlite))
 
+    def _allowedMultipleInstalls(self, po):
+        """takes a packageObject, returns 1 or 0 depending on if the package 
+           should/can be installed multiple times with different vers
+           like kernels and kernel modules, for example"""
+           
+        if po.name in self.installonlypkgs:
+            return True
+        
+        provides = po.provides_names
+        if filter (lambda prov: prov in self.installonlypkgs, provides):
+            return True
+        
+        return False
+        
     def add(self, txmember):
         """add a package to the transaction"""
         
@@ -285,6 +300,9 @@ class TransactionData:
     def addInstall(self, po):
         """adds a package as an install but in mode 'u' to the ts
            takes a packages object and returns a TransactionMember Object"""
+
+        if self._allowedMultipleInstalls(po):
+           return self.addTrueInstall(po)
     
         txmbr = TransactionMember(po)
         txmbr.current_state = TS_AVAILABLE
@@ -324,7 +342,10 @@ class TransactionData:
     def addUpdate(self, po, oldpo=None):
         """adds a package as an update
            takes a packages object and returns a TransactionMember Object"""
-    
+        
+        if self._allowedMultipleInstalls(po):
+           return self.addTrueInstall(po)
+            
         txmbr = TransactionMember(po)
         txmbr.current_state = TS_AVAILABLE
         txmbr.output_state = TS_UPDATE



More information about the Yum-cvs-commits mailing list