From: Zac Medico <zmedico@gentoo.org>
To: gentoo-portage-dev@lists.gentoo.org
Cc: Zac Medico <zmedico@gentoo.org>
Subject: [gentoo-portage-dev] [PATCH] _queue_disjunctive_deps: group disjunctions (bug 701996)
Date: Wed, 4 Dec 2019 23:34:58 -0800 [thread overview]
Message-ID: <20191205073458.16536-1-zmedico@gentoo.org> (raw)
When disjunctive dependencies are queued, group together disjunctions
from the same dependency string so that any overlap between them will
trigger expansion to DNF.
Bug: https://bugs.gentoo.org/701996
Signed-off-by: Zac Medico <zmedico@gentoo.org>
---
lib/_emerge/depgraph.py | 8 +++-
.../test_virtual_minimize_children.py | 39 +++++++++++++++++++
2 files changed, 45 insertions(+), 2 deletions(-)
diff --git a/lib/_emerge/depgraph.py b/lib/_emerge/depgraph.py
index f80b077bc..78226a3ea 100644
--- a/lib/_emerge/depgraph.py
+++ b/lib/_emerge/depgraph.py
@@ -3850,10 +3850,11 @@ class depgraph(object):
Yields non-disjunctive deps. Raises InvalidDependString when
necessary.
"""
+ disjunctions = []
for x in dep_struct:
if isinstance(x, list):
if x and x[0] == "||":
- self._queue_disjunction(pkg, dep_root, dep_priority, [x])
+ disjunctions.append(x)
else:
for y in self._queue_disjunctive_deps(
pkg, dep_root, dep_priority, x):
@@ -3863,10 +3864,13 @@ class depgraph(object):
# or whatever other metadata gets implemented for this
# purpose.
if x.cp.startswith('virtual/'):
- self._queue_disjunction(pkg, dep_root, dep_priority, [x])
+ disjunctions.append(x)
else:
yield x
+ if disjunctions:
+ self._queue_disjunction(pkg, dep_root, dep_priority, disjunctions)
+
def _queue_disjunction(self, pkg, dep_root, dep_priority, dep_struct):
self._dynamic_config._dep_disjunctive_stack.append(
(pkg, dep_root, dep_priority, dep_struct))
diff --git a/lib/portage/tests/resolver/test_virtual_minimize_children.py b/lib/portage/tests/resolver/test_virtual_minimize_children.py
index b566cb592..720fbe57b 100644
--- a/lib/portage/tests/resolver/test_virtual_minimize_children.py
+++ b/lib/portage/tests/resolver/test_virtual_minimize_children.py
@@ -285,3 +285,42 @@ class VirtualMinimizeChildrenTestCase(TestCase):
finally:
playground.debug = False
playground.cleanup()
+
+
+ def testVirtualWine(self):
+ ebuilds = {
+ 'virtual/wine-0-r6': {
+ 'RDEPEND': '|| ( app-emulation/wine-staging app-emulation/wine-any ) '
+ '|| ( app-emulation/wine-vanilla app-emulation/wine-staging app-emulation/wine-any )'
+ },
+ 'app-emulation/wine-staging-4': {},
+ 'app-emulation/wine-any-4': {},
+ 'app-emulation/wine-vanilla-4': {},
+ }
+
+ test_cases = (
+ # Test bug 701996, where separate disjunctions where not
+ # converted to DNF, causing both wine-vanilla and
+ # wine-staging to be pulled in.
+ ResolverPlaygroundTestCase(
+ [
+ 'virtual/wine',
+ ],
+ success=True,
+ mergelist=(
+ 'app-emulation/wine-staging-4',
+ 'virtual/wine-0-r6',
+ ),
+ ),
+ )
+
+ playground = ResolverPlayground(debug=False, ebuilds=ebuilds)
+
+ try:
+ for test_case in test_cases:
+ playground.run_TestCase(test_case)
+ self.assertEqual(test_case.test_success, True,
+ test_case.fail_msg)
+ finally:
+ playground.debug = False
+ playground.cleanup()
--
2.21.0
reply other threads:[~2019-12-05 7:35 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=20191205073458.16536-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