Hackery to make downloads work when using a binary cache
[?]
Feb 26, 2016, 4:28 PM
V2YFPM72UMEDEZVWBQT42KSVDALD5PPJXTBZALKH26SR5PKGC42ACDependencies
- [2]
3TZGWQHOAllow downloading file by filename - [3]
MAOFG2TD* Allow omitting the product number if there is only one product in a - [4]
7UHHF564Security: Also check paths in the web server - [5]
LBNVQXUB* Build the /build stuff in a separate controller. - [6]
PMNWRTGJAdd multiple output support - [7]
OD5FSS5A* Quick hack to allow viewing of dependency graphs (via nix-store -q - [8]
GJFYEU3S* Nix now stores logs by default as bzip2, make sure the build page uncompresses before showing. - [9]
EFWN7JBV* Added a status page that shows all the currently executing build steps. - [10]
5NO7NCKT* Refactoring.
Change contents
- replacement in src/lib/Hydra/Controller/Build.pm at line 67
$c->stash->{available} = all { isValidPath($_->path) } $build->buildoutputs->all;$c->stash->{available} =($c->config->{store_mode} // "direct") eq "direct"? all { isValidPath($_->path) } $build->buildoutputs->all: 1; # FIXME - edit in src/lib/Hydra/Controller/Build.pm at line 224
if ($product->path !~ /^($Nix::Config::storeDir\/[^\/]+)/) {die "Invalid store path " . $product->path . ".\n";}my $storePath = $1; - replacement in src/lib/Hydra/Controller/Build.pm at line 230
notFound($c, "Build product " . $product->path . " has disappeared.") unless -e $product->path;# 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 =defined $c->config->{binary_cache_public_key_file}? "--option binary-cache-public-keys " . read_file($c->config->{binary_cache_public_key_file}) . "\n": "";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;