[yum-commits] yum/__init__.py yum/repos.py

zpavlas at osuosl.org zpavlas at osuosl.org
Wed Dec 12 08:14:45 UTC 2012


 yum/__init__.py |   18 ------------------
 yum/repos.py    |   12 ++++++++++++
 2 files changed, 12 insertions(+), 18 deletions(-)

New commits:
commit e59cc2006dc0c527dd4e17c5fa88329a28a75e7d
Author: Zdeněk Pavlas <zpavlas at redhat.com>
Date:   Tue Dec 11 11:07:32 2012 +0100

    move the basename checking into _repos.doSetup(). BZ 885159

diff --git a/yum/__init__.py b/yum/__init__.py
index e158b0e..2a82f97 100644
--- a/yum/__init__.py
+++ b/yum/__init__.py
@@ -701,24 +701,6 @@ class YumBase(depsolve.Depsolve):
 
 
         if doSetup:
-            if (hasattr(urlgrabber, 'grabber') and
-                hasattr(urlgrabber.grabber, 'pycurl')):
-                # Must do basename checking, on cert. files...
-                cert_basenames = {}
-                for repo in self._repos.listEnabled():
-                    if not repo.sslclientcert:
-                        continue
-                    bn = os.path.basename(repo.sslclientcert)
-                    if bn not in cert_basenames:
-                        cert_basenames[bn] = repo
-                        continue
-                    if repo.sslclientcert == cert_basenames[bn].sslclientcert:
-                        # Exactly the same path is fine too
-                        continue
-
-                    msg = 'sslclientcert basename shared between %s and %s'
-                    raise Errors.ConfigError, msg % (repo, cert_basenames[bn])
-
             repo_st = time.time()        
             self._repos.doSetup(thisrepo)
             self.verbose_logger.debug('repo time: %0.3f' % (time.time() - repo_st))        
diff --git a/yum/repos.py b/yum/repos.py
index de5da1e..3522512 100644
--- a/yum/repos.py
+++ b/yum/repos.py
@@ -19,6 +19,7 @@ import fnmatch
 import types
 import logging
 import misc
+import os
 
 import Errors
 from packageSack import MetaSack
@@ -121,6 +122,17 @@ class RepoStorage:
         if len(repos) < 1:
             self.logger.debug('No Repositories Available to Set Up')
 
+        if hasattr(urlgrabber.grabber, 'pycurl'):
+            # Must do basename checking, on cert. files...
+            cert_basenames = {}
+            for repo in self.listEnabled():
+                if repo.sslclientcert:
+                    bn = os.path.basename(repo.sslclientcert)
+                    other = cert_basenames.setdefault(bn, repo)
+                    if repo.sslclientcert != other.sslclientcert:
+                        msg = 'sslclientcert basename shared between %s and %s'
+                        raise Errors.ConfigError, msg % (repo, other)
+
         for repo in repos:
             repo.setup(self.ayum.conf.cache, self.ayum.mediagrabber,
                    gpg_import_func = self.gpg_import_func, confirm_func=self.confirm_func,


More information about the Yum-commits mailing list