Add support in repos.conf to override the "masters" setting from layout.conf.
authorZac Medico <zmedico@gentoo.org>
Thu, 16 Apr 2009 20:40:14 +0000 (20:40 -0000)
committerZac Medico <zmedico@gentoo.org>
Thu, 16 Apr 2009 20:40:14 +0000 (20:40 -0000)
svn path=/main/trunk/; revision=13350

man/portage.5
pym/portage/__init__.py
pym/portage/dbapi/porttree.py

index 593410265278c9b0f48236a9c4352abe90e42724..35cfdd77776e5ad69553f11130cb19630b25833f 100644 (file)
@@ -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
index 8e73e211a2d2e94ba3e4a2ea4acb91d428729501..6fea2b82bd1a72a25a4dab398c1d5972a1c96d6a 100644 (file)
@@ -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):
        """
index a9496c8ebd60a32bb9fd333611174ac2dc285676..246a0d6f1ddbfe3654e08b100c73f91446e47b5f 100644 (file)
@@ -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: