forked from lix-project/hydra
Don't use given/when
These give warnings in Perl >= 5.18: given is experimental at /home/hydra/src/hydra/src/lib/Hydra/Helper/CatalystUtils.pm line 241. when is experimental at /home/hydra/src/hydra/src/lib/Hydra/Helper/CatalystUtils.pm line 242. ...
This commit is contained in:
parent
e56e743f97
commit
c0ca5489e1
|
@ -1,7 +1,6 @@
|
||||||
package Hydra::Helper::AddBuilds;
|
package Hydra::Helper::AddBuilds;
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use feature 'switch';
|
|
||||||
use utf8;
|
use utf8;
|
||||||
use JSON;
|
use JSON;
|
||||||
use IPC::Run;
|
use IPC::Run;
|
||||||
|
@ -292,30 +291,28 @@ sub inputsToArgs {
|
||||||
if scalar @{$inputInfo->{$input}} == 1
|
if scalar @{$inputInfo->{$input}} == 1
|
||||||
&& defined $inputInfo->{$input}->[0]->{storePath};
|
&& defined $inputInfo->{$input}->[0]->{storePath};
|
||||||
foreach my $alt (@{$inputInfo->{$input}}) {
|
foreach my $alt (@{$inputInfo->{$input}}) {
|
||||||
given ($alt->{type}) {
|
if ($alt->{type} eq "string") {
|
||||||
when ("string") {
|
push @res, "--argstr", $input, $alt->{value};
|
||||||
push @res, "--argstr", $input, $alt->{value};
|
}
|
||||||
}
|
elsif ($alt->{type} eq "boolean") {
|
||||||
when ("boolean") {
|
push @res, "--arg", $input, booleanToString($exprType, $alt->{value});
|
||||||
push @res, "--arg", $input, booleanToString($exprType, $alt->{value});
|
}
|
||||||
}
|
elsif ($alt->{type} eq "nix") {
|
||||||
when ("nix") {
|
die "input type ‘nix’ only supported for Nix-based jobsets\n" unless $exprType eq "nix";
|
||||||
die "input type ‘nix’ only supported for Nix-based jobsets\n" unless $exprType eq "nix";
|
push @res, "--arg", $input, $alt->{value};
|
||||||
push @res, "--arg", $input, $alt->{value};
|
}
|
||||||
}
|
elsif ($alt->{type} eq "eval") {
|
||||||
when ("eval") {
|
die "input type ‘eval’ only supported for Nix-based jobsets\n" unless $exprType eq "nix";
|
||||||
die "input type ‘eval’ only supported for Nix-based jobsets\n" unless $exprType eq "nix";
|
my $s = "{ ";
|
||||||
my $s = "{ ";
|
# FIXME: escape $_. But dots should not be escaped.
|
||||||
# FIXME: escape $_. But dots should not be escaped.
|
$s .= "$_ = builtins.storePath ${\$alt->{jobs}->{$_}}; "
|
||||||
$s .= "$_ = builtins.storePath ${\$alt->{jobs}->{$_}}; "
|
foreach keys %{$alt->{jobs}};
|
||||||
foreach keys %{$alt->{jobs}};
|
$s .= "}";
|
||||||
$s .= "}";
|
push @res, "--arg", $input, $s;
|
||||||
push @res, "--arg", $input, $s;
|
}
|
||||||
}
|
else {
|
||||||
default {
|
push @res, "--arg", $input, buildInputToString($exprType, $alt);
|
||||||
push @res, "--arg", $input, buildInputToString($exprType, $alt);
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,6 @@ use Exporter;
|
||||||
use Readonly;
|
use Readonly;
|
||||||
use Nix::Store;
|
use Nix::Store;
|
||||||
use Hydra::Helper::Nix;
|
use Hydra::Helper::Nix;
|
||||||
use feature qw/switch/;
|
|
||||||
|
|
||||||
our @ISA = qw(Exporter);
|
our @ISA = qw(Exporter);
|
||||||
our @EXPORT = qw(
|
our @EXPORT = qw(
|
||||||
|
@ -238,15 +237,13 @@ sub showStatus {
|
||||||
my ($build) = @_;
|
my ($build) = @_;
|
||||||
|
|
||||||
my $status = "Failed";
|
my $status = "Failed";
|
||||||
given ($build->buildstatus) {
|
if ($build->buildstatus == 0) { $status = "Success"; }
|
||||||
when (0) { $status = "Success"; }
|
elsif ($build->buildstatus == 1) { $status = "Failed"; }
|
||||||
when (1) { $status = "Failed"; }
|
elsif ($build->buildstatus == 2) { $status = "Dependency failed"; }
|
||||||
when (2) { $status = "Dependency failed"; }
|
elsif ($build->buildstatus == 4) { $status = "Cancelled"; }
|
||||||
when (4) { $status = "Cancelled"; }
|
elsif ($build->buildstatus == 6) { $status = "Failed with output"; }
|
||||||
when (6) { $status = "Failed with output"; }
|
|
||||||
}
|
|
||||||
|
|
||||||
return $status;
|
return $status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package Hydra::Plugin::CoverityScan;
|
package Hydra::Plugin::CoverityScan;
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use feature 'switch';
|
|
||||||
use parent 'Hydra::Plugin';
|
use parent 'Hydra::Plugin';
|
||||||
use File::Basename;
|
use File::Basename;
|
||||||
use LWP::UserAgent;
|
use LWP::UserAgent;
|
||||||
|
@ -63,14 +62,12 @@ sub buildFinished {
|
||||||
my @exts = qw(.xz .bz2 .lzma .zip .tgz);
|
my @exts = qw(.xz .bz2 .lzma .zip .tgz);
|
||||||
my ($dir, $file, $ext) = fileparse($covTarball, @exts);
|
my ($dir, $file, $ext) = fileparse($covTarball, @exts);
|
||||||
my $mimetype;
|
my $mimetype;
|
||||||
given ($ext) {
|
if ($ext eq '.xz') { $mimetype = "application/x-xz"; }
|
||||||
when ('.xz') { $mimetype = "application/x-xz"; }
|
elsif ($ext eq '.lzma') { $mimetype = "application/x-xz"; }
|
||||||
when ('.lzma') { $mimetype = "application/x-xz"; }
|
elsif ($ext eq '.zip') { $mimetype = "application/zip"; }
|
||||||
when ('.zip') { $mimetype = "application/zip"; }
|
elsif ($ext eq '.bz2') { $mimetype = "application/x-bzip2"; }
|
||||||
when ('.bz2') { $mimetype = "application/x-bzip2"; }
|
elsif ($ext eq '.tgz') { $mimetype = "application/x-gzip"; }
|
||||||
when ('.tgz') { $mimetype = "application/x-gzip"; }
|
else { die "couldn't parse extension of $covTarball"; }
|
||||||
default { die "couldn't parse extension of $covTarball"; }
|
|
||||||
}
|
|
||||||
|
|
||||||
die "couldn't detect mimetype of $covTarball" unless defined $mimetype;
|
die "couldn't detect mimetype of $covTarball" unless defined $mimetype;
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
#! /var/run/current-system/sw/bin/perl -w
|
#! /var/run/current-system/sw/bin/perl -w
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use feature 'switch';
|
|
||||||
use utf8;
|
use utf8;
|
||||||
use Hydra::Schema;
|
use Hydra::Schema;
|
||||||
use Hydra::Plugin;
|
use Hydra::Plugin;
|
||||||
|
|
Loading…
Reference in a new issue