From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-commits+bounces-1127826-garchives=archives.gentoo.org@lists.gentoo.org>
Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by finch.gentoo.org (Postfix) with ESMTPS id 3AEE8138334
	for <garchives@archives.gentoo.org>; Fri,  6 Dec 2019 04:06:44 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id 35952E081E;
	Fri,  6 Dec 2019 04:06:43 +0000 (UTC)
Received: from smtp.gentoo.org (mail.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4])
	(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
	(No client certificate requested)
	by pigeon.gentoo.org (Postfix) with ESMTPS id 0B863E081E
	for <gentoo-commits@lists.gentoo.org>; Fri,  6 Dec 2019 04:06:42 +0000 (UTC)
Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52])
	(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
	(No client certificate requested)
	by smtp.gentoo.org (Postfix) with ESMTPS id 9150034D822
	for <gentoo-commits@lists.gentoo.org>; Fri,  6 Dec 2019 04:06:41 +0000 (UTC)
Received: from localhost.localdomain (localhost [IPv6:::1])
	by oystercatcher.gentoo.org (Postfix) with ESMTP id 05ACC7F9
	for <gentoo-commits@lists.gentoo.org>; Fri,  6 Dec 2019 04:06:39 +0000 (UTC)
From: "Zac Medico" <zmedico@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Content-Transfer-Encoding: 8bit
Content-type: text/plain; charset=UTF-8
Reply-To: gentoo-dev@lists.gentoo.org, "Zac Medico" <zmedico@gentoo.org>
Message-ID: <1575605008.fa7b6ea6ecdc135a01a65e249276e6d75b92791e.zmedico@gentoo>
Subject: [gentoo-commits] proj/portage:master commit in: lib/portage/tests/resolver/, lib/_emerge/
X-VCS-Repository: proj/portage
X-VCS-Files: lib/_emerge/depgraph.py lib/portage/tests/resolver/test_virtual_minimize_children.py
X-VCS-Directories: lib/_emerge/ lib/portage/tests/resolver/
X-VCS-Committer: zmedico
X-VCS-Committer-Name: Zac Medico
X-VCS-Revision: fa7b6ea6ecdc135a01a65e249276e6d75b92791e
X-VCS-Branch: master
Date: Fri,  6 Dec 2019 04:06:39 +0000 (UTC)
Precedence: bulk
List-Post: <mailto:gentoo-commits@lists.gentoo.org>
List-Help: <mailto:gentoo-commits+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org>
X-BeenThere: gentoo-commits@lists.gentoo.org
X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply
X-Archives-Salt: aa79c2da-aeec-402a-90f9-b2dc7d4cdb4d
X-Archives-Hash: 23bf46548a985900464e090ef3fa26f7

commit:     fa7b6ea6ecdc135a01a65e249276e6d75b92791e
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Thu Dec  5 07:11:47 2019 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Fri Dec  6 04:03:28 2019 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=fa7b6ea6

_queue_disjunctive_deps: group disjunctions (bug 701996)

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 <AT> gentoo.org>

 lib/_emerge/depgraph.py                            |  8 +++--
 .../resolver/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()