commit:     9ebd5865559aa17186c23c90c6a90894449dc3ac
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Mon Feb 26 13:09:32 2018 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sun Mar  4 21:03:52 2018 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=9ebd5865

Empty || *DEPEND group no longer satisfy deps in EAPI 7

Bug: https://bugs.gentoo.org/636596

 pym/portage/dep/__init__.py             | 3 +++
 pym/portage/tests/resolver/test_eapi.py | 9 ++++++++-
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/pym/portage/dep/__init__.py b/pym/portage/dep/__init__.py
index 2a081f3d8..3d4bca08f 100644
--- a/pym/portage/dep/__init__.py
+++ b/pym/portage/dep/__init__.py
@@ -562,6 +562,9 @@ def use_reduce(depstr, uselist=[], masklist=[], 
matchall=False, excludeall=[], i
                                        basestring):
                                        if stack[level][-1] == "||" and not l:
                                                #Optimize: || ( ) -> .
+                                               if not 
eapi_attrs.empty_groups_always_true:
+                                                       # in EAPI 7+, we need 
to fail here
+                                                       l.append((token_class 
or _unicode)("__const__/empty-any-of"))
                                                stack[level].pop()
                                        elif stack[level][-1][-1] == "?":
                                                #The last token before the '(' 
that matches the current ')'

diff --git a/pym/portage/tests/resolver/test_eapi.py 
b/pym/portage/tests/resolver/test_eapi.py
index 525b58532..fce05890b 100644
--- a/pym/portage/tests/resolver/test_eapi.py
+++ b/pym/portage/tests/resolver/test_eapi.py
@@ -1,4 +1,4 @@
-# Copyright 2010 Gentoo Foundation
+# Copyright 2010-2018 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 from portage.tests import TestCase
@@ -59,6 +59,10 @@ class EAPITestCase(TestCase):
                        "dev-libs/A-7.4": { "EAPI": "4", "IUSE": "foo +bar", 
"REQUIRED_USE": "|| ( foo bar )" }, 
 
                        "dev-libs/B-1": {"EAPI": 1, "IUSE": "+foo"}, 
+
+                       #EAPI-7: implicit || ( ) no longer satisfies deps
+                       "dev-libs/C-1": { "EAPI": "6", "IUSE": "foo", 
"RDEPEND": "|| ( foo? ( dev-libs/B ) )" }, 
+                       "dev-libs/C-2": { "EAPI": "7_pre1", "IUSE": "foo", 
"RDEPEND": "|| ( foo? ( dev-libs/B ) )" }, 
                        }
 
                test_cases = (
@@ -104,6 +108,9 @@ class EAPITestCase(TestCase):
                        ResolverPlaygroundTestCase(["=dev-libs/A-7.2"], success 
= False),
                        ResolverPlaygroundTestCase(["=dev-libs/A-7.3"], success 
= False),
                        ResolverPlaygroundTestCase(["=dev-libs/A-7.4"], success 
= True, mergelist = ["dev-libs/A-7.4"]),
+
+                       ResolverPlaygroundTestCase(["=dev-libs/C-1"], success = 
True, mergelist = ["dev-libs/C-1"]),
+                       ResolverPlaygroundTestCase(["=dev-libs/C-2"], success = 
False),
                )
 
                playground = ResolverPlayground(ebuilds=ebuilds)

Reply via email to