diff options
author | Zac Medico <zmedico@gentoo.org> | 2013-07-07 12:10:34 -0700 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2013-07-07 12:14:54 -0700 |
commit | 328ee458b0230d8288162a35c3b7472d85be8d67 (patch) | |
tree | c04a0087c1e715b840944795d12010b3212d7490 | |
parent | Use sys.__std* streams for fileno(). (diff) | |
download | portage-328ee458b0230d8288162a35c3b7472d85be8d67.tar.gz portage-328ee458b0230d8288162a35c3b7472d85be8d67.tar.bz2 portage-328ee458b0230d8288162a35c3b7472d85be8d67.zip |
calc_depclean: use runtime_slot_op priorities
-rw-r--r-- | pym/_emerge/UnmergeDepPriority.py | 2 | ||||
-rw-r--r-- | pym/_emerge/actions.py | 13 | ||||
-rw-r--r-- | pym/portage/tests/resolver/test_depclean_order.py | 57 |
3 files changed, 70 insertions, 2 deletions
diff --git a/pym/_emerge/UnmergeDepPriority.py b/pym/_emerge/UnmergeDepPriority.py index 0457ea904..ec44a67a1 100644 --- a/pym/_emerge/UnmergeDepPriority.py +++ b/pym/_emerge/UnmergeDepPriority.py @@ -37,6 +37,8 @@ class UnmergeDepPriority(AbstractDepPriority): def __str__(self): if self.ignored: return "ignored" + if self.runtime_slot_op: + return "hard slot op" myvalue = self.__int__() if myvalue > self.SOFT: return "hard" diff --git a/pym/_emerge/actions.py b/pym/_emerge/actions.py index 034613e9f..730868e72 100644 --- a/pym/_emerge/actions.py +++ b/pym/_emerge/actions.py @@ -1147,7 +1147,8 @@ def calc_depclean(settings, trees, ldpath_mtimes, "installed", root_config, installed=True) if not resolver._add_pkg(pkg, Dependency(parent=consumer_pkg, - priority=UnmergeDepPriority(runtime=True), + priority=UnmergeDepPriority(runtime=True, + runtime_slot_op=True), root=pkg.root)): resolver.display_problems() return 1, [], False, 0 @@ -1235,7 +1236,15 @@ def calc_depclean(settings, trees, ldpath_mtimes, continue for child_node in matches: if child_node in clean_set: - graph.add(child_node, node, priority=priority) + + mypriority = priority.copy() + if atom.slot_operator_built: + if mypriority.buildtime: + mypriority.buildtime_slot_op = True + if mypriority.runtime: + mypriority.runtime_slot_op = True + + graph.add(child_node, node, priority=mypriority) if debug: writemsg_level("\nunmerge digraph:\n\n", diff --git a/pym/portage/tests/resolver/test_depclean_order.py b/pym/portage/tests/resolver/test_depclean_order.py new file mode 100644 index 000000000..9511d292c --- /dev/null +++ b/pym/portage/tests/resolver/test_depclean_order.py @@ -0,0 +1,57 @@ +# Copyright 2013 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +from portage.tests import TestCase +from portage.tests.resolver.ResolverPlayground import ResolverPlayground, ResolverPlaygroundTestCase + +class SimpleDepcleanTestCase(TestCase): + + def testSimpleDepclean(self): + + ebuilds = { + "dev-libs/A-1": { + "EAPI": "5", + "RDEPEND": "dev-libs/B:=", + }, + "dev-libs/B-1": { + "EAPI": "5", + "RDEPEND": "dev-libs/A", + }, + "dev-libs/C-1": {}, + } + + installed = { + "dev-libs/A-1": { + "EAPI": "5", + "RDEPEND": "dev-libs/B:0/0=", + }, + "dev-libs/B-1": { + "EAPI": "5", + "RDEPEND": "dev-libs/A", + }, + "dev-libs/C-1": {}, + } + + world = ( + "dev-libs/C", + ) + + test_cases = ( + # Remove dev-libs/A-1 first because of dev-libs/B:0/0= (built + # slot-operator dep). + ResolverPlaygroundTestCase( + [], + options={"--depclean": True}, + success=True, + ordered=True, + cleanlist=["dev-libs/A-1", "dev-libs/B-1"]), + ) + + 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() |