summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--pym/_emerge/resolver/slot_collision.py18
-rw-r--r--pym/portage/tests/resolver/test_slot_collisions.py15
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)