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;
|
||||
|
||||
use strict;
|
||||
use feature 'switch';
|
||||
use utf8;
|
||||
use JSON;
|
||||
use IPC::Run;
|
||||
|
@ -292,18 +291,17 @@ sub inputsToArgs {
|
|||
if scalar @{$inputInfo->{$input}} == 1
|
||||
&& defined $inputInfo->{$input}->[0]->{storePath};
|
||||
foreach my $alt (@{$inputInfo->{$input}}) {
|
||||
given ($alt->{type}) {
|
||||
when ("string") {
|
||||
if ($alt->{type} eq "string") {
|
||||
push @res, "--argstr", $input, $alt->{value};
|
||||
}
|
||||
when ("boolean") {
|
||||
elsif ($alt->{type} eq "boolean") {
|
||||
push @res, "--arg", $input, booleanToString($exprType, $alt->{value});
|
||||
}
|
||||
when ("nix") {
|
||||
elsif ($alt->{type} eq "nix") {
|
||||
die "input type ‘nix’ only supported for Nix-based jobsets\n" unless $exprType eq "nix";
|
||||
push @res, "--arg", $input, $alt->{value};
|
||||
}
|
||||
when ("eval") {
|
||||
elsif ($alt->{type} eq "eval") {
|
||||
die "input type ‘eval’ only supported for Nix-based jobsets\n" unless $exprType eq "nix";
|
||||
my $s = "{ ";
|
||||
# FIXME: escape $_. But dots should not be escaped.
|
||||
|
@ -312,12 +310,11 @@ sub inputsToArgs {
|
|||
$s .= "}";
|
||||
push @res, "--arg", $input, $s;
|
||||
}
|
||||
default {
|
||||
else {
|
||||
push @res, "--arg", $input, buildInputToString($exprType, $alt);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return @res;
|
||||
}
|
||||
|
|
|
@ -6,7 +6,6 @@ use Exporter;
|
|||
use Readonly;
|
||||
use Nix::Store;
|
||||
use Hydra::Helper::Nix;
|
||||
use feature qw/switch/;
|
||||
|
||||
our @ISA = qw(Exporter);
|
||||
our @EXPORT = qw(
|
||||
|
@ -238,13 +237,11 @@ sub showStatus {
|
|||
my ($build) = @_;
|
||||
|
||||
my $status = "Failed";
|
||||
given ($build->buildstatus) {
|
||||
when (0) { $status = "Success"; }
|
||||
when (1) { $status = "Failed"; }
|
||||
when (2) { $status = "Dependency failed"; }
|
||||
when (4) { $status = "Cancelled"; }
|
||||
when (6) { $status = "Failed with output"; }
|
||||
}
|
||||
if ($build->buildstatus == 0) { $status = "Success"; }
|
||||
elsif ($build->buildstatus == 1) { $status = "Failed"; }
|
||||
elsif ($build->buildstatus == 2) { $status = "Dependency failed"; }
|
||||
elsif ($build->buildstatus == 4) { $status = "Cancelled"; }
|
||||
elsif ($build->buildstatus == 6) { $status = "Failed with output"; }
|
||||
|
||||
return $status;
|
||||
}
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package Hydra::Plugin::CoverityScan;
|
||||
|
||||
use strict;
|
||||
use feature 'switch';
|
||||
use parent 'Hydra::Plugin';
|
||||
use File::Basename;
|
||||
use LWP::UserAgent;
|
||||
|
@ -63,14 +62,12 @@ sub buildFinished {
|
|||
my @exts = qw(.xz .bz2 .lzma .zip .tgz);
|
||||
my ($dir, $file, $ext) = fileparse($covTarball, @exts);
|
||||
my $mimetype;
|
||||
given ($ext) {
|
||||
when ('.xz') { $mimetype = "application/x-xz"; }
|
||||
when ('.lzma') { $mimetype = "application/x-xz"; }
|
||||
when ('.zip') { $mimetype = "application/zip"; }
|
||||
when ('.bz2') { $mimetype = "application/x-bzip2"; }
|
||||
when ('.tgz') { $mimetype = "application/x-gzip"; }
|
||||
default { die "couldn't parse extension of $covTarball"; }
|
||||
}
|
||||
if ($ext eq '.xz') { $mimetype = "application/x-xz"; }
|
||||
elsif ($ext eq '.lzma') { $mimetype = "application/x-xz"; }
|
||||
elsif ($ext eq '.zip') { $mimetype = "application/zip"; }
|
||||
elsif ($ext eq '.bz2') { $mimetype = "application/x-bzip2"; }
|
||||
elsif ($ext eq '.tgz') { $mimetype = "application/x-gzip"; }
|
||||
else { die "couldn't parse extension of $covTarball"; }
|
||||
|
||||
die "couldn't detect mimetype of $covTarball" unless defined $mimetype;
|
||||
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
#! /var/run/current-system/sw/bin/perl -w
|
||||
|
||||
use strict;
|
||||
use feature 'switch';
|
||||
use utf8;
|
||||
use Hydra::Schema;
|
||||
use Hydra::Plugin;
|
||||
|
|
Loading…
Reference in a new issue