From ec82bc2517d3b8e4d5a05276af1099514ca9579d Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 2 Mar 2016 15:17:22 +0100 Subject: [PATCH] Add /eval/NNN/store-paths action to return store paths in an eval Needed by the NixOS channel scripts since we can no longer get a MANIFEST from Hydra. --- src/lib/Hydra/Controller/JobsetEval.pm | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/lib/Hydra/Controller/JobsetEval.pm b/src/lib/Hydra/Controller/JobsetEval.pm index 53520322..36419cb5 100644 --- a/src/lib/Hydra/Controller/JobsetEval.pm +++ b/src/lib/Hydra/Controller/JobsetEval.pm @@ -245,4 +245,22 @@ sub job : Chained('evalChain') PathPart('job') { } +# Return the store paths of all succeeded builds of type 'nix-build' +# (i.e. regular packages). Used by the NixOS channel scripts. +sub store_paths : Chained('evalChain') PathPart('store-paths') Args(0) { + my ($self, $c) = @_; + + my @builds = $c->stash->{eval}->builds + ->search_literal("exists (select 1 from buildproducts where build = build.id and type = 'nix-build')") + ->search({ finished => 1, buildstatus => 0 }, + { columns => [], join => ["buildoutputs"] + , '+select' => ['buildoutputs.path'], '+as' => ['outpath'] }); + + $self->status_ok( + $c, + entity => [sort map {$_->get_column('outpath')} @builds] + ); +} + + 1;