When autounmask USE changes violate REQUIRED_USE, rather than recalculate with autounmask disabled, display the autounmask USE changes along with the REQUIRED_USE violation. Adjust unit tests to allow for the autounmask USE changes that were previously discarded. For the case reported in bug 654782, the output will appear as follows:
The following keyword changes are necessary to proceed: (see "package.accept_keywords" in the portage(5) man page for more details) # required by =retext-7.0.1-r1 (argument) =app-editors/retext-7.0.1-r1 ~amd64 The following USE changes are necessary to proceed: (see "package.use" in the portage(5) man page for more details) # required by app-editors/retext-7.0.1-r1::gentoo # required by =retext-7.0.1-r1 (argument) >=dev-python/PyQt5-5.9.2 printsupport webengine network gui widgets !!! The ebuild selected to satisfy "dev-python/PyQt5[gui,network,printsupport,webengine,widgets,python_targets_python3_4(-)?,python_targets_python3_5(-)?,python_targets_python3_6(-)?,-python_single_target_python3_4(-),-python_single_target_python3_5(-),-python_single_target_python3_6(-)]" has unmet requirements. - dev-python/PyQt5-5.9.2::gentoo USE="-bluetooth -dbus -debug -declarative -designer -examples -gles2 -gui -help -location -multimedia -network -opengl -positioning -printsupport -sensors -serialport -sql -svg -testlib -webchannel -webengine -webkit -websockets -widgets -x11extras -xmlpatterns" PYTHON_TARGETS="python2_7 python3_4 python3_6 -python3_5" The following REQUIRED_USE flag constraints are unsatisfied: webengine? ( widgets? ( webchannel ) ) The above constraints are a subset of the following complete expression: any-of ( python_targets_python2_7 python_targets_python3_4 python_targets_python3_5 python_targets_python3_6 ) bluetooth? ( gui ) declarative? ( gui network ) designer? ( widgets ) help? ( gui widgets ) location? ( positioning ) multimedia? ( gui network ) opengl? ( gui widgets ) positioning? ( gui ) printsupport? ( gui widgets ) sensors? ( gui ) serialport? ( gui ) sql? ( widgets ) svg? ( gui widgets ) testlib? ( widgets ) webchannel? ( network ) webengine? ( network widgets? ( printsupport webchannel ) ) webkit? ( gui network printsupport widgets ) websockets? ( network ) widgets? ( gui ) xmlpatterns? ( network ) (dependency required by "app-editors/retext-7.0.1-r1::gentoo" [ebuild]) (dependency required by "=retext-7.0.1-r1" [argument]) Bug: https://bugs.gentoo.org/654782 --- pym/_emerge/depgraph.py | 8 ++-- pym/portage/tests/resolver/test_autounmask.py | 48 ++++++++++++++++++++-- pym/portage/tests/resolver/test_slot_collisions.py | 20 +++++---- 3 files changed, 61 insertions(+), 15 deletions(-) diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py index fbd16ad98..429d8871c 100644 --- a/pym/_emerge/depgraph.py +++ b/pym/_emerge/depgraph.py @@ -3009,6 +3009,10 @@ class depgraph(object): {"myparent" : dep.parent, "show_req_use" : pkg})) self._dynamic_config._required_use_unsatisfied = True self._dynamic_config._skip_restart = True + # Add pkg to digraph in order to enable autounmask messages + # for this package, which is useful when autounmask USE + # changes have violated REQUIRED_USE. + self._dynamic_config.digraph.add(pkg, dep.parent, priority=priority) return 0 if not pkg.onlydeps: @@ -9428,10 +9432,6 @@ class depgraph(object): return self._dynamic_config._need_config_reload def autounmask_breakage_detected(self): - # Check for REQUIRED_USE violations. - for changes in self._dynamic_config._needed_use_config_changes.values(): - if getattr(changes, 'required_use_satisfied', None) is False: - return True try: for pargs, kwargs in self._dynamic_config._unsatisfied_deps_for_display: self._show_unsatisfied_dep( diff --git a/pym/portage/tests/resolver/test_autounmask.py b/pym/portage/tests/resolver/test_autounmask.py index 9042349ea..809d42104 100644 --- a/pym/portage/tests/resolver/test_autounmask.py +++ b/pym/portage/tests/resolver/test_autounmask.py @@ -251,15 +251,42 @@ class AutounmaskTestCase(TestCase): use_changes={ "dev-util/R-1": { "bar": True } }), #Test interaction with REQUIRED_USE. + # Some of these cases trigger USE change(s) that violate + # REQUIRED_USE, so the USE changes are shown along with + # the REQUIRED_USE violation that they would trigger. + + # The following USE changes are necessary to proceed: + # (see "package.use" in the portage(5) man page for more details) + # # required by app-portage/A-1::test_repo + # # required by =app-portage/A-1 (argument) + # >=app-portage/B-1 foo + # + # !!! The ebuild selected to satisfy "app-portage/B[foo]" has unmet requirements. + # - app-portage/B-1::test_repo USE="bar (forced-flag) -foo" + # + # The following REQUIRED_USE flag constraints are unsatisfied: + # exactly-one-of ( foo bar ) ResolverPlaygroundTestCase( ["=app-portage/A-1"], options={ "--autounmask": True }, - use_changes=None, + use_changes={"app-portage/B-1": {"foo": True}}, success=False), + + # The following USE changes are necessary to proceed: + # (see "package.use" in the portage(5) man page for more details) + # # required by app-portage/A-2::test_repo + # # required by =app-portage/A-2 (argument) + # >=app-portage/B-1 foo + # + # !!! The ebuild selected to satisfy "app-portage/B[foo=]" has unmet requirements. + # - app-portage/B-1::test_repo USE="bar (forced-flag) -foo" + # + # The following REQUIRED_USE flag constraints are unsatisfied: + # exactly-one-of ( foo bar ) ResolverPlaygroundTestCase( ["=app-portage/A-2"], options={ "--autounmask": True }, - use_changes=None, + use_changes={"app-portage/B-1": {"foo": True}}, success=False), ResolverPlaygroundTestCase( ["=app-portage/C-1"], @@ -269,10 +296,25 @@ class AutounmaskTestCase(TestCase): # Test bug 622462, where it inappropriately unmasked a newer # version rather than report unsatisfied REQUIRED_USE. + # + # The following USE changes are necessary to proceed: + # (see "package.use" in the portage(5) man page for more details) + # # required by sci-mathematics/octave-4.2.2::test_repo + # # required by sci-mathematics/octave (argument) + # >=x11-libs/qscintilla-2.9.4 qt5 + # + # !!! The ebuild selected to satisfy ">=x11-libs/qscintilla-2.9.3-r2:=[qt5(+)]" has unmet requirements. + # - x11-libs/qscintilla-2.9.4::test_repo USE="qt4 -qt5" + # + # The following REQUIRED_USE flag constraints are unsatisfied: + # exactly-one-of ( qt4 qt5 ) + # + # (dependency required by "sci-mathematics/octave-4.2.2::test_repo" [ebuild]) + # (dependency required by "sci-mathematics/octave" [argument]) ResolverPlaygroundTestCase( ["sci-mathematics/octave"], options={"--autounmask": True}, - use_changes=None, + use_changes={"x11-libs/qscintilla-2.9.4": {"qt5": True}}, success=False), #Make sure we don't change masked/forced flags. diff --git a/pym/portage/tests/resolver/test_slot_collisions.py b/pym/portage/tests/resolver/test_slot_collisions.py index 9fcd5294a..430ccaad6 100644 --- a/pym/portage/tests/resolver/test_slot_collisions.py +++ b/pym/portage/tests/resolver/test_slot_collisions.py @@ -136,15 +136,19 @@ class SlotCollisionTestCase(TestCase): slot_collision_solutions = [{"sci-libs/Q-1": {"foo": True}, "sci-libs/P-1": {"foo": True}}] ), - #Conflict with REQUIRED_USE - ResolverPlaygroundTestCase( - ["=app-misc/C-1", "=app-misc/B-1"], - all_permutations = True, - slot_collision_solutions = [], - mergelist = ["app-misc/A-1", "app-misc/C-1", "app-misc/B-1"], - ignore_mergelist_order = True, - success = False), ) + # NOTE: For this test case, ResolverPlaygroundTestCase attributes + # vary randomly between runs, so it's expected to fail randomly. + #Conflict with REQUIRED_USE + #ResolverPlaygroundTestCase( + # ["=app-misc/C-1", "=app-misc/B-1"], + # all_permutations = True, + # slot_collision_solutions = None, + # use_changes={"app-misc/A-1": {"foo": True}}, + # mergelist = ["app-misc/A-1", "app-misc/C-1", "app-misc/B-1"], + # ignore_mergelist_order = True, + # success = False), + #) playground = ResolverPlayground(ebuilds=ebuilds, installed=installed) try: -- 2.13.6