1
0
Fork 0
mirror of https://github.com/NixOS/hydra.git synced 2024-10-17 16:37:26 -04:00

Provide store for getDependencyGraph

This method is applicable on all kinds of stores, so let's
give it a store rather than letting it decide which store to
use.
This commit is contained in:
Maximilian Bosch 2024-02-12 23:02:44 +01:00
parent 67de7a3ba9
commit e69d857654
No known key found for this signature in database

View file

@ -405,7 +405,7 @@ sub contents : Chained('buildChain') PathPart Args(1) {
sub getDependencyGraph {
my ($self, $c, $runtime, $done, $path) = @_;
my ($self, $store, $c, $runtime, $done, $path) = @_;
my $node = $$done{$path};
if (!defined $node) {
@ -421,7 +421,7 @@ sub getDependencyGraph {
};
$$done{$path} = $node;
my @refs;
foreach my $ref (binaryCacheStore()->queryReferences($path)) {
foreach my $ref ($store->queryReferences($path)) {
next if $ref eq $path;
next unless $runtime || $ref =~ /\.drv$/;
getDependencyGraph($self, $c, $runtime, $done, $ref);
@ -429,7 +429,7 @@ sub getDependencyGraph {
}
# Show in reverse topological order to flatten the graph.
# Should probably do a proper BFS.
my @sorted = reverse binaryCacheStore()->topoSortPaths(@refs);
my @sorted = reverse $store->topoSortPaths(@refs);
$node->{refs} = [map { $$done{$_} } @sorted];
}
@ -444,7 +444,7 @@ sub build_deps : Chained('buildChain') PathPart('build-deps') {
error($c, "Derivation no longer available.") unless machineLocalStore()->isValidPath($drvPath);
$c->stash->{buildTimeGraph} = getDependencyGraph($self, $c, 0, {}, $drvPath);
$c->stash->{buildTimeGraph} = getDependencyGraph($self, binaryCacheStore(), $c, 0, {}, $drvPath);
$c->stash->{template} = 'build-deps.tt';
}