From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 AD2FF138334 for ; Thu, 5 Dec 2019 07:35:22 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 8B89BE08A0; Thu, 5 Dec 2019 07:35:21 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (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 D4744E08A0 for ; Thu, 5 Dec 2019 07:35:20 +0000 (UTC) Received: from localhost.localdomain (unknown [IPv6:2600:8802:603:b800:ac37:dc27:17d1:fd8e]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: zmedico) by smtp.gentoo.org (Postfix) with ESMTPSA id 9E0E234D7F6; Thu, 5 Dec 2019 07:35:19 +0000 (UTC) From: Zac Medico To: gentoo-portage-dev@lists.gentoo.org Cc: Zac Medico Subject: [gentoo-portage-dev] [PATCH] _queue_disjunctive_deps: group disjunctions (bug 701996) Date: Wed, 4 Dec 2019 23:34:58 -0800 Message-Id: <20191205073458.16536-1-zmedico@gentoo.org> X-Mailer: git-send-email 2.21.0 Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-portage-dev@lists.gentoo.org Reply-to: gentoo-portage-dev@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Archives-Salt: 493d12f9-e010-4e42-ac97-2bdab754fdcf X-Archives-Hash: e313de339396486d58500dc27701caa0 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 --- 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