Skip to content

Commit

Permalink
Prefer installed leaves in runtime cycle topological sort
Browse files Browse the repository at this point in the history
In order to avoid possibly merging a package too early, prefer
installed leaves in runtime cycle topological sort. This fixes
an AlternativesGzipTestCase failure that arose after 2e298ea
caused leaves to be selected in a slightly different order.

Bug: https://bugs.gentoo.org/917259
Signed-off-by: Zac Medico <zmedico@gentoo.org>
  • Loading branch information
zmedico committed Nov 29, 2023
1 parent 9b71122 commit 9823f70
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/_emerge/depgraph.py
Original file line number Diff line number Diff line change
Expand Up @@ -9498,6 +9498,12 @@ def find_smallest_cycle(mergeable_nodes, local_priority_range):
if smallest_leaves is None:
smallest_leaves = [cycle_digraph.order[-1]]

# Prefer installed leaves, in order to avoid
# merging something too early.
installed_leaves = [pkg for pkg in smallest_leaves if pkg.installed]
if installed_leaves:
smallest_leaves = installed_leaves

# Only harvest one node at a time, in order to
# minimize the number of ignored dependencies.
cycle_digraph.remove(smallest_leaves[0])
Expand Down

0 comments on commit 9823f70

Please sign in to comment.