[yum-cvs] yum/yum __init__.py,1.101,1.102 config.py,1.50,1.51

Menno Smits mjs at login.linux.duke.edu
Fri Mar 25 09:42:28 UTC 2005


Update of /home/groups/yum/cvs/yum/yum
In directory login:/tmp/cvs-serv15605/yum

Modified Files:
	__init__.py config.py 
Log Message:
The "reposdir" option now takes a list of directories to search for .repo
files. The default is /etc/yum/repos.d and /etc/yum.repos.d.


Index: __init__.py
===================================================================
RCS file: /home/groups/yum/cvs/yum/yum/__init__.py,v
retrieving revision 1.101
retrieving revision 1.102
diff -u -r1.101 -r1.102
--- __init__.py	25 Mar 2005 09:14:11 -0000	1.101
+++ __init__.py	25 Mar 2005 09:42:25 -0000	1.102
@@ -66,12 +66,11 @@
     def filelog(self, value, msg):
         print msg
    
-    def doConfigSetup(self, fn='/etc/yum.conf', root='/', 
-            plugindir='/usr/lib/yum-plugins'):
+    def doConfigSetup(self, fn='/etc/yum.conf', root='/'):
         """basic stub function for doing configuration setup"""
        
         # Load plugins first as they make affect available config options
-        self.plugins = plugins.YumPlugins(self, plugindir)
+        self.plugins = plugins.YumPlugins(self)
 
         self.conf = config.yumconf(configfile=fn, root=root, 
                 plugins=self.plugins)
@@ -96,36 +95,35 @@
                 else:
                     reposlist.append(thisrepo)
 
-        # reads through reposdir for *.repo
+        # reads through each reposdir for *.repo
         # does not read recursively
         # read each of them in using confpp, then parse them same as any other repo
         # section - as above.
-        reposdir = self.conf.reposdir
-        if os.path.exists(self.conf.installroot + '/' + reposdir):
-            reposdir = self.conf.installroot + '/' + reposdir
-        
-        reposglob = reposdir + '/*.repo'
-        if os.path.exists(reposdir) and os.path.isdir(reposdir):
-            repofn = glob.glob(reposglob)
-            repofn.sort()
-            
-            for fn in repofn:
-                if not os.path.isfile(fn):
-                    continue
-                try:
-                    cfg, sections = config.parseDotRepo(fn)
-                except Errors.ConfigError, e:
-                    self.errorlog(2, e)
-                    continue
-
-                for section in sections:
+        for reposdir in self.conf.reposdir:
+            if os.path.exists(self.conf.installroot + '/' + reposdir):
+                reposdir = self.conf.installroot + '/' + reposdir
+            
+            if os.path.isdir(reposdir):
+                repofn = glob.glob(reposdir+'/*.repo')
+                repofn.sort()
+                
+                for fn in repofn:
+                    if not os.path.isfile(fn):
+                        continue
                     try:
-                        thisrepo = config.cfgParserRepo(section, self.conf, cfg)
-                    except (Errors.RepoError, Errors.ConfigError), e:
+                        cfg, sections = config.parseDotRepo(fn)
+                    except Errors.ConfigError, e:
                         self.errorlog(2, e)
                         continue
-                    else:
-                        reposlist.append(thisrepo)
+
+                    for section in sections:
+                        try:
+                            thisrepo = config.cfgParserRepo(section, self.conf, 
+                                    cfg)
+                            reposlist.append(thisrepo)
+                        except (Errors.RepoError, Errors.ConfigError), e:
+                            self.errorlog(2, e)
+                            continue
 
         # got our list of repo objects
         for thisrepo in reposlist:

Index: config.py
===================================================================
RCS file: /home/groups/yum/cvs/yum/yum/config.py,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -r1.50 -r1.51
--- config.py	21 Mar 2005 12:37:13 -0000	1.50
+++ config.py	25 Mar 2005 09:42:25 -0000	1.51
@@ -196,7 +196,7 @@
         #defaults -either get them or set them
         optionstrings = [('cachedir', '/var/cache/yum'), 
                          ('logfile', '/var/log/yum.log'), 
-                         ('reposdir', '/etc/yum.repos.d'),
+                         ('reposdir', ['/etc/yum/repos.d', '/etc/yum.repos.d']),
                          ('pkgpolicy', 'newest'),
                          ('syslog_ident', None),
                          ('syslog_facility', 'LOG_USER'),
@@ -323,11 +323,13 @@
         for option in ['commands', 'installonlypkgs', 'kernelpkgnames', 'exclude']:
             self.configdata[option] = variableReplace(self.yumvar, self.configdata[option])
             self.configdata[option] = variableReplace(self.yumvar, self.configdata[option])
+            setattr(self, option, self.configdata[option])
 
         # make our lists into lists. :)
-        for option in ['exclude', 'installonlypkgs', 'kernelpkgnames', 'tsflags']:
+        for option in ('exclude', 'installonlypkgs', 'kernelpkgnames', 
+                'tsflags', 'reposdir'):
             self.configdata[option] = parseList(self.configdata[option])
-
+            setattr(self, option, self.configdata[option])
 
         # Process options from plugins
         dopluginopts(self.plugins, self.cfg, 'main', PLUG_OPT_WHERE_GLOBAL, 
@@ -691,6 +693,7 @@
     def geturl(self): return self.name
 
 def main(args):
+
     myfile = args[0]
     if len(args) > 1:
         if args[1] == '--dump':
@@ -725,6 +728,7 @@
     # does not read recursively
     # read each of them in using confpp, then parse them same as any other repo
     # section - as above.
+
     reposdir = conf.reposdir
     if os.path.exists(conf.installroot + '/' + reposdir):
         reposdir = conf.installroot + '/' + reposdir




More information about the Yum-cvs-commits mailing list