[yum-git] plugins/priorities

James Antill james at linux.duke.edu
Fri Jan 25 14:41:20 UTC 2008


 plugins/priorities/priorities.py |   18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

New commits:
commit a17eea89f0b092671fb28470a96c66b1fceaf4d1
Author: James Antill <james at and.org>
Date:   Fri Jan 25 09:40:43 2008 -0500

    Make yum-priorities not eat CPU just by installing it

diff --git a/plugins/priorities/priorities.py b/plugins/priorities/priorities.py
index d542b42..1e45f04 100644
--- a/plugins/priorities/priorities.py
+++ b/plugins/priorities/priorities.py
@@ -80,17 +80,31 @@ def config_hook(conduit):
             action='store_true', default = False,
             help="Priority-exclude packages based on name + arch")
 
+def _all_repo_priorities_same(allrepos):
+    """ Are all repos are at the same priority """
+    first = None
+    for repo in allrepos:
+        if first is None:
+            first = repo.priority
+        elif first != repo.priority:
+            return False
+    return True
+
 def exclude_hook(conduit):
     global only_samearch
 
+    allrepos = conduit.getRepos().listEnabled()
+
+    # If they haven't done anything, don't do any work
+    if _all_repo_priorities_same(allrepos):
+        return
+    
     # Check whether the user specified the --samearch option.
     opts, commands = conduit.getCmdLine()
     if opts and opts.samearch:
         only_samearch = True
 
     cnt = 0
-    allrepos = conduit.getRepos().listEnabled()
-
     if check_obsoletes:
         obsoletes = conduit._base.pkgSack.returnObsoletes() 
 



More information about the Yum-cvs-commits mailing list