summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2011-09-18 12:42:38 -0700
committerZac Medico <zmedico@gentoo.org>2011-09-18 12:42:38 -0700
commitc7474fe52e1c52bb6b17bc56ae489d8efc3c0ef3 (patch)
tree867633d4404fe287ae9287173ab775d84faa4dc5
parentdc23070e710acecf9b0229f81a980719605d9409 (diff)
downloadportage-c7474fe52e1c52bb6b17bc56ae489d8efc3c0ef3.tar.gz
portage-c7474fe52e1c52bb6b17bc56ae489d8efc3c0ef3.tar.bz2
portage-c7474fe52e1c52bb6b17bc56ae489d8efc3c0ef3.zip
depclean: don't remove new virtual slots
This provides depclean symmetry with the change in update behavior from commit b95cbb6b78ad6d9b8e2d3edc5fafff122c3ce7c5, so that new virtual slots won't be removed by depclean immediately after they have been pulled in.
-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()