[Yum-devel] yum config on HEAD

Menno Smits menno-yum at freshfoo.com
Wed Oct 12 23:37:21 UTC 2005


Paul Nasrat wrote:
> The parser stuff is working with repo.d style dirs, we need to handle
> url based includes and option mapping still.  I'm thinking how to go
> about that.
> 

> class YumBaseConfig:
>     """Base config object"""
> 
>     def __init__(self, configfile='/etc/yum.conf', root='/'):
>         self.configfile = configfile
>         self.root = root
>         self.includedir = '/etc/yum.repos.d'
>         inc = root + self.includedir
> 
>         self.parser = parser.IncludedDirConfigParser(includedir=self.root + self.includedir, 
>                                                      includeglob="*.repo")
>         self.parser.read(self.root + self.configfile)
> 
>         # Populate main config
>         self.conf = MainConfig()
>         self.conf.populate(self.parser, 'main')
> 
>         # Populate repo configs
>         self.repos = []
>         for section in self.parser.sections():
>             if section == 'main':
>                 continue
>             repoconf = RepoConfig()
>             repoconf.populate(self.parser, section, parent=self.conf)
>             self.repos.append(repoconf)

Do we really need a class like this? The way I was thinking it would 
work is that what I've called MainConfig would replace the current 
YumBaseConfig (I'm not particularly in love with the MainConfig name so 
a rename would fine). Also, what I've called RepoConfig could be 
inherited by Repository class to provide the option attributes they need.

A function like the __init__() method above is of course still required 
to run the parsing and set up these objects but I don't think there's a 
need for a separate class.

Menno



More information about the Yum-devel mailing list