diff options
author | 2024-07-09 14:07:58 +0100 | |
---|---|---|
committer | 2024-07-10 17:55:20 +0100 | |
commit | ea04a583fab9739dbe05e8d8381ed2803e7dce88 (patch) | |
tree | ecca6f4c35b207bef5dd25c22ec5bd3d63488066 | |
parent | Allow GIL to be disabled in whirlpool C extension (diff) | |
download | portage-ea04a583fab9739dbe05e8d8381ed2803e7dce88.tar.gz portage-ea04a583fab9739dbe05e8d8381ed2803e7dce88.tar.bz2 portage-ea04a583fab9739dbe05e8d8381ed2803e7dce88.zip |
config: Allow a repository to be configured using one of its aliases
Currently, the `[name]` in repos.conf can only match the primary name.
This is inconvenient if a repository wants to change its name without
breaking existing configurations.
This raises the question of whether to then use the primary name or the
alias in the UI and in the vardb. I went with the primary name because
this is presumably the name that the repository actually wants you to
use.
If the configured name matches neither the primary name nor an alias,
then emaint sync will simply claim that it is not found, but that
behaviour is unchanged from before.
Bug: https://bugs.gentoo.org/935830
Closes: https://github.com/gentoo/portage/pull/1358
Signed-off-by: James Le Cuirot <chewi@gentoo.org>
-rw-r--r-- | NEWS | 3 | ||||
-rw-r--r-- | lib/portage/repository/config.py | 10 |
2 files changed, 9 insertions, 4 deletions
@@ -22,6 +22,9 @@ Bug fixes: * vartree, movefile: Warn when rewriting a symlink (bug #934514). +* repository: config: Allow a repository to be configured using one of its + aliases rather than its primary name (bug #935830). + portage-3.0.65 (2024-06-04) -------------- diff --git a/lib/portage/repository/config.py b/lib/portage/repository/config.py index c9dfffa22..46a2d8385 100644 --- a/lib/portage/repository/config.py +++ b/lib/portage/repository/config.py @@ -943,7 +943,9 @@ class RepoConfigLoader: del prepos[repo_name] continue - if repo.name != repo_name: + if repo.name != repo_name and ( + repo.aliases is None or repo_name not in repo.aliases + ): writemsg_level( "!!! %s\n" % _( @@ -957,13 +959,13 @@ class RepoConfigLoader: del prepos[repo_name] continue - location_map[repo.location] = repo_name - treemap[repo_name] = repo.location + location_map[repo.location] = repo.name + treemap[repo.name] = repo.location # Add alias mappings, but never replace unaliased mappings. for repo_name, repo in list(prepos.items()): names = set() - names.add(repo_name) + names.add(repo.name) if repo.aliases: aliases = stack_lists([repo.aliases], incremental=True) names.update(aliases) |