diff options
author | Sebastian Luther <SebastianLuther@gmx.de> | 2010-08-20 10:34:05 +0200 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2010-08-20 05:15:54 -0700 |
commit | c87c52cc4587975a314200064306542bd14f9540 (patch) | |
tree | a1bcb461cb12ae776cc235278b9b677f45083fae | |
parent | 57cec9204a387ce27ce4703175b16189b3fdc45f (diff) | |
download | portage-c87c52cc4587975a314200064306542bd14f9540.tar.gz portage-c87c52cc4587975a314200064306542bd14f9540.tar.bz2 portage-c87c52cc4587975a314200064306542bd14f9540.zip |
slot collision handler: Drop solutions that violate REQUIRED_USE
-rw-r--r-- | pym/_emerge/resolver/slot_collision.py | 18 | ||||
-rw-r--r-- | pym/portage/tests/resolver/test_slot_collisions.py | 15 |
2 files changed, 33 insertions, 0 deletions
diff --git a/pym/_emerge/resolver/slot_collision.py b/pym/_emerge/resolver/slot_collision.py index 9f023f9ee..53cebf6ea 100644 --- a/pym/_emerge/resolver/slot_collision.py +++ b/pym/_emerge/resolver/slot_collision.py @@ -2,6 +2,7 @@ from __future__ import print_function from _emerge.AtomArg import AtomArg from _emerge.PackageArg import PackageArg +from portage.dep import check_required_use from portage.output import colorize from portage.sets.base import InternalPackageSet from portage.util import writemsg @@ -716,6 +717,23 @@ class slot_conflict_handler(object): if not is_valid_solution: break + #Make sure the changes don't violate REQUIRED_USE + for pkg in required_changes: + required_use = pkg.metadata["REQUIRED_USE"] + if not required_use: + continue + + use = set(_pkg_use_enabled(pkg)) + for flag, state in required_changes[pkg].items(): + if state == "enabled": + use.add(flag) + else: + use.discard(flag) + + if not check_required_use(required_use, use, pkg.iuse.is_valid_flag): + is_valid_solution = False + break + if is_valid_solution and required_changes: return required_changes else: diff --git a/pym/portage/tests/resolver/test_slot_collisions.py b/pym/portage/tests/resolver/test_slot_collisions.py index 3837d638c..9933979a3 100644 --- a/pym/portage/tests/resolver/test_slot_collisions.py +++ b/pym/portage/tests/resolver/test_slot_collisions.py @@ -24,6 +24,10 @@ class SlotCollisionTestCase(TestCase): "sci-libs/K-1": { "IUSE": "+foo", "EAPI": 1 }, "sci-libs/L-1": { "DEPEND": "sci-libs/K[-foo]", "EAPI": 2 }, "sci-libs/M-1": { "DEPEND": "sci-libs/K[foo=]", "IUSE": "+foo", "EAPI": 2 }, + + #~ "app-misc/A-1": { "IUSE": "foo +bar", "REQUIRED_USE": "^^ ( foo bar )", "EAPI": 4 }, + #~ "app-misc/B-1": { "DEPEND": "=app-misc/A-1[foo=]", "IUSE": "foo", "EAPI": 2 }, + #~ "app-misc/C-1": { "DEPEND": "=app-misc/A-1[foo]", "EAPI": 2 }, } installed = { "dev-libs/A-1": { "PDEPEND": "foo? ( dev-libs/B )", "IUSE": "foo", "USE": "foo" }, @@ -33,6 +37,8 @@ class SlotCollisionTestCase(TestCase): "sci-libs/K-1": { "IUSE": "foo", "USE": "" }, "sci-libs/L-1": { "DEPEND": "sci-libs/K[-foo]" }, + + #~ "app-misc/A-1": { "IUSE": "+foo bar", "USE": "foo", "REQUIRED_USE": "^^ ( foo bar )", "EAPI": 4 }, } test_cases = ( @@ -68,6 +74,15 @@ class SlotCollisionTestCase(TestCase): ignore_mergelist_order = True, slot_collision_solutions = [{"sci-libs/K-1": {"foo": False}, "sci-libs/M-1": {"foo": False}}] ), + + #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), ) playground = ResolverPlayground(ebuilds=ebuilds, installed=installed) |