Fixes errors like:
Caught exception in engine "Wide character in syswrite at /nix/store/498lwsrn5kkdh1q8kn3vcpd3457w6m7a-hydra-perl-deps/lib/perl5/site_perl/5.16.3/Starman/Server.pm line 547."
Note that these errors didn't happen if the database encoding was set
to SQL_ASCII (which was the case for hydra.nixos.org, explaining why
it didn't get these errors). However, now the encoding must be
UTF8. To change it, do:
update pg_database set encoding = pg_char_to_encoding('UTF8') where datname = 'hydra';
38 lines
1.0 KiB
Perl
38 lines
1.0 KiB
Perl
package Hydra::View::TT;
|
|
|
|
use strict;
|
|
use base 'Catalyst::View::TT';
|
|
use Hydra::Helper::Nix;
|
|
|
|
__PACKAGE__->config(
|
|
TEMPLATE_EXTENSION => '.tt',
|
|
ENCODING => 'utf-8',
|
|
PRE_CHOMP => 1,
|
|
POST_CHOMP => 1,
|
|
expose_methods => [qw/buildLogExists buildStepLogExists jobExists/]);
|
|
|
|
sub buildLogExists {
|
|
my ($self, $c, $build) = @_;
|
|
my @outPaths = map { $_->path } $build->buildoutputs->all;
|
|
return defined findLog($c, $build->drvpath, @outPaths);
|
|
}
|
|
|
|
sub buildStepLogExists {
|
|
my ($self, $c, $step) = @_;
|
|
my @outPaths = map { $_->path } $step->buildstepoutputs->all;
|
|
return defined findLog($c, $step->drvpath, @outPaths);
|
|
}
|
|
|
|
# Check whether the given job is a member of the most recent jobset
|
|
# evaluation.
|
|
sub jobExists {
|
|
my ($self, $c, $job) = @_;
|
|
my $latestEval = $job->jobset->jobsetevals->search(
|
|
{ hasnewbuilds => 1},
|
|
{ rows => 1, order_by => ["id desc"] })->single;
|
|
return 0 if !defined $latestEval; # can't happen
|
|
return scalar($latestEval->builds->search({ job => $job->name })) != 0;
|
|
}
|
|
|
|
1;
|