[yum-commits] yum/__init__.py

skvidal at osuosl.org skvidal at osuosl.org
Thu Feb 2 19:08:18 UTC 2012


 yum/__init__.py |   10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

New commits:
commit 182d2ebf74c6c9a8d95fb291f5772d579b0a3b47
Author: Seth Vidal <skvidal at fedoraproject.org>
Date:   Thu Feb 2 11:29:32 2012 -0500

    make --setopt take globs for the repo setopts - deal w/bug 755077
    
    This enables things like:
    yum --setopt='*.skip_if_unavailable=1' update
    or
    yum-config-manager --setopt='*.skip_if_unavailable=1' --save

diff --git a/yum/__init__.py b/yum/__init__.py
index 2634670..c5dac45 100644
--- a/yum/__init__.py
+++ b/yum/__init__.py
@@ -467,7 +467,15 @@ class YumBase(depsolve.Depsolve):
 
                 thisrepo.base_persistdir = self.conf._repos_persistdir
 
-
+            # do the wildcard ones first
+            for i in self.repo_setopts:
+                if fnmatch.fnmatch(thisrepo.id, i):
+                    for opt in self.repo_setopts[i].items:
+                        if not hasattr(thisrepo, opt):
+                            msg = "Repo %s did not have a %s attr. before setopt"
+                            self.logger.warning(msg % (thisrepo.id, opt))
+                        setattr(thisrepo, opt, getattr(self.repo_setopts[i], opt))
+                
             if thisrepo.id in self.repo_setopts:
                 for opt in self.repo_setopts[thisrepo.id].items:
                     if not hasattr(thisrepo, opt):


More information about the Yum-commits mailing list