public inbox for gentoo-portage-dev@lists.gentoo.org
 help / color / mirror / Atom feed
Search results ordered by [date|relevance]  view[summary|nested|Atom feed]
thread overview below | download: 
* [gentoo-portage-dev] [PATCH] check_reverse_dependencies: dereference virtual expansions (bug 764764)
@ 2021-01-11  3:55 99% Zac Medico
  0 siblings, 0 replies; 1+ results
From: Zac Medico @ 2021-01-11  3:55 UTC (permalink / raw
  To: gentoo-portage-dev; +Cc: Zac Medico

If an atom is the result of virtual expansion, then derefrence it to
_orig_atom in check_reverse_dependencies so that it will be correctly
handled as a built slot operator dependency when appropriate. This
solves a case triggered in bug 764764 where a virtual expansion from
virtual/dist-kernel:0/5.10.5= to =virtual/dist-kernel-5.10.5 prevented
the atom from being handled as a built slot operator dependency, which
prevented rebuilds from being triggered.

Bug: https://bugs.gentoo.org/764764
Signed-off-by: Zac Medico <zmedico@gentoo.org>
---
 lib/_emerge/depgraph.py                       | 22 +++++++++++++++++++
 .../test_slot_operator_reverse_deps.py        |  2 +-
 2 files changed, 23 insertions(+), 1 deletion(-)

diff --git a/lib/_emerge/depgraph.py b/lib/_emerge/depgraph.py
index f3e834a60..2bf04406f 100644
--- a/lib/_emerge/depgraph.py
+++ b/lib/_emerge/depgraph.py
@@ -2073,6 +2073,12 @@ class depgraph:
 			for parent, atom in self._dynamic_config._parent_atoms.get(existing_pkg, []):
 				if isinstance(parent, Package):
 					if parent in built_slot_operator_parents:
+						if hasattr(atom, '_orig_atom'):
+							# If atom is the result of virtual expansion, then
+							# derefrence it to _orig_atom so that it will be correctly
+							# handled as a built slot operator dependency when
+							# appropriate (see bug 764764).
+							atom = atom._orig_atom
 						# This parent may need to be rebuilt, therefore
 						# discard its soname and built slot operator
 						# dependency components which are not necessarily
@@ -2131,6 +2137,22 @@ class depgraph:
 					allow_repo=True)
 				if not atom_set.findAtomForPackage(candidate_pkg,
 					modified_use=self._pkg_use_enabled(candidate_pkg)):
+					if debug:
+						parent_atoms = []
+						for other_parent, other_atom in self._dynamic_config._parent_atoms.get(existing_pkg, []):
+							if other_parent is parent:
+								parent_atoms.append(other_atom)
+						msg = (
+							"",
+							"",
+							"check_reverse_dependencies:",
+							"   candidate package does not match atom '%s': %s" % (atom, candidate_pkg),
+							"   parent: %s" % parent,
+							"   parent atoms: %s" % " ".join(parent_atoms),
+							"",
+						)
+						writemsg_level("\n".join(msg),
+							noiselevel=-1, level=logging.DEBUG)
 					return False
 			return True
 
diff --git a/lib/portage/tests/resolver/test_slot_operator_reverse_deps.py b/lib/portage/tests/resolver/test_slot_operator_reverse_deps.py
index 6e7214043..ef884f8ca 100644
--- a/lib/portage/tests/resolver/test_slot_operator_reverse_deps.py
+++ b/lib/portage/tests/resolver/test_slot_operator_reverse_deps.py
@@ -284,7 +284,7 @@ class SlotOperatorReverseDepsVirtualTestCase(TestCase):
 				["@world"],
 				options = {"--update": True, "--deep": True},
 				success = True,
-				mergelist = []
+				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']
 			),
 		)
 
-- 
2.26.2



^ permalink raw reply related	[relevance 99%]

Results 1-1 of 1 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2021-01-11  3:55 99% [gentoo-portage-dev] [PATCH] check_reverse_dependencies: dereference virtual expansions (bug 764764) Zac Medico

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox