diff options
-rw-r--r-- | pym/_emerge/depgraph.py | 28 | ||||
-rw-r--r-- | pym/portage/tests/resolver/test_merge_order.py | 9 |
2 files changed, 28 insertions, 9 deletions
diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py index 37fdeeda3..ca1fe0d53 100644 --- a/pym/_emerge/depgraph.py +++ b/pym/_emerge/depgraph.py @@ -4931,6 +4931,7 @@ class depgraph(object): if nodes: # If there is a mixture of merges and uninstalls, # do the uninstalls first. + good_uninstalls = None if len(nodes) > 1: good_uninstalls = [] for node in nodes: @@ -4942,7 +4943,9 @@ class depgraph(object): else: nodes = nodes - if ignore_priority is None and not tree_mode: + if good_uninstalls or len(nodes) == 1 or \ + (ignore_priority is None and \ + not asap_nodes and not tree_mode): # Greedily pop all of these nodes since no # relationship has been ignored. This optimization # destroys --tree output, so it's disabled in tree @@ -4955,12 +4958,25 @@ class depgraph(object): # will not produce a leaf node, so avoid it. # * It's normal for a selected uninstall to be a # root node, so don't check them for parents. - for node in nodes: - if node.operation == "uninstall" or \ - mygraph.parent_nodes(node): - selected_nodes = [node] + if asap_nodes: + prefer_asap_parents = (True, False) + else: + prefer_asap_parents = (False,) + for check_asap_parent in prefer_asap_parents: + if check_asap_parent: + for node in nodes: + parents = mygraph.parent_nodes(node, + ignore_priority=DepPrioritySatisfiedRange.ignore_soft) + if parents and set(parents).intersection(asap_nodes): + selected_nodes = [node] + break + else: + for node in nodes: + if mygraph.parent_nodes(node): + selected_nodes = [node] + break + if selected_nodes: break - if selected_nodes: break diff --git a/pym/portage/tests/resolver/test_merge_order.py b/pym/portage/tests/resolver/test_merge_order.py index ee3c7863a..1057300d2 100644 --- a/pym/portage/tests/resolver/test_merge_order.py +++ b/pym/portage/tests/resolver/test_merge_order.py @@ -112,12 +112,13 @@ class MergeOrderTestCase(TestCase): "app-misc/some-app-c-1": { "RDEPEND": "app-misc/circ-buildtime-a app-misc/circ-buildtime-b", }, + "app-admin/eselect-python-20100321" : {}, "sys-apps/portage-2.1.9.42" : { "DEPEND" : "dev-lang/python", "RDEPEND" : "dev-lang/python", }, "sys-apps/portage-2.1.9.49" : { - "DEPEND" : "dev-lang/python", + "DEPEND" : "dev-lang/python >=app-admin/eselect-python-20091230", "RDEPEND" : "dev-lang/python", }, "dev-lang/python-3.1" : {}, @@ -318,12 +319,14 @@ class MergeOrderTestCase(TestCase): ["app-misc/blocker-runtime-hard-a"], success = False, mergelist = ['app-misc/blocker-runtime-hard-a-1', '!!app-misc/blocker-runtime-hard-a']), - # Test that PORTAGE_PACKAGE_ATOM is merged asap. + # Test that PORTAGE_PACKAGE_ATOM is merged asap. Optimally, + # satisfied deps are always merged after the asap nodes that + # depend on them. ResolverPlaygroundTestCase( ["dev-lang/python", portage.const.PORTAGE_PACKAGE_ATOM], success = True, all_permutations = True, - mergelist = ['sys-apps/portage-2.1.9.49', 'dev-lang/python-3.2']), + mergelist = ['app-admin/eselect-python-20100321', 'sys-apps/portage-2.1.9.49', 'dev-lang/python-3.2']), # Test that OS_HEADERS_PACKAGE_ATOM and LIBC_PACKAGE_ATOM # are merged asap, in order to account for implicit # dependencies. See bug #303567. |