diff options
author | Sebastian Luther <SebastianLuther@gmx.de> | 2010-09-28 15:14:01 +0200 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2010-09-28 07:28:31 -0700 |
commit | 8a3a72a4b1319acacb860abc59d3f9809c24619d (patch) | |
tree | 247dd50455ab9bb69893b320ac6f64ca37a2a33d /pym/portage | |
parent | 33a18d5dc2c3bb40d9b95c932e927b71321b2c31 (diff) | |
download | portage-8a3a72a4b1319acacb860abc59d3f9809c24619d.tar.gz portage-8a3a72a4b1319acacb860abc59d3f9809c24619d.tar.bz2 portage-8a3a72a4b1319acacb860abc59d3f9809c24619d.zip |
Get --exclude to work with --depclean and --prune
Thanks to forum member 'krinn' for the suggestion
Diffstat (limited to 'pym/portage')
-rw-r--r-- | pym/portage/tests/resolver/ResolverPlayground.py | 3 | ||||
-rw-r--r-- | pym/portage/tests/resolver/test_depclean.py | 88 |
2 files changed, 90 insertions, 1 deletions
diff --git a/pym/portage/tests/resolver/ResolverPlayground.py b/pym/portage/tests/resolver/ResolverPlayground.py index e9eefb5cc..1289bb74b 100644 --- a/pym/portage/tests/resolver/ResolverPlayground.py +++ b/pym/portage/tests/resolver/ResolverPlayground.py @@ -14,6 +14,7 @@ from portage.dep import Atom, _repo_separator from portage.package.ebuild.config import config from portage.package.ebuild.digestgen import digestgen from portage._sets import load_default_config +from portage._sets.base import InternalPackageSet from portage.versions import catsplit import _emerge @@ -431,7 +432,7 @@ class ResolverPlayground(object): if options.get("--depclean"): rval, cleanlist, ordered, req_pkg_count = \ calc_depclean(self.settings, self.trees, None, - options, "depclean", atoms, None) + options, "depclean", InternalPackageSet(initial_atoms=atoms), None) result = ResolverPlaygroundDepcleanResult( \ atoms, rval, cleanlist, ordered, req_pkg_count) else: diff --git a/pym/portage/tests/resolver/test_depclean.py b/pym/portage/tests/resolver/test_depclean.py index 89e7a8aa3..4ea24e728 100644 --- a/pym/portage/tests/resolver/test_depclean.py +++ b/pym/portage/tests/resolver/test_depclean.py @@ -117,3 +117,91 @@ class DepcleanWithInstalledMaskedTestCase(TestCase): self.assertEqual(test_case.test_success, True, test_case.fail_msg) finally: playground.cleanup() + +class DepcleanWithExcludeTestCase(TestCase): + + def testepcleanWithExclude(self): + + installed = { + "dev-libs/A-1": {}, + "dev-libs/B-1": { "RDEPEND": "dev-libs/A" }, + } + + test_cases = ( + #Without --exclude. + ResolverPlaygroundTestCase( + [], + options = {"--depclean": True}, + success = True, + cleanlist = ["dev-libs/B-1", "dev-libs/A-1"]), + ResolverPlaygroundTestCase( + ["dev-libs/A"], + options = {"--depclean": True}, + success = True, + cleanlist = []), + ResolverPlaygroundTestCase( + ["dev-libs/B"], + options = {"--depclean": True}, + success = True, + cleanlist = ["dev-libs/B-1"]), + + #With --exclude + ResolverPlaygroundTestCase( + [], + options = {"--depclean": True, "--exclude": ["dev-libs/A"]}, + success = True, + cleanlist = ["dev-libs/B-1"]), + ResolverPlaygroundTestCase( + ["dev-libs/B"], + options = {"--depclean": True, "--exclude": ["dev-libs/B"]}, + success = True, + cleanlist = []), + ) + + playground = ResolverPlayground(installed=installed) + 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() + +class DepcleanWithExcludeAndSlotsTestCase(TestCase): + + def testepcleanWithExcludeAndSlots(self): + + installed = { + "dev-libs/Z-1": { "SLOT": 1}, + "dev-libs/Z-2": { "SLOT": 2}, + "dev-libs/Y-1": { "RDEPEND": "=dev-libs/Z-1", "SLOT": 1 }, + "dev-libs/Y-2": { "RDEPEND": "=dev-libs/Z-2", "SLOT": 2 }, + } + + world = [ "dev-libs/Y" ] + + test_cases = ( + #Without --exclude. + ResolverPlaygroundTestCase( + [], + options = {"--depclean": True}, + success = True, + cleanlist = ["dev-libs/Y-1", "dev-libs/Z-1"]), + ResolverPlaygroundTestCase( + [], + options = {"--depclean": True, "--exclude": ["dev-libs/Z"]}, + success = True, + cleanlist = ["dev-libs/Y-1"]), + ResolverPlaygroundTestCase( + [], + options = {"--depclean": True, "--exclude": ["dev-libs/Y"]}, + success = True, + cleanlist = []), + ) + + playground = ResolverPlayground(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() |