commit: 1f8a7f0bc7e6b6294a0acc6e03e5df4719348ad0
Author: James Le Cuirot <chewi <AT> gentoo <DOT> org>
AuthorDate: Tue Jul 9 13:07:58 2024 +0000
Commit: James Le Cuirot <chewi <AT> gentoo <DOT> org>
CommitDate: Tue Jul 9 14:16:47 2024 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=1f8a7f0b
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.
Signed-off-by: James Le Cuirot <chewi <AT> gentoo.org>
NEWS | 3 +++
lib/portage/repository/config.py | 10 ++++++----
2 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/NEWS b/NEWS
index d5a03533d9..59f9d358d5 100644
--- a/NEWS
+++ b/NEWS
@@ -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.
+
portage-3.0.65 (2024-06-04)
--------------
diff --git a/lib/portage/repository/config.py b/lib/portage/repository/config.py
index c9dfffa22c..46a2d83856 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)