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,18 +291,17 @@ 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};
|
||||||
}
|
}
|
||||||
when ("boolean") {
|
elsif ($alt->{type} eq "boolean") {
|
||||||
push @res, "--arg", $input, booleanToString($exprType, $alt->{value});
|
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";
|
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};
|
||||||
}
|
}
|
||||||
when ("eval") {
|
elsif ($alt->{type} eq "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.
|
||||||
|
@ -312,12 +310,11 @@ sub inputsToArgs {
|
||||||
$s .= "}";
|
$s .= "}";
|
||||||
push @res, "--arg", $input, $s;
|
push @res, "--arg", $input, $s;
|
||||||
}
|
}
|
||||||
default {
|
else {
|
||||||
push @res, "--arg", $input, buildInputToString($exprType, $alt);
|
push @res, "--arg", $input, buildInputToString($exprType, $alt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return @res;
|
return @res;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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,13 +237,11 @@ 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