From 46d97be05dae690373ef802788adb5cf1505f947 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Thu, 27 Oct 2011 23:17:19 -0700 Subject: [PATCH] RepoConfigLoader: support incremental aliases This allows a user to discard unwanted aliases that are specified in a repo's layout.conf. --- man/portage.5 | 5 +++-- pym/portage/repository/config.py | 16 +++++++--------- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/man/portage.5 b/man/portage.5 index 45eef3659..7fa56602f 100644 --- a/man/portage.5 +++ b/man/portage.5 @@ -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 diff --git a/pym/portage/repository/config.py b/pym/portage/repository/config.py index 5b5ddd633..1a7effe1f 100644 --- a/pym/portage/repository/config.py +++ b/pym/portage/repository/config.py @@ -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: -- 2.26.2