[PATCH] Fix some bugs in setopt for repo config. entries. BZ 1023595.

James Antill james at and.org
Mon Oct 28 02:37:51 UTC 2013


1. Sort the wildcard entries, so we always do them in the same order
(probably almost never get more than one anyway).

2. Split repoid.config_name on the last dot instead of the first as
repoid can contain dots.

3. Don't set non-wildcard entries twice, just for fun.
---
 cli.py          |    2 +-
 yum/__init__.py |    8 +++++++-
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/cli.py b/cli.py
index e679546..7f6643f 100755
--- a/cli.py
+++ b/cli.py
@@ -192,7 +192,7 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
                 bad_setopt_ne.append(item)
                 continue
             k,v = vals
-            period = k.find('.') 
+            period = k.rfind('.')
             if period != -1:
                 repo = k[:period]
                 k = k[period+1:]
diff --git a/yum/__init__.py b/yum/__init__.py
index 83d2efb..6a6f1fc 100644
--- a/yum/__init__.py
+++ b/yum/__init__.py
@@ -495,7 +495,13 @@ class YumBase(depsolve.Depsolve):
                 thisrepo.base_persistdir = self.conf._repos_persistdir
 
             # do the wildcard ones first
-            for i in self.repo_setopts:
+            # The keys are in indeterminate order at this point, *sigh*.
+            for i in sorted(self.repo_setopts):
+                #  Skip normal names, as we want to do wildcard matches first
+                # and then override with specific id stuff.
+                if not misc.re_glob(i):
+                    continue
+
                 if fnmatch.fnmatch(thisrepo.id, i):
                     for opt in self.repo_setopts[i].items:
                         if not hasattr(thisrepo, opt):
-- 
1.7.7.6



More information about the Yum-devel mailing list