@@ -10,8 +10,6 @@ use File::Basename;
1010use File::LibMagic;
1111use File::stat ;
1212use Data::Dump qw( dump) ;
13- use Nix::Store;
14- use Nix::Config;
1513use List::SomeUtils qw( all) ;
1614use Encode;
1715use JSON::PP;
@@ -82,9 +80,9 @@ sub build_GET {
8280 # false because `$_->path` will be empty
8381 $c -> stash-> {available } =
8482 $c -> stash-> {isLocalStore }
85- ? all { $_ -> path && isValidPath($_ -> path) } $build -> buildoutputs-> all
83+ ? all { $_ -> path && $MACHINE_LOCAL_STORE -> isValidPath($_ -> path) } $build -> buildoutputs-> all
8684 : 1;
87- $c -> stash-> {drvAvailable } = isValidPath $build -> drvpath;
85+ $c -> stash-> {drvAvailable } = $MACHINE_LOCAL_STORE -> isValidPath( $build -> drvpath) ;
8886
8987 if ($build -> finished && $build -> iscachedbuild) {
9088 my $path = ($build -> buildoutputs)[0]-> path or undef ;
@@ -308,7 +306,7 @@ sub output : Chained('buildChain') PathPart Args(1) {
308306 error($c , " This build is not finished yet." ) unless $build -> finished;
309307 my $output = $build -> buildoutputs-> find({name => $outputName });
310308 notFound($c , " This build has no output named ‘$outputName ’" ) unless defined $output ;
311- gone($c , " Output is no longer available." ) unless isValidPath $output -> path;
309+ gone($c , " Output is no longer available." ) unless $MACHINE_LOCAL_STORE -> isValidPath( $output -> path) ;
312310
313311 $c -> response-> header(' Content-Disposition' , " attachment; filename=\" build-${\$ build->id}-${\$ outputName}.nar.bz2\" " );
314312 $c -> stash-> {current_view } = ' NixNAR' ;
@@ -425,15 +423,15 @@ sub getDependencyGraph {
425423 };
426424 $$done {$path } = $node ;
427425 my @refs ;
428- foreach my $ref (queryReferences($path )) {
426+ foreach my $ref ($MACHINE_LOCAL_STORE -> queryReferences($path )) {
429427 next if $ref eq $path ;
430428 next unless $runtime || $ref =~ / \. drv$ / ;
431429 getDependencyGraph($self , $c , $runtime , $done , $ref );
432430 push @refs , $ref ;
433431 }
434432 # Show in reverse topological order to flatten the graph.
435433 # Should probably do a proper BFS.
436- my @sorted = reverse topoSortPaths(@refs );
434+ my @sorted = reverse $MACHINE_LOCAL_STORE -> topoSortPaths(@refs );
437435 $node -> {refs } = [map { $$done {$_ } } @sorted ];
438436 }
439437
@@ -446,7 +444,7 @@ sub build_deps : Chained('buildChain') PathPart('build-deps') {
446444 my $build = $c -> stash-> {build };
447445 my $drvPath = $build -> drvpath;
448446
449- error($c , " Derivation no longer available." ) unless isValidPath $drvPath ;
447+ error($c , " Derivation no longer available." ) unless $MACHINE_LOCAL_STORE -> isValidPath( $drvPath ) ;
450448
451449 $c -> stash-> {buildTimeGraph } = getDependencyGraph($self , $c , 0, {}, $drvPath );
452450
@@ -461,7 +459,7 @@ sub runtime_deps : Chained('buildChain') PathPart('runtime-deps') {
461459
462460 requireLocalStore($c );
463461
464- error($c , " Build outputs no longer available." ) unless all { isValidPath($_ ) } @outPaths ;
462+ error($c , " Build outputs no longer available." ) unless all { $MACHINE_LOCAL_STORE -> isValidPath($_ ) } @outPaths ;
465463
466464 my $done = {};
467465 $c -> stash-> {runtimeGraph } = [ map { getDependencyGraph($self , $c , 1, $done , $_ ) } @outPaths ];
@@ -481,7 +479,7 @@ sub nix : Chained('buildChain') PathPart('nix') CaptureArgs(0) {
481479 if (isLocalStore) {
482480 foreach my $out ($build -> buildoutputs) {
483481 notFound($c , " Path " . $out -> path . " is no longer available." )
484- unless isValidPath($out -> path);
482+ unless $MACHINE_LOCAL_STORE -> isValidPath($out -> path);
485483 }
486484 }
487485
0 commit comments