summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2009-04-30 07:13:58 +0000
committerZac Medico <zmedico@gentoo.org>2009-04-30 07:13:58 +0000
commitca074372712cb4eb4e730befb08d682fd1eb8bfe (patch)
treeb214b7b5b98c98b648271688cd76cef5885ff8e0
parentFix typo from previous commit. (trunk r13351) (diff)
downloadportage-multirepo-ca074372712cb4eb4e730befb08d682fd1eb8bfe.tar.gz
portage-multirepo-ca074372712cb4eb4e730befb08d682fd1eb8bfe.tar.bz2
portage-multirepo-ca074372712cb4eb4e730befb08d682fd1eb8bfe.zip
Add support for repos.conf 'aliases' attribute which allows alias
substitution in metadata/layout.conf repository references. (trunk r13352) svn path=/main/branches/2.1.6/; revision=13508
-rw-r--r--man/portage.59
-rw-r--r--pym/portage/__init__.py7
-rw-r--r--pym/portage/dbapi/porttree.py16
3 files changed, 28 insertions, 4 deletions
diff --git a/man/portage.5 b/man/portage.5
index e95c5ba7..3a34b167 100644
--- a/man/portage.5
+++ b/man/portage.5
@@ -558,18 +558,21 @@ performance issues under some circumstances (see \fBbug #124041\fR).
.I Example:
.nf
+[DEFAULT]
# make all repositories inherit eclasses from the java\-overlay and
# java\-experimental repositories, with eclasses from java\-experimental
# taking precedence over those from java\-overlay
-[DEFAULT]
eclass\-overrides = java\-overlay java\-experimental
-# disable all eclass overrides for ebuilds from the gentoo repository
[gentoo]
+# disable all eclass overrides for ebuilds from the gentoo repository
eclass\-overrides =
+# when processing metadata/layout.conf from other repositories, substitute
+# 'gentoo' in place of references to repositories named 'foo' and 'bar'
+aliases = foo bar
-# override the metadata/layout.conf masters setting from the kde-testing repo
[kde-testing]
+# override the metadata/layout.conf masters setting from the kde-testing repo
masters = gentoo kde
.fi
.RE
diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py
index a0fc3655..be747f5b 100644
--- a/pym/portage/__init__.py
+++ b/pym/portage/__init__.py
@@ -1001,10 +1001,15 @@ def _lazy_iuse_regex(iuse_implicit):
return regex
class _local_repo_config(object):
- __slots__ = ('eclass_overrides', 'masters', 'name',)
+ __slots__ = ('aliases', 'eclass_overrides', 'masters', 'name',)
def __init__(self, name, repo_opts):
self.name = name
+ aliases = repo_opts.get('aliases')
+ if aliases is not None:
+ aliases = tuple(aliases.split())
+ self.aliases = aliases
+
eclass_overrides = repo_opts.get('eclass-overrides')
if eclass_overrides is not None:
eclass_overrides = tuple(eclass_overrides.split())
diff --git a/pym/portage/dbapi/porttree.py b/pym/portage/dbapi/porttree.py
index 246a0d6f..c07cf4ff 100644
--- a/pym/portage/dbapi/porttree.py
+++ b/pym/portage/dbapi/porttree.py
@@ -200,8 +200,23 @@ class portdbapi(dbapi):
eclass_dbs = {porttree_root : self.eclassdb}
local_repo_configs = self.mysettings._local_repo_configs
default_loc_repo_config = None
+ repo_aliases = {}
if local_repo_configs is not None:
default_loc_repo_config = local_repo_configs.get('DEFAULT')
+ for repo_name, loc_repo_conf in local_repo_configs.iteritems():
+ if loc_repo_conf.aliases is not None:
+ for alias in loc_repo_conf.aliases:
+ overridden_alias = repo_aliases.get(alias)
+ if overridden_alias is not None:
+ writemsg_level(("!!! Alias '%s' " + \
+ "created for '%s' overrides " + \
+ "'%s' alias in " + \
+ "'%s'\n") % (alias, repo_name,
+ overridden_alias,
+ self.mysettings._local_repo_conf_path),
+ level=logging.WARNING, noiselevel=-1)
+ repo_aliases[alias] = repo_name
+
for path in self.porttrees:
if path in self._repo_info:
continue
@@ -228,6 +243,7 @@ class portdbapi(dbapi):
masters = layout_data.get('masters', '').split()
for master_name in masters:
+ master_name = repo_aliases.get(master_name, master_name)
master_path = self.treemap.get(master_name)
if master_path is None:
writemsg_level(("Unavailable repository '%s' " + \