Skip to content

Commit

Permalink
FIXED: build order for dependencies in packs.
Browse files Browse the repository at this point in the history
Based on #1326, but fixing build_order/2 rather than reversing afterwards.
  • Loading branch information
JanWielemaker committed Oct 18, 2024
1 parent e265369 commit 1cf4acb
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions library/prolog_pack.pl
Original file line number Diff line number Diff line change
Expand Up @@ -1453,19 +1453,24 @@
% packages that rely on them as they may need them during the build.

order_builds(ToBuild, Ordered) :-
findall(Pack-Dep, dep_edge(ToBuild, Pack, Dep), Edges),
findall(DepForPack-Pack, dep_edge(ToBuild, Pack, DepForPack), Edges),
maplist(get_dict(pack), ToBuild, Packs),
vertices_edges_to_ugraph(Packs, Edges, Graph),
ugraph_layers(Graph, Layers),
append(Layers, PackNames),
maplist(pack_info_from_name(ToBuild), PackNames, Ordered).

dep_edge(Infos, Pack, Dep) :-
%! dep_edge(+Infos, -Pack, -DepForPack) is nondet.
%
% True when DepForPack is a dependency for Pack. Both Pack and
% DepForPack are pack _names.

dep_edge(Infos, Pack, DepForPack) :-
member(Info, Infos),
Pack = Info.pack,
member(Dep, Info.get(dependency_for)),
member(DepForPack, Info.get(dependency_for)),
( member(DepInfo, Infos),
DepInfo.pack == Dep
DepInfo.pack == DepForPack
-> true
).

Expand Down

0 comments on commit 1cf4acb

Please sign in to comment.