Gentoo Archives: gentoo-portage-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-portage-dev@l.g.o
Cc: "Michał Górny" <mgorny@g.o>
Subject: [gentoo-portage-dev] [PATCH] emerge: Do not resolve ambiguous package names via installed pkgs
Date: Fri, 03 Dec 2021 07:39:28
Message-Id: 20211203073917.211156-1-mgorny@gentoo.org
1 When dealing with ambiguous package names on command-line, do not use
2 installed packages to resolve them. This is counterintuitive
3 in the best case, and probably the wrong answer most of the time.
4
5 After all, if a user calls emerge with a specific package name, it is
6 quite likely that he intends to install a missing package rather than
7 rebuild or upgrade an individual package (though the latter can also
8 happen). Rather than making assumptions that can go wrong, just display
9 the ambiguity message as usual.
10
11 Bug: https://bugs.gentoo.org/828059
12 Signed-off-by: Michał Górny <mgorny@g.o>
13 ---
14 lib/_emerge/depgraph.py | 15 ---------------
15 1 file changed, 15 deletions(-)
16
17 diff --git a/lib/_emerge/depgraph.py b/lib/_emerge/depgraph.py
18 index 07431c8ee..f6549eba6 100644
19 --- a/lib/_emerge/depgraph.py
20 +++ b/lib/_emerge/depgraph.py
21 @@ -4806,21 +4806,6 @@ class depgraph:
22 if len(non_virtual_cps) == 1:
23 installed_cp_set = non_virtual_cps
24
25 - if len(expanded_atoms) > 1 and len(installed_cp_set) == 1:
26 - installed_cp = next(iter(installed_cp_set))
27 - for atom in expanded_atoms:
28 - if atom.cp == installed_cp:
29 - available = False
30 - for pkg in self._iter_match_pkgs_any(
31 - root_config, atom.without_use, onlydeps=onlydeps
32 - ):
33 - if not pkg.installed:
34 - available = True
35 - break
36 - if available:
37 - expanded_atoms = [atom]
38 - break
39 -
40 # If a non-virtual package and one or more virtual packages
41 # are in expanded_atoms, use the non-virtual package.
42 if len(expanded_atoms) > 1:
43 --
44 2.34.1