diff options
author | 2015-06-27 03:19:23 -0400 | |
---|---|---|
committer | 2015-06-27 03:21:17 -0400 | |
commit | e74215cb7a79281978054fd1897e140da4d89d5b (patch) | |
tree | 0575d1e196fb3ff5241f760b48d0c2ec31cd4c57 | |
parent | fix unknown mirror error message wording (diff) | |
download | pkgcore-e74215cb7a79281978054fd1897e140da4d89d5b.tar.gz pkgcore-e74215cb7a79281978054fd1897e140da4d89d5b.tar.bz2 pkgcore-e74215cb7a79281978054fd1897e140da4d89d5b.zip |
portage_conf: re-add missing fields for repo objects in the config
This fixes things like slaved repos properly inheriting mirrors from the
master repo.
Note that more work needs to be done since this doesn't fully handle
multiple masters yet or response the masters field from repos.conf
settings.
-rw-r--r-- | pkgcore/ebuild/portage_conf.py | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/pkgcore/ebuild/portage_conf.py b/pkgcore/ebuild/portage_conf.py index e4781ddf..8f659c54 100644 --- a/pkgcore/ebuild/portage_conf.py +++ b/pkgcore/ebuild/portage_conf.py @@ -341,7 +341,7 @@ def load_repos_conf(path): repos[default_repo]['priority'] = -9999 del config - return repos + return defaults, repos @configurable({'location': 'str'}, typename='configsection') @@ -417,13 +417,13 @@ def config_from_make_conf(location="/etc/", profile_override=None, **kwargs): config["vdb"] = basics.AutoConfigSection(kwds) try: - repos_conf = load_repos_conf(pjoin(portage_base, 'repos.conf')) + defaults, repos_conf = load_repos_conf(pjoin(portage_base, 'repos.conf')) except errors.ParsingError as e: if not getattr(getattr(e, 'exc', None), 'errno', None) == errno.ENOENT: raise try: # fallback to defaults provided by pkgcore - repos_conf = load_repos_conf( + defaults, repos_conf = load_repos_conf( pjoin(const.CONFIG_PATH, 'repos.conf')) except IGNORED_EXCEPTIONS: raise @@ -436,6 +436,7 @@ def config_from_make_conf(location="/etc/", profile_override=None, **kwargs): # sort repos via priority, in this case high values map to high priorities repos = [repo_opts['location'] for repo_opts in sorted(repos_conf.itervalues(), key=lambda d: d['priority'], reverse=True)] + default_repo = repos_conf[defaults['main-repo']]['location'] config['ebuild-repo-common'] = basics.AutoConfigSection({ 'class': 'pkgcore.ebuild.repository.slavedtree', @@ -457,7 +458,6 @@ def config_from_make_conf(location="/etc/", profile_override=None, **kwargs): 'location': repo_path, 'syncer': 'sync:%s' % (repo_path,) } - config['raw:' + repo_path] = basics.AutoConfigSection(conf) # metadata cache cache_name = 'cache:%s' % (repo_path,) @@ -467,10 +467,19 @@ def config_from_make_conf(location="/etc/", profile_override=None, **kwargs): kwds = { 'inherit': ('ebuild-repo-common',), 'raw_repo': ('raw:' + repo_path), - 'class': 'pkgcore.ebuild.repository.tree', 'cache': cache_name, } + # if masters is missing default use the value of main-repo from + # repos.conf for a master + if repo_config.masters is None: + kwds['parent_repo'] = default_repo + + if repo_path == default_repo: + conf['default'] = True + kwds['class'] = 'pkgcore.ebuild.repository.tree' + + config['raw:' + repo_path] = basics.AutoConfigSection(conf) config[repo_path] = basics.AutoConfigSection(kwds) # XXX: Hack for portage-2 profile format support. We need to figure out how |