Remove remaining references to store_mode etc.

This commit is contained in:
Eelco Dolstra
2017-10-18 12:23:07 +02:00
parent cc64e51f75
commit bc60fccf78
7 changed files with 36 additions and 60 deletions

View File

@ -65,9 +65,9 @@ sub build_GET {
$c->stash->{template} = 'build.tt';
$c->stash->{available} =
($c->config->{store_mode} // "direct") eq "direct"
isLocalStore
? all { isValidPath($_->path) } $build->buildoutputs->all
: 1; # FIXME
: 1;
$c->stash->{drvAvailable} = isValidPath $build->drvpath;
if ($build->finished && $build->iscachedbuild) {
@ -204,27 +204,6 @@ sub download : Chained('buildChain') PathPart {
}
my $storePath = $1;
# Hack to get downloads to work on binary cache stores: if the
# store path is not available locally, then import it into the
# local store. FIXME: find a better way; this can require an
# unbounded amount of space.
if (!isValidPath($storePath)) {
my $storeMode = $c->config->{store_mode} // "direct";
notFound($c, "File " . $product->path . " has disappeared.")
if $storeMode eq "direct";
my $url =
$storeMode eq "local-binary-cache" ? "file://" . $c->config->{binary_cache_dir} :
$storeMode eq "s3-binary-cache" ? "https://" . $c->config->{binary_cache_s3_bucket} . ".s3.amazonaws.com/" :
die;
my $args = "";
if (defined $c->config->{binary_cache_public_key_file}
&& -r $c->config->{binary_cache_public_key_file})
{
$args = "--option binary-cache-public-keys " . read_file($c->config->{binary_cache_public_key_file});
}
system("nix-store --realise '$storePath' --option extra-binary-caches '$url' $args>/dev/null");
}
notFound($c, "File " . $product->path . " does not exist.") unless -e $product->path;
return $c->res->redirect(defaultUriForProduct($self, $c, $product, @path))

View File

@ -258,17 +258,10 @@ sub nar :Local :Args(1) {
die if $path =~ /\//;
my $storeMode = $c->config->{store_mode} // "direct";
if ($storeMode eq "s3-binary-cache") {
if (!isLocalStore) {
notFound($c, "There is no binary cache here.");
}
elsif ($storeMode eq "local-binary-cache") {
my $dir = $c->config->{binary_cache_dir};
$c->serve_static_file($dir . "/nar/" . $path);
}
else {
$path = $Nix::Config::storeDir . "/$path";
@ -283,17 +276,10 @@ sub nar :Local :Args(1) {
sub nix_cache_info :Path('nix-cache-info') :Args(0) {
my ($self, $c) = @_;
my $storeMode = $c->config->{store_mode} // "direct";
if ($storeMode eq "s3-binary-cache") {
if (!isLocalStore) {
notFound($c, "There is no binary cache here.");
}
elsif ($storeMode eq "local-binary-cache") {
my $dir = $c->config->{binary_cache_dir};
$c->serve_static_file($dir . "/nix-cache-info");
}
else {
$c->response->content_type('text/plain');
$c->stash->{plain}->{data} =
@ -311,17 +297,10 @@ sub nix_cache_info :Path('nix-cache-info') :Args(0) {
sub narinfo :LocalRegex('^([a-z0-9]+).narinfo$') :Args(0) {
my ($self, $c) = @_;
my $storeMode = $c->config->{store_mode} // "direct";
if ($storeMode eq "s3-binary-cache") {
if (!isLocalStore) {
notFound($c, "There is no binary cache here.");
}
elsif ($storeMode eq "local-binary-cache") {
my $dir = $c->config->{binary_cache_dir};
$c->serve_static_file($dir . "/" . $c->req->captures->[0] . ".narinfo");
}
else {
my $hash = $c->req->captures->[0];