From a5dd8b59fbf253a435e5ca32c5fd0d128d1d8cfb Mon Sep 17 00:00:00 2001 From: Arfrever Frehtes Taifersar Arahesis Date: Sat, 13 Jul 2013 12:01:07 +0200 Subject: [PATCH] Move default configuration of repositories from /usr/share/portage/config/make.globals to /usr/share/portage/config/repos.conf. --- Makefile | 2 +- bin/repoman | 3 +-- cnf/make.globals | 9 ++++----- cnf/repos.conf | 5 +++++ man/portage.5 | 12 +++++++++--- pym/portage/repository/config.py | 11 ++++++++--- 6 files changed, 28 insertions(+), 14 deletions(-) create mode 100644 cnf/repos.conf diff --git a/Makefile b/Makefile index be2e0891b..4bd6c0df8 100644 --- a/Makefile +++ b/Makefile @@ -27,7 +27,7 @@ INSMODE = 0644 EXEMODE = 0755 DIRMODE = 0755 SYSCONFDIR_FILES = etc-update.conf dispatch-conf.conf -PORTAGE_CONFDIR_FILES = make.globals +PORTAGE_CONFDIR_FILES = make.globals repos.conf LOGROTATE_FILES = elog-save-summary BINDIR_FILES = ebuild egencache emerge emerge-webrsync \ emirrordist portageq quickpkg repoman diff --git a/bin/repoman b/bin/repoman index e31f69924..f21dacc1b 100755 --- a/bin/repoman +++ b/bin/repoman @@ -590,7 +590,6 @@ except KeyError: layout_conf_data = portage.repository.config.parse_layout_conf(portdir_overlay)[0] if layout_conf_data['repo-name']: repo_name = layout_conf_data['repo-name'] - repos_conf_file = os.path.join(repoman_settings["PORTAGE_CONFIGROOT"], portage.const.USER_CONFIG_PATH, "repos.conf") tmp_conf_file = io.StringIO(textwrap.dedent(""" [%s] location = %s @@ -601,7 +600,7 @@ except KeyError: repoman_settings['PORTDIR_OVERLAY'] = "%s %s" % \ (repoman_settings.get('PORTDIR_OVERLAY', ''), portage._shell_quote(portdir_overlay)) - repositories = portage.repository.config.RepoConfigLoader([repos_conf_file, tmp_conf_file], repoman_settings) + repositories = portage.repository.config.load_repository_config(repoman_settings, extra_files=[tmp_conf_file]) # We have to call the config constructor again so that attributes # dependent on config.repositories are initialized correctly. repoman_settings = portage.config(config_root=config_root, local_config=False, repositories=repositories) diff --git a/cnf/make.globals b/cnf/make.globals index a128029de..4b524a19d 100644 --- a/cnf/make.globals +++ b/cnf/make.globals @@ -30,11 +30,10 @@ ACCEPT_LICENSE="* -@EULA" ACCEPT_PROPERTIES="*" ACCEPT_RESTRICT="*" -# Repository Paths -PORTDIR=/usr/portage -DISTDIR=${PORTDIR}/distfiles -PKGDIR=${PORTDIR}/packages -RPMDIR=${PORTDIR}/rpm +# Miscellaneous paths +DISTDIR=/usr/portage/distfiles +PKGDIR=/usr/portage/packages +RPMDIR=/usr/portage/rpm # Temporary build directory PORTAGE_TMPDIR=/var/tmp diff --git a/cnf/repos.conf b/cnf/repos.conf new file mode 100644 index 000000000..8bdf2bfaf --- /dev/null +++ b/cnf/repos.conf @@ -0,0 +1,5 @@ +[DEFAULT] +main-repo = gentoo + +[gentoo] +location = /usr/portage diff --git a/man/portage.5 b/man/portage.5 index ca468b843..01be18b65 100644 --- a/man/portage.5 +++ b/man/portage.5 @@ -106,6 +106,7 @@ use.stable.force .BR /usr/share/portage/config/ .nf make.globals +repos.conf .fi .TP .BR /var/cache/edb/ @@ -1114,9 +1115,14 @@ games\-emulation/xmess:net \- Adds network support .TP .BR make.globals The global default settings for Portage. This comes from the portage package -itself. Settings in \fBmake.conf\fR or \fBpackage.env\fR -override values here. The format -is described extensivly in \fBmake.conf\fR(5). +itself. Settings in \fBmake.conf\fR or \fBpackage.env\fR override values set +here. The format is described extensively in \fBmake.conf\fR(5). +.TP +.BR repos.conf +The default configuration of repositories for Portage. This comes from +the portage package itself. Settings in \fB/etc/portage/repos.conf\fR +override values set here. The format is described extensively in section +for \fB/etc/portage/repos.conf\fR. .RE .TP .BR /var/cache/edb/ diff --git a/pym/portage/repository/config.py b/pym/portage/repository/config.py index 5d4966a7d..676e7e300 100644 --- a/pym/portage/repository/config.py +++ b/pym/portage/repository/config.py @@ -20,7 +20,7 @@ except ImportError: import portage from portage import eclass_cache, os from portage.const import (MANIFEST2_HASH_FUNCTIONS, MANIFEST2_REQUIRED_HASH, - REPO_NAME_LOC, USER_CONFIG_PATH) + PORTAGE_BASE_PATH, REPO_NAME_LOC, USER_CONFIG_PATH) from portage.eapi import eapi_allows_directories_on_profile_level_and_repository_level from portage.env.loaders import KeyValuePairFileLoader from portage.util import (normalize_path, read_corresponding_eapi_file, shlex_split, @@ -846,13 +846,18 @@ class RepoConfigLoader(object): config_string += "%s = %s\n" % (key.replace("_", "-"), " ".join(x.name for x in getattr(repo, key))) return config_string -def load_repository_config(settings): +def load_repository_config(settings, extra_files=None): repoconfigpaths = [] if "PORTAGE_REPOSITORIES" in settings: repoconfigpaths.append(io.StringIO(settings["PORTAGE_REPOSITORIES"])) else: - # repoconfigpaths.append(os.path.join(settings.global_config_path, "repos.conf")) + if portage._working_copy: + repoconfigpaths.append(os.path.join(PORTAGE_BASE_PATH, "cnf", "repos.conf")) + else: + repoconfigpaths.append(os.path.join(settings.global_config_path, "repos.conf")) repoconfigpaths.append(os.path.join(settings["PORTAGE_CONFIGROOT"], USER_CONFIG_PATH, "repos.conf")) + if extra_files: + repoconfigpaths.extend(extra_files) return RepoConfigLoader(repoconfigpaths, settings) def _get_repo_name(repo_location, cached=None): -- 2.26.2