Gentoo Archives: gentoo-portage-dev

From: Zac Medico <zmedico@g.o>
To: gentoo-portage-dev@l.g.o
Cc: Zac Medico <zmedico@g.o>
Subject: [gentoo-portage-dev] [PATCH] check_reverse_dependencies: dereference virtual expansions (bug 764764)
Date: Mon, 11 Jan 2021 03:56:10
Message-Id: 20210111035532.217427-1-zmedico@gentoo.org
1 If an atom is the result of virtual expansion, then derefrence it to
2 _orig_atom in check_reverse_dependencies so that it will be correctly
3 handled as a built slot operator dependency when appropriate. This
4 solves a case triggered in bug 764764 where a virtual expansion from
5 virtual/dist-kernel:0/5.10.5= to =virtual/dist-kernel-5.10.5 prevented
6 the atom from being handled as a built slot operator dependency, which
7 prevented rebuilds from being triggered.
8
9 Bug: https://bugs.gentoo.org/764764
10 Signed-off-by: Zac Medico <zmedico@g.o>
11 ---
12 lib/_emerge/depgraph.py | 22 +++++++++++++++++++
13 .../test_slot_operator_reverse_deps.py | 2 +-
14 2 files changed, 23 insertions(+), 1 deletion(-)
15
16 diff --git a/lib/_emerge/depgraph.py b/lib/_emerge/depgraph.py
17 index f3e834a60..2bf04406f 100644
18 --- a/lib/_emerge/depgraph.py
19 +++ b/lib/_emerge/depgraph.py
20 @@ -2073,6 +2073,12 @@ class depgraph:
21 for parent, atom in self._dynamic_config._parent_atoms.get(existing_pkg, []):
22 if isinstance(parent, Package):
23 if parent in built_slot_operator_parents:
24 + if hasattr(atom, '_orig_atom'):
25 + # If atom is the result of virtual expansion, then
26 + # derefrence it to _orig_atom so that it will be correctly
27 + # handled as a built slot operator dependency when
28 + # appropriate (see bug 764764).
29 + atom = atom._orig_atom
30 # This parent may need to be rebuilt, therefore
31 # discard its soname and built slot operator
32 # dependency components which are not necessarily
33 @@ -2131,6 +2137,22 @@ class depgraph:
34 allow_repo=True)
35 if not atom_set.findAtomForPackage(candidate_pkg,
36 modified_use=self._pkg_use_enabled(candidate_pkg)):
37 + if debug:
38 + parent_atoms = []
39 + for other_parent, other_atom in self._dynamic_config._parent_atoms.get(existing_pkg, []):
40 + if other_parent is parent:
41 + parent_atoms.append(other_atom)
42 + msg = (
43 + "",
44 + "",
45 + "check_reverse_dependencies:",
46 + " candidate package does not match atom '%s': %s" % (atom, candidate_pkg),
47 + " parent: %s" % parent,
48 + " parent atoms: %s" % " ".join(parent_atoms),
49 + "",
50 + )
51 + writemsg_level("\n".join(msg),
52 + noiselevel=-1, level=logging.DEBUG)
53 return False
54 return True
55
56 diff --git a/lib/portage/tests/resolver/test_slot_operator_reverse_deps.py b/lib/portage/tests/resolver/test_slot_operator_reverse_deps.py
57 index 6e7214043..ef884f8ca 100644
58 --- a/lib/portage/tests/resolver/test_slot_operator_reverse_deps.py
59 +++ b/lib/portage/tests/resolver/test_slot_operator_reverse_deps.py
60 @@ -284,7 +284,7 @@ class SlotOperatorReverseDepsVirtualTestCase(TestCase):
61 ["@world"],
62 options = {"--update": True, "--deep": True},
63 success = True,
64 - mergelist = []
65 + mergelist = ['sys-kernel/gentoo-kernel-5.10.6', 'virtual/dist-kernel-5.10.6', 'app-emulation/virtualbox-modules-6.1.16-r1', 'x11-drivers/nvidia-drivers-460.32.03']
66 ),
67 )
68
69 --
70 2.26.2