summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--pym/_emerge/depgraph.py3
-rw-r--r--pym/portage/tests/resolver/test_virtual_slot.py42
2 files changed, 44 insertions, 1 deletions
diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py
index f25a22dea..fbbae1e29 100644
--- a/pym/_emerge/depgraph.py
+++ b/pym/_emerge/depgraph.py
@@ -6595,7 +6595,8 @@ class _dep_check_composite_db(dbapi):
if pkg is not None and \
atom.slot is None and \
pkg.cp.startswith("virtual/") and \
- ("--update" not in self._depgraph._frozen_config.myopts or
+ (("remove" not in self._depgraph._dynamic_config.myparams and
+ "--update" not in self._depgraph._frozen_config.myopts) or
not ret or
not self._depgraph._virt_deps_visible(pkg, ignore_use=True)):
# For new-style virtual lookahead that occurs inside dep_check()
diff --git a/pym/portage/tests/resolver/test_virtual_slot.py b/pym/portage/tests/resolver/test_virtual_slot.py
index fb242011d..4ea66772e 100644
--- a/pym/portage/tests/resolver/test_virtual_slot.py
+++ b/pym/portage/tests/resolver/test_virtual_slot.py
@@ -91,3 +91,45 @@ class VirtualSlotResolverTestCase(TestCase):
self.assertEqual(test_case.test_success, True, test_case.fail_msg)
finally:
playground.cleanup()
+
+ def testVirtualSlotDepclean(self):
+
+ ebuilds = {
+ "dev-java/oracle-jdk-bin-1.7.0" : {"SLOT": "1.7", "LICENSE": "TEST"},
+ "dev-java/sun-jdk-1.6.0" : {"SLOT": "1.6", "LICENSE": "TEST"},
+ "dev-java/icedtea-6.1.10.3" : {"SLOT": "6"},
+ "dev-java/icedtea-7" : {"SLOT": "7"},
+ "app-misc/java-app-1": {"RDEPEND": ">=virtual/jdk-1.6.0"},
+ "virtual/jdk-1.6.0": {"SLOT": "1.6", "RDEPEND": "|| ( =dev-java/icedtea-6* =dev-java/sun-jdk-1.6.0* )"},
+ "virtual/jdk-1.7.0": {"SLOT": "1.7", "RDEPEND": "|| ( =dev-java/icedtea-7* =dev-java/oracle-jdk-bin-1.7.0* )"},
+ }
+
+ installed = {
+ "app-misc/java-app-1": {"RDEPEND": ">=virtual/jdk-1.6.0"},
+ "dev-java/icedtea-6.1.10.3" : {"SLOT": "6"},
+ "dev-java/icedtea-7" : {"SLOT": "7"},
+ "virtual/jdk-1.6.0": {"SLOT" : "1.6", "RDEPEND": "|| ( =dev-java/icedtea-6* =dev-java/sun-jdk-1.6.0* )"},
+ "virtual/jdk-1.7.0": {"SLOT": "1.7", "RDEPEND": "|| ( =dev-java/icedtea-7* =dev-java/oracle-jdk-bin-1.7.0* )"},
+ }
+
+ world = ("virtual/jdk:1.6", "app-misc/java-app",)
+
+ test_cases = (
+ # Make sure that depclean doesn't remove a new slot even though
+ # it is redundant in the sense that the older slot will satisfy
+ # all dependencies.
+ ResolverPlaygroundTestCase(
+ [],
+ options = {"--depclean" : True},
+ success = True,
+ cleanlist = []),
+ )
+
+ playground = ResolverPlayground(
+ ebuilds=ebuilds, installed=installed, world=world)
+ try:
+ for test_case in test_cases:
+ playground.run_TestCase(test_case)
+ self.assertEqual(test_case.test_success, True, test_case.fail_msg)
+ finally:
+ playground.cleanup()