From: Zac Medico Date: Sun, 12 Jun 2011 22:12:26 +0000 (-0700) Subject: test_merge_order: test smallest runtime cycle X-Git-Tag: v2.2.0_alpha41~5 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=c754569663408e515fa134c52c7b3b8a1bb15181;p=portage.git test_merge_order: test smallest runtime cycle In the case of multiple runtime cycles, where some cycles may depend on smaller independent cycles, it's optimal to merge smaller independent cycles before other cycles that depend on them. Therefore, we search for the smallest cycle in order to try and identify and prefer these smaller independent cycles. --- diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py index 3b47c3574..9ce199b15 100644 --- a/pym/_emerge/depgraph.py +++ b/pym/_emerge/depgraph.py @@ -5022,6 +5022,12 @@ class depgraph(object): # we want to minimize the number of nodes gathered, since # this tends to produce a more optimal merge order. # Ignoring all medium_soft deps serves this purpose. + # In the case of multiple runtime cycles, where some cycles + # may depend on smaller independent cycles, it's optimal + # to merge smaller independent cycles before other cycles + # that depend on them. Therefore, we search for the + # smallest cycle in order to try and identify and prefer + # these smaller independent cycles. ignore_priority = priority_range.ignore_medium_soft smallest_cycle = None for node in nodes: diff --git a/pym/portage/tests/resolver/test_merge_order.py b/pym/portage/tests/resolver/test_merge_order.py index e94b6c7dd..0a52c813b 100644 --- a/pym/portage/tests/resolver/test_merge_order.py +++ b/pym/portage/tests/resolver/test_merge_order.py @@ -81,6 +81,27 @@ class MergeOrderTestCase(TestCase): "DEPEND": "app-misc/circ-satisfied-a", "RDEPEND": "app-misc/circ-satisfied-a", }, + "app-misc/circ-smallest-a-1": { + "RDEPEND": "app-misc/circ-smallest-b", + }, + "app-misc/circ-smallest-b-1": { + "RDEPEND": "app-misc/circ-smallest-a", + }, + "app-misc/circ-smallest-c-1": { + "RDEPEND": "app-misc/circ-smallest-d", + }, + "app-misc/circ-smallest-d-1": { + "RDEPEND": "app-misc/circ-smallest-e", + }, + "app-misc/circ-smallest-e-1": { + "RDEPEND": "app-misc/circ-smallest-c", + }, + "app-misc/circ-smallest-f-1": { + "RDEPEND": "app-misc/circ-smallest-g app-misc/circ-smallest-a app-misc/circ-smallest-c", + }, + "app-misc/circ-smallest-g-1": { + "RDEPEND": "app-misc/circ-smallest-f", + }, "app-misc/installed-blocker-a-1" : { "EAPI" : "2", "DEPEND" : "!app-misc/blocker-buildtime-a", @@ -294,6 +315,18 @@ class MergeOrderTestCase(TestCase): ambiguous_merge_order = True, merge_order_assertions = (("app-misc/circ-satisfied-a-1", "app-misc/circ-satisfied-c-1"),), mergelist = [("app-misc/circ-satisfied-a-1", "app-misc/circ-satisfied-b-1", "app-misc/circ-satisfied-c-1")]), + # In the case of multiple runtime cycles, where some cycles + # may depend on smaller independent cycles, it's optimal + # to merge smaller independent cycles before other cycles + # that depend on them. + ResolverPlaygroundTestCase( + ["app-misc/circ-smallest-a", "app-misc/circ-smallest-c", "app-misc/circ-smallest-f"], + success = True, + ambiguous_merge_order = True, + all_permutations = True, + mergelist = [('app-misc/circ-smallest-a-1', 'app-misc/circ-smallest-b-1'), + ('app-misc/circ-smallest-c-1', 'app-misc/circ-smallest-d-1', 'app-misc/circ-smallest-e-1'), + ('app-misc/circ-smallest-f-1', 'app-misc/circ-smallest-g-1')]), # installed package has buildtime-only blocker # that should be ignored ResolverPlaygroundTestCase(