forked from lix-project/hydra
ListBuilds: Simplify nix channel dispatcher.
We only allow channel/latest anyway, so it really doesn't make sense to explicitly specify this in the PathPart and provide other dispatcher once we have more than just "latest", which greatly simplifies the dispatch tree. Signed-off-by: aszlig <aszlig@redmoonstudios.org>
This commit is contained in:
parent
ed361a0145
commit
1fdc258de0
|
@ -32,10 +32,9 @@ sub all : Chained('get_builds') PathPart {
|
|||
}
|
||||
|
||||
|
||||
sub nix : Chained('get_builds') PathPart('channel') CaptureArgs(1) {
|
||||
sub nix : Chained('get_builds') PathPart('channel/latest') CaptureArgs(1) {
|
||||
my ($self, $c, $channelName) = @_;
|
||||
eval {
|
||||
if ($channelName eq "latest") {
|
||||
|
||||
$c->stash->{channelName} = $c->stash->{channelBaseName} . "-latest";
|
||||
$c->stash->{channelBuilds} = $c->stash->{latestSucceeded}
|
||||
->search_literal("exists (select 1 from buildproducts where build = me.id and type = 'nix-build')")
|
||||
|
@ -44,12 +43,6 @@ sub nix : Chained('get_builds') PathPart('channel') CaptureArgs(1) {
|
|||
, order_by => ["me.id", "buildoutputs.name"]
|
||||
, '+select' => ['buildoutputs.path', 'buildoutputs.name'], '+as' => ['outpath', 'outname'] });
|
||||
}
|
||||
else {
|
||||
notFound($c, "Unknown channel `$channelName'.");
|
||||
}
|
||||
};
|
||||
error($c, $@) if $@;
|
||||
}
|
||||
|
||||
|
||||
# Redirect to the latest successful build.
|
||||
|
|
Loading…
Reference in a new issue