summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2009-04-16 22:12:39 +0000
committerZac Medico <zmedico@gentoo.org>2009-04-16 22:12:39 +0000
commitcf0c149eff981c58650b3961d20be87018d8d606 (patch)
tree46e96dbe0d1d0823d9f99abc859f98dd6bb30d10
parentbbf47fb1b2e7e1a7ed78395a697e417e7867299b (diff)
downloadportage-cf0c149eff981c58650b3961d20be87018d8d606.tar.gz
portage-cf0c149eff981c58650b3961d20be87018d8d606.tar.bz2
portage-cf0c149eff981c58650b3961d20be87018d8d606.zip
Add support for repos.conf 'aliases' attribute which allows alias
substitution in metadata/layout.conf repository references. svn path=/main/trunk/; revision=13352
-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 3a548c0f5..0ac8be92f 100644
--- a/man/portage.5
+++ b/man/portage.5
@@ -559,18 +559,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 6fea2b82b..d92330613 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 246a0d6f1..c07cf4ff2 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' " + \