RepoConfigLoader: support incremental aliases
authorZac Medico <zmedico@gentoo.org>
Fri, 28 Oct 2011 06:17:19 +0000 (23:17 -0700)
committerZac Medico <zmedico@gentoo.org>
Fri, 28 Oct 2011 06:17:19 +0000 (23:17 -0700)
This allows a user to discard unwanted aliases that are specified in
a repo's layout.conf.

man/portage.5
pym/portage/repository/config.py

index 45eef365925c1b74fa744fcc6e19722ab30bb241..7fa56602f3849f6c7ba72a5d127dfa158643426c 100644 (file)
@@ -708,8 +708,9 @@ eclass\-overrides = java\-overlay java\-experimental
 # 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
+# 'gentoo' in place of references to repositories named 'foo' and 'bar',
+# and discard the 'baz' alias contained in gentoo's layout.conf
+aliases = foo bar -baz
 
 [kde-testing]
 # override the metadata/layout.conf masters setting from the kde-testing repo
index 5b5ddd633b1386b7b4a3a9b0ef3836793c8da277..1a7effe1ff53d1ff66ea5597ef00421ce03104c1 100644 (file)
@@ -19,7 +19,8 @@ from portage import os
 from portage.const import (MANIFEST2_HASH_FUNCTIONS, MANIFEST2_REQUIRED_HASH,
        REPO_NAME_LOC, USER_CONFIG_PATH)
 from portage.env.loaders import KeyValuePairFileLoader
-from portage.util import normalize_path, writemsg, writemsg_level, shlex_split
+from portage.util import (normalize_path, writemsg, writemsg_level,
+       shlex_split, stack_lists)
 from portage.localization import _
 from portage import _unicode_decode
 from portage import _unicode_encode
@@ -390,17 +391,13 @@ class RepoConfigLoader(object):
                        if repo.masters is None:
                                repo.masters = layout_data['masters']
 
-                       aliases = layout_data.get('aliases')
-                       if aliases and aliases.strip():
-                               aliases = aliases.split()
-                       else:
-                               aliases = None
-
                        if layout_data['aliases']:
                                aliases = repo.aliases
                                if aliases is None:
                                        aliases = ()
-                               repo.aliases = tuple(aliases) + layout_data['aliases']
+                               # repos.conf aliases come after layout.conf aliases, giving
+                               # them the ability to do incremental overrrides
+                               repo.aliases = layout_data['aliases'] + tuple(aliases)
 
                        for value in ('sign-manifest', 'thin-manifest', 'allow-missing-manifest',
                                'create-manifest', 'disable-manifest', 'cache-formats', 'manifest-hashes',
@@ -417,7 +414,8 @@ class RepoConfigLoader(object):
                        names = set()
                        names.add(repo_name)
                        if repo.aliases:
-                               names.update(repo.aliases)
+                               aliases = stack_lists([repo.aliases], incremental=True)
+                               names.update(aliases)
 
                        for name in names:
                                if name in new_prepos: