- clean up the ipkgresults vs pkgresults at the top of compare_providers
- add CompareProvidersPluginConduit to plugins
---
 yum/depsolve.py |   19 +++++++++++--------
 yum/plugins.py  |    6 ++++++
 2 files changed, 17 insertions(+), 8 deletions(-)

diff --git a/yum/depsolve.py b/yum/depsolve.py
index 3e95626..737b9dc 100644
--- a/yum/depsolve.py
+++ b/yum/depsolve.py
@@ -1168,11 +1168,15 @@ class Depsolve(object):
         pkgs = unique_nevra_pkgs.values()
             
         pkgresults = {}
-        ipkgresults = {}
 
         for pkg in pkgs:
             pkgresults[pkg] = 0
-
+        
+        # hand this off to our plugins
+        self.plugins.run("compare_providers", providers_dict=pkgresults, 
+                                      reqpo=reqpo)
+        
+        for pkg in pkgresults.keys():
             rpmdbpkgs = self.rpmdb.searchNevra(name=pkg.name)
             if rpmdbpkgs:
                 #  We only want to count things as "installed" if they are
@@ -1186,15 +1190,15 @@ class Depsolve(object):
                     # we are giving an edge to is not obsoleted by
                     # something else in the transaction. :(
                     # there are many ways I hate this - this is but one
-                    ipkgresults[pkg] = 5
+                    pkgresults[pkg] += 5
                 elif newest.verEQ(pkg):
                     #  We get here from bestPackagesFromList(), give a giant
                     # bump to stuff that is already installed.
-                    ipkgresults[pkg] = 1000
+                    pkgresults[pkg] += 1000
             else:
                 # just b/c they're not installed pkgs doesn't mean they should
                 # be ignored entirely. Just not preferred
-                ipkgresults[pkg] = 0
+                pass
 
         #  This is probably only for "renames". What happens is that pkgA-1 
gets
         # obsoleted by pkgB but pkgB requires pkgA-2, now _if_ the pkgA txmbr
@@ -1204,9 +1208,8 @@ class Depsolve(object):
         # others. This works for multiple cases too, but who'd do that right?:)
         #  FIXME: A good long term. fix here is to just not get into this
         # problem, but that's too much for .21. This is much safer.
-        if ipkgresults:
-            pkgresults = ipkgresults
-            pkgs = ipkgresults.keys()
+        
+        pkgs = pkgresults.keys()
             
         # go through each pkg and compare to others
         # if it is same skip it
diff --git a/yum/plugins.py b/yum/plugins.py
index 77b38cf..8e63946 100644
--- a/yum/plugins.py
+++ b/yum/plugins.py
@@ -96,6 +96,7 @@ SLOT_TO_CONDUIT = {
     'postresolve': 'DepsolvePluginConduit',
     'historybegin': 'HistoryPluginConduit',
     'historyend': 'HistoryPluginConduit',
+    'compare_providers': 'CompareProvidersPluginConduit',
     }
 
 # Enumerate all slot names
@@ -610,6 +611,11 @@ class DepsolvePluginConduit(MainPluginConduit):
         self.resultcode = rescode
         self.resultstring = restring
 
+class CompareProvidersPluginConduit(MainPluginConduit):
+    def __init__(self, parent, base, conf, providers_dict={}, reqpo=None):
+        MainPluginConduit.__init__(self, parent, base, conf)
+        self.packages = providers_dict
+        self.reqpo = reqpo
 
 class HistoryPluginConduit(MainPluginConduit):
     def __init__(self, parent, base, conf, rescode=None, restring=[]):
-- 
1.7.0.1

_______________________________________________
Yum-devel mailing list
Yum-devel@lists.baseurl.org
http://lists.baseurl.org/mailman/listinfo/yum-devel

Reply via email to