From 3819b77c816310361237b209e9dfb785f4b80710 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Thu, 16 Apr 2009 20:40:14 +0000 Subject: Add support in repos.conf to override the "masters" setting from layout.conf. svn path=/main/trunk/; revision=13350 --- man/portage.5 | 13 ++++++++++--- pym/portage/__init__.py | 14 +++++++++++--- pym/portage/dbapi/porttree.py | 27 +++++++++++++++++++-------- 3 files changed, 40 insertions(+), 14 deletions(-) diff --git a/man/portage.5 b/man/portage.5 index 593410265..35cfdd777 100644 --- a/man/portage.5 +++ b/man/portage.5 @@ -552,8 +552,9 @@ x11\-libs/qt \-mysql Specifies \fIsite\-specific\fR repository configuration information. Note that configuration settings which are specified here do not apply to tools such as \fBrepoman\fR(1) and \fBegencache\fR(1) since their operations -are inherently \fBnot\fR \fIsite\-specific\fR. Beware that use of -\fBeclass\-overrides\fR is generally not recommended and that it may trigger +are inherently \fBnot\fR \fIsite\-specific\fR. \fBWARNING:\fR Use of +\fBrepos.conf\fR is generally not recommended since resulting changes in +eclass inheritance (especially due ot \fBeclass\-overrides\fR) may trigger performance issues under some circumstances (see \fBbug #124041\fR). .I Example: @@ -567,6 +568,10 @@ eclass\-overrides = java\-overlay java\-experimental # disable all eclass overrides for ebuilds from the gentoo repository [gentoo] eclass\-overrides = + +# override the metadata/layout.conf masters setting from the kde-testing repo +[kde-testing] +masters = gentoo kde .fi .RE .TP @@ -579,7 +584,9 @@ Specifies information about the repository layout. Currently, only a single repositories which satisfy dependencies on eclasses and/or ebuilds. Each repository name should correspond the value of a \fBrepo_name\fR entry from one of the repositories that is configured via the \fBPORTDIR\fR or -\fBPORTDIR_OVERLAY\fR variables (see \fBmake.conf\fR(5)). +\fBPORTDIR_OVERLAY\fR variables (see \fBmake.conf\fR(5)). Site-specific +overrides to \fBlayout.conf\fR settings may be specified in +\fB/etc/portage/repos.conf\fR. .I Example: .nf diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py index 8e73e211a..6fea2b82b 100644 --- a/pym/portage/__init__.py +++ b/pym/portage/__init__.py @@ -1001,11 +1001,19 @@ def _lazy_iuse_regex(iuse_implicit): return regex class _local_repo_config(object): - __slots__ = ('eclass_overrides', 'name',) + __slots__ = ('eclass_overrides', 'masters', 'name',) def __init__(self, name, repo_opts): self.name = name - self.eclass_overrides = \ - tuple(repo_opts.get('eclass-overrides', '').split()) + + eclass_overrides = repo_opts.get('eclass-overrides') + if eclass_overrides is not None: + eclass_overrides = tuple(eclass_overrides.split()) + self.eclass_overrides = eclass_overrides + + masters = repo_opts.get('masters') + if masters is not None: + masters = tuple(masters.split()) + self.masters = masters class config(object): """ diff --git a/pym/portage/dbapi/porttree.py b/pym/portage/dbapi/porttree.py index a9496c8eb..246a0d6f1 100644 --- a/pym/portage/dbapi/porttree.py +++ b/pym/portage/dbapi/porttree.py @@ -207,11 +207,27 @@ class portdbapi(dbapi): continue repo_name = self._repository_map.get(path) + + loc_repo_conf = None + if local_repo_configs is not None: + if repo_name is not None: + loc_repo_conf = local_repo_configs.get(repo_name) + else: + loc_repo_conf = default_loc_repo_config + layout_filename = os.path.join(path, "metadata/layout.conf") layout_file = KeyValuePairFileLoader(layout_filename, None, None) layout_data, layout_errors = layout_file.load() porttrees = [] - for master_name in layout_data.get('masters', '').split(): + + masters = None + if loc_repo_conf is not None and \ + loc_repo_conf.masters is not None: + masters = loc_repo_conf.masters + else: + masters = layout_data.get('masters', '').split() + + for master_name in masters: master_path = self.treemap.get(master_name) if master_path is None: writemsg_level(("Unavailable repository '%s' " + \ @@ -230,13 +246,8 @@ class portdbapi(dbapi): porttrees.append(path) - if local_repo_configs is not None: - loc_repo_conf = None - if repo_name is not None: - loc_repo_conf = local_repo_configs.get(repo_name) - if loc_repo_conf is None: - loc_repo_conf = default_loc_repo_config - if loc_repo_conf is not None: + if loc_repo_conf is not None and \ + loc_repo_conf.eclass_overrides is not None: for other_name in loc_repo_conf.eclass_overrides: other_path = self.treemap.get(other_name) if other_path is None: -- cgit v1.2.3-1-g7c22