public inbox for gentoo-portage-dev@lists.gentoo.org
 help / color / mirror / Atom feed
From: Zac Medico <zmedico@gentoo.org>
To: gentoo-portage-dev@lists.gentoo.org
Cc: Zac Medico <zmedico@gentoo.org>
Subject: [gentoo-portage-dev] [PATCH] check_reverse_dependencies: dereference virtual expansions (bug 764764)
Date: Sun, 10 Jan 2021 19:55:32 -0800	[thread overview]
Message-ID: <20210111035532.217427-1-zmedico@gentoo.org> (raw)

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



                 reply	other threads:[~2021-01-11  3:56 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210111035532.217427-1-zmedico@gentoo.org \
    --to=zmedico@gentoo.org \
    --cc=gentoo-portage-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox