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 a45e919
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions .ci_support/compute_build_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -376,13 +376,24 @@ 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
# before deleting nodes
# remap '* -> subpackage' to '* -> recipe'
remap_in = [edge for edge in graph.edges() if edge[1] in subpackages]
for edge in remap_in:
# 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_out = [edge for edge in graph.edges() if edge[0] in subpackages]
for edge in remap_out:
# 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 a45e919

Please sign in to comment.