[Yum-devel] [PATCH 1/2] if we have some duplicate installed pkgs that do not conflict and we update for the newer one but something deps on the older one. We shouldn't fail against the rpm tscheck, we should fail well before then.

Seth Vidal skvidal at fedoraproject.org
Wed Oct 7 20:50:12 UTC 2009


This adds 'YumBase.doesThisUpdate(pkg1, pkg2)' which lets this check take less time.
---
 yum/__init__.py |   23 ++++++++++++++++++++++-
 1 files changed, 22 insertions(+), 1 deletions(-)

diff --git a/yum/__init__.py b/yum/__init__.py
index 79383a5..1dc1022 100644
--- a/yum/__init__.py
+++ b/yum/__init__.py
@@ -3154,7 +3154,13 @@ class YumBase(depsolve.Depsolve):
                 elif ipkg.verLT(available_pkg):
                     txmbr = self._add_up_txmbr(requiringPo, available_pkg, ipkg)
                     tx_return.append(txmbr)
-
+        
+        for txmbr in tx_return:
+            for i_pkg in self.rpmdb.searchNevra(name=txmbr.name):
+                if i_pkg not in txmbr.updates:
+                    if self.doesthisUpdate(txmbr.po, i_pkg):
+                        self.tsInfo.addUpdated(i_pkg, txmbr.po)
+                        
         return tx_return
         
     def remove(self, po=None, **kwargs):
@@ -4138,3 +4144,18 @@ class YumBase(depsolve.Depsolve):
 
         return True # We got a new cache dir
 
+    def doesthisUpdate(self, pkg1, pkg2):
+        """returns True if pkg1 can update pkg2, False if not"""
+        
+        if pkg1.name != pkg2.name:
+            return False
+        if not pkg1.EVR  > pkg2.EVR:
+            return False
+        if pkg1.arch not in self.arch.archlist:
+            return False
+        if rpmUtils.arch.canCoinstall(pkg1.arch, pkg2.arch):
+            return False
+        if self.allowedMultipleInstalls(pkg1):
+            return False
+            
+        return True    
-- 
1.6.2.5



More information about the Yum-devel mailing list