Bug: https://bugs.gentoo.org/636596
---
 pym/portage/dep/__init__.py                     |  4 ++--
 pym/portage/eapi.py                             | 10 ++++++++--
 pym/portage/tests/dep/testCheckRequiredUse.py   |  5 +++--
 pym/portage/tests/resolver/test_required_use.py |  8 ++++++++
 4 files changed, 21 insertions(+), 6 deletions(-)

diff --git a/pym/portage/dep/__init__.py b/pym/portage/dep/__init__.py
index 6ff6adcb9..2a081f3d8 100644
--- a/pym/portage/dep/__init__.py
+++ b/pym/portage/dep/__init__.py
@@ -1,5 +1,5 @@
 # deps.py -- Portage dependency resolution functions
-# Copyright 2003-2014 Gentoo Foundation
+# Copyright 2003-2018 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 from __future__ import unicode_literals
@@ -2579,7 +2579,7 @@ def check_required_use(required_use, use, iuse_match, 
eapi=None):
                        (flag not in use and is_negated)
        
        def is_satisfied(operator, argument):
-               if not argument:
+               if not argument and eapi_attrs.empty_groups_always_true:
                        #|| ( ) -> True
                        return True
 
diff --git a/pym/portage/eapi.py b/pym/portage/eapi.py
index 170902691..075f7a59c 100644
--- a/pym/portage/eapi.py
+++ b/pym/portage/eapi.py
@@ -1,4 +1,4 @@
-# Copyright 2010-2015 Gentoo Foundation
+# Copyright 2010-2018 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 import collections
@@ -99,12 +99,17 @@ def eapi_has_hdepend(eapi):
 def eapi_has_targetroot(eapi):
        return eapi in ("5-hdepend",)
 
+def eapi_empty_groups_always_true(eapi):
+       return eapi in ("0", "1", "2", "3", "4", "4-python", "4-slot-abi",
+                       "5", "5-progress", "6")
+
 _eapi_attrs = collections.namedtuple('_eapi_attrs',
        'dots_in_PN dots_in_use_flags exports_EBUILD_PHASE_FUNC '
        'feature_flag_test feature_flag_targetroot '
        'hdepend iuse_defaults iuse_effective posixish_locale '
        'repo_deps required_use required_use_at_most_one_of slot_operator 
slot_deps '
-       'src_uri_arrows strong_blocks use_deps use_dep_defaults')
+       'src_uri_arrows strong_blocks use_deps use_dep_defaults '
+       'empty_groups_always_true')
 
 _eapi_attrs_cache = {}
 
@@ -127,6 +132,7 @@ def _get_eapi_attrs(eapi):
        eapi_attrs = _eapi_attrs(
                dots_in_PN = (eapi is None or eapi_allows_dots_in_PN(eapi)),
                dots_in_use_flags = (eapi is None or 
eapi_allows_dots_in_use_flags(eapi)),
+               empty_groups_always_true = (eapi is not None and 
eapi_empty_groups_always_true(eapi)),
                exports_EBUILD_PHASE_FUNC = (eapi is None or 
eapi_exports_EBUILD_PHASE_FUNC(eapi)),
                feature_flag_test = True,
                feature_flag_targetroot = (eapi is not None and 
eapi_has_targetroot(eapi)),
diff --git a/pym/portage/tests/dep/testCheckRequiredUse.py 
b/pym/portage/tests/dep/testCheckRequiredUse.py
index 63330b5cb..c4128c29a 100644
--- a/pym/portage/tests/dep/testCheckRequiredUse.py
+++ b/pym/portage/tests/dep/testCheckRequiredUse.py
@@ -1,4 +1,4 @@
-# Copyright 2010-2012 Gentoo Foundation
+# Copyright 2010-2018 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 from portage.tests import TestCase
@@ -54,7 +54,8 @@ class TestCheckRequiredUse(TestCase):
 
                        ("^^ ( a? ( !b ) !c? ( d ) )", [], ["a", "b", "c", 
"d"], False),
                        ("^^ ( a? ( !b ) !c? ( d ) )", ["a"], ["a", "b", "c", 
"d"], True),
-                       ("^^ ( a? ( !b ) !c? ( d ) )", ["c"], ["a", "b", "c", 
"d"], True),
+                       # note: this one is EAPI-dependent, it used to be True 
for EAPI <7
+                       ("^^ ( a? ( !b ) !c? ( d ) )", ["c"], ["a", "b", "c", 
"d"], False),
                        ("^^ ( a? ( !b ) !c? ( d ) )", ["a", "c"], ["a", "b", 
"c", "d"], True),
                        ("^^ ( a? ( !b ) !c? ( d ) )", ["a", "b", "c"], ["a", 
"b", "c", "d"], False),
                        ("^^ ( a? ( !b ) !c? ( d ) )", ["a", "b", "d"], ["a", 
"b", "c", "d"], True),
diff --git a/pym/portage/tests/resolver/test_required_use.py 
b/pym/portage/tests/resolver/test_required_use.py
index ac748ca3b..7909f927f 100644
--- a/pym/portage/tests/resolver/test_required_use.py
+++ b/pym/portage/tests/resolver/test_required_use.py
@@ -50,6 +50,10 @@ class RequiredUSETestCase(TestCase):
                        "dev-libs/E-3" : {"EAPI": "5", "IUSE": "+foo bar",  
"REQUIRED_USE": "?? ( foo bar )"},
                        "dev-libs/E-4" : {"EAPI": "5", "IUSE": "+foo +bar", 
"REQUIRED_USE": "?? ( foo bar )"},
                        "dev-libs/E-5" : {"EAPI": "5", "IUSE": "+foo +bar", 
"REQUIRED_USE": "?? ( )"},
+
+                       "dev-libs/F-1" : {"EAPI": "7_pre1", "IUSE": "+foo 
+bar", "REQUIRED_USE": "|| ( )"},
+                       "dev-libs/F-2" : {"EAPI": "7_pre1", "IUSE": "+foo 
+bar", "REQUIRED_USE": "^^ ( )"},
+                       "dev-libs/F-3" : {"EAPI": "7_pre1", "IUSE": "+foo 
+bar", "REQUIRED_USE": "?? ( )"},
                        }
 
                test_cases = (
@@ -91,6 +95,10 @@ class RequiredUSETestCase(TestCase):
                        ResolverPlaygroundTestCase(["=dev-libs/E-3"], success = 
True, mergelist=["dev-libs/E-3"]),
                        ResolverPlaygroundTestCase(["=dev-libs/E-4"], success = 
False),
                        ResolverPlaygroundTestCase(["=dev-libs/E-5"], success = 
True, mergelist=["dev-libs/E-5"]),
+
+                       ResolverPlaygroundTestCase(["=dev-libs/F-1"], success = 
False),
+                       ResolverPlaygroundTestCase(["=dev-libs/F-2"], success = 
False),
+                       ResolverPlaygroundTestCase(["=dev-libs/F-3"], success = 
True, mergelist=["dev-libs/F-3"]),
                        )
 
                playground = ResolverPlayground(ebuilds=ebuilds)
-- 
2.16.2


Reply via email to