Skip to content

Commit

Permalink
fix multi-output dependency detection
Browse files Browse the repository at this point in the history
collapse_subpackage_nodes only handled outgoing dependencies (not incoming) before deleting nodes
so some edges were lost

by updating edges for both directions, all relationships are preserved
  • Loading branch information
minrk committed Nov 19, 2024
1 parent 2444203 commit f2ac7f4
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions .ci_support/compute_build_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -376,13 +376,23 @@ def collapse_subpackage_nodes(graph):
# fold in dependencies for all of the other subpackages within a group. This is just
# the intersection of the edges between all nodes. Store this on the "master" node.
if subpackages:
remap_edges = [edge for edge in graph.edges() if edge[1] in subpackages]
for edge in remap_edges:
# make sure to remap edges both into and out of subpackages
remap_out = [edge for edge in graph.edges() if edge[1] in subpackages]
# remap '* -> subpackage' to '* -> recipe'
for edge in remap_out:
# make sure not to add references to yourself
if edge[0] != master_key:
graph.add_edge(edge[0], master_key)
graph.remove_edge(*edge)

# remap 'subpackage -> *' to 'recipe -> *'
remap_in = [edge for edge in graph.edges() if edge[0] in subpackages]
for edge in remap_in:
# make sure not to add references to yourself
if edge[1] != master_key:
graph.add_edge(master_key, edge[1])
graph.remove_edge(*edge)

# remove nodes that have been folded into master nodes
for subnode in subpackages:
graph.remove_node(subnode)
Expand Down

0 comments on commit f2ac7f4

Please sign in to comment.