diff --git a/src/lib/Hydra/Controller/User.pm b/src/lib/Hydra/Controller/User.pm index 9e7d96e5a..8d9b3f786 100644 --- a/src/lib/Hydra/Controller/User.pm +++ b/src/lib/Hydra/Controller/User.pm @@ -106,11 +106,11 @@ sub doEmailLogin { my $allowed_domains = $c->config->{allowed_domains} // ($c->config->{persona_allowed_domains} // ""); if ($allowed_domains ne "") { my $email_ok = 0; - my @domains = split ',', $allowed_domains; + my @domains = split /,/, $allowed_domains; map { $_ =~ s/^\s*(.*?)\s*$/$1/ } @domains; foreach my $domain (@domains) { - $email_ok = $email_ok || ((split '@', $email)[1] eq $domain); + $email_ok = $email_ok || ((split /@/, $email)[1] eq $domain); } error($c, "Your email address does not belong to a domain that is allowed to log in.\n") unless $email_ok; diff --git a/src/lib/Hydra/Plugin/BazaarInput.pm b/src/lib/Hydra/Plugin/BazaarInput.pm index b35ed7c8c..85cde8534 100644 --- a/src/lib/Hydra/Plugin/BazaarInput.pm +++ b/src/lib/Hydra/Plugin/BazaarInput.pm @@ -54,7 +54,7 @@ sub fetchInput { "nix-prefetch-bzr", $uri, $revision); die "cannot check out Bazaar branch `$uri':\n$stderr" if $res; - ($sha256, $storePath) = split ' ', $stdout; + ($sha256, $storePath) = split / /, $stdout; # FIXME: time window between nix-prefetch-bzr and addTempRoot. $MACHINE_LOCAL_STORE->addTempRoot($storePath); diff --git a/src/lib/Hydra/Plugin/BitBucketPulls.pm b/src/lib/Hydra/Plugin/BitBucketPulls.pm index 5bead2cf8..17ee6de10 100644 --- a/src/lib/Hydra/Plugin/BitBucketPulls.pm +++ b/src/lib/Hydra/Plugin/BitBucketPulls.pm @@ -38,7 +38,7 @@ sub fetchInput { my ($self, $type, $name, $value, $project, $jobset) = @_; return undef if $type ne "bitbucketpulls"; # TODO Allow filtering of some kind here? - (my $owner, my $repo) = split ' ', $value; + (my $owner, my $repo) = split / /, $value; my $auth = $self->{config}->{bitbucket_authorization}->{$owner}; my %pulls; my $ua = LWP::UserAgent->new(); diff --git a/src/lib/Hydra/Plugin/EmailNotification.pm b/src/lib/Hydra/Plugin/EmailNotification.pm index a622f938c..6c4948fad 100644 --- a/src/lib/Hydra/Plugin/EmailNotification.pm +++ b/src/lib/Hydra/Plugin/EmailNotification.pm @@ -71,7 +71,7 @@ sub buildFinished { my $to = $build->jobset->emailoverride ne "" ? $build->jobset->emailoverride : $build->maintainers; - foreach my $address (split ",", ($to // "")) { + foreach my $address (split /,/, ($to // "")) { $address = trim $address; $addresses{$address} //= { builds => [] }; diff --git a/src/lib/Hydra/Plugin/GitInput.pm b/src/lib/Hydra/Plugin/GitInput.pm index dee6be57c..aaf898e44 100644 --- a/src/lib/Hydra/Plugin/GitInput.pm +++ b/src/lib/Hydra/Plugin/GitInput.pm @@ -26,7 +26,7 @@ sub _isHash { sub _parseValue { my ($value) = @_; - my @parts = split ' ', $value; + my @parts = split / /, $value; (my $uri, my $branch, my $deepClone) = @parts; $branch = defined $branch ? $branch : "master"; my $options = {}; @@ -38,7 +38,7 @@ sub _parseValue { $start_options = 2; } foreach my $option (@parts[$start_options .. $#parts]) { - (my $key, my $value) = split('=', $option); + (my $key, my $value) = split(/=/, $option); $options->{$key} = $value; } return ($uri, $branch, $deepClone, $options); @@ -214,7 +214,7 @@ sub fetchInput { } # FIXME: Don't use nix-prefetch-git. - ($sha256, $storePath) = split ' ', grab(cmd => ["nix-prefetch-git", $clonePath, $revision], chomp => 1); + ($sha256, $storePath) = split / /, grab(cmd => ["nix-prefetch-git", $clonePath, $revision], chomp => 1); # FIXME: time window between nix-prefetch-git and addTempRoot. $MACHINE_LOCAL_STORE->addTempRoot($storePath); @@ -265,7 +265,7 @@ sub getCommits { my $res = []; foreach my $line (split /\n/, $out) { - my ($revision, $author, $email, $date) = split "\t", $line; + my ($revision, $author, $email, $date) = split /\t/, $line; push @$res, { revision => $revision, author => decode("utf-8", $author), email => $email }; } diff --git a/src/lib/Hydra/Plugin/GithubPulls.pm b/src/lib/Hydra/Plugin/GithubPulls.pm index 0ac7a08b5..aa1b98ac7 100644 --- a/src/lib/Hydra/Plugin/GithubPulls.pm +++ b/src/lib/Hydra/Plugin/GithubPulls.pm @@ -31,10 +31,10 @@ sub _iterate { $pulls->{$pull->{number}} = $pull; } # TODO Make Link header parsing more robust!!! - my @links = split ',', ($res->header("Link") // ""); + my @links = split /,/, ($res->header("Link") // ""); my $next = ""; foreach my $link (@links) { - my ($url, $rel) = split ";", $link; + my ($url, $rel) = split /;/, $link; if (trim($rel) eq 'rel="next"') { $next = substr trim($url), 1, -1; last; @@ -47,7 +47,7 @@ sub fetchInput { my ($self, $type, $name, $value, $project, $jobset) = @_; return undef if $type ne "githubpulls"; # TODO Allow filtering of some kind here? - (my $owner, my $repo) = split ' ', $value; + (my $owner, my $repo) = split / /, $value; my $auth = $self->{config}->{github_authorization}->{$owner}; my %pulls; my $ua = LWP::UserAgent->new(); diff --git a/src/lib/Hydra/Plugin/GithubRefs.pm b/src/lib/Hydra/Plugin/GithubRefs.pm index a686260b7..9872cdec3 100644 --- a/src/lib/Hydra/Plugin/GithubRefs.pm +++ b/src/lib/Hydra/Plugin/GithubRefs.pm @@ -83,10 +83,10 @@ sub _iterate { $refs->{$ref_name} = $ref; } # TODO Make Link header parsing more robust!!! - my @links = split ',', $res->header("Link"); + my @links = split /,/, $res->header("Link"); my $next = ""; foreach my $link (@links) { - my ($url, $rel) = split ";", $link; + my ($url, $rel) = split /;/, $link; if (trim($rel) eq 'rel="next"') { $next = substr trim($url), 1, -1; last; @@ -99,7 +99,7 @@ sub fetchInput { my ($self, $input_type, $name, $value, $project, $jobset) = @_; return undef if $input_type ne "github_refs"; - my ($owner, $repo, $type, $fut, $prefix) = split ' ', $value; + my ($owner, $repo, $type, $fut, $prefix) = split / /, $value; my $auth = $self->{config}->{github_authorization}->{$owner}; my $githubEndpoint = $self->{config}->{github_endpoint} // "https://api.github.com"; diff --git a/src/lib/Hydra/Plugin/GitlabPulls.pm b/src/lib/Hydra/Plugin/GitlabPulls.pm index 2963d93c7..80d0dbeca 100644 --- a/src/lib/Hydra/Plugin/GitlabPulls.pm +++ b/src/lib/Hydra/Plugin/GitlabPulls.pm @@ -49,10 +49,10 @@ sub _iterate { $pulls->{$pull->{iid}} = $pull; } # TODO Make Link header parsing more robust!!! - my @links = split ',', $res->header("Link"); + my @links = split /,/, $res->header("Link"); my $next = ""; foreach my $link (@links) { - my ($url, $rel) = split ";", $link; + my ($url, $rel) = split /;/, $link; if (trim($rel) eq 'rel="next"') { $next = substr trim($url), 1, -1; last; @@ -65,7 +65,7 @@ sub fetchInput { my ($self, $type, $name, $value, $project, $jobset) = @_; return undef if $type ne "gitlabpulls"; - (my $baseUrl, my $projectId) = split ' ', $value; + (my $baseUrl, my $projectId) = split / /, $value; my $url = "$baseUrl/api/v4/projects/$projectId/merge_requests?per_page=100&state=opened"; my $accessToken = $self->{config}->{gitlab_authorization}->{$projectId}; diff --git a/src/lib/Hydra/Plugin/MercurialInput.pm b/src/lib/Hydra/Plugin/MercurialInput.pm index 85bd2c708..c0f3e69d3 100644 --- a/src/lib/Hydra/Plugin/MercurialInput.pm +++ b/src/lib/Hydra/Plugin/MercurialInput.pm @@ -16,7 +16,7 @@ sub supportedInputTypes { sub _parseValue { my ($value) = @_; - (my $uri, my $id) = split ' ', $value; + (my $uri, my $id) = split / /, $value; $id = defined $id ? $id : "default"; return ($uri, $id); } @@ -60,7 +60,7 @@ sub fetchInput { "hg", "log", "-r", $id, "--template", "{node} {rev} {branch}"); die "error getting branch and revision of $id from `$uri':\n$stderr" if $res1; - my ($revision, $revCount, $branch) = split ' ', $stdout; + my ($revision, $revCount, $branch) = split / /, $stdout; my $storePath; my $sha256; @@ -81,7 +81,7 @@ sub fetchInput { "nix-prefetch-hg", $clonePath, $revision); die "cannot check out Mercurial repository `$uri':\n$stderr" if $res; - ($sha256, $storePath) = split ' ', $stdout; + ($sha256, $storePath) = split / /, $stdout; # FIXME: time window between nix-prefetch-hg and addTempRoot. $MACHINE_LOCAL_STORE->addTempRoot($storePath); @@ -126,7 +126,7 @@ sub getCommits { my $res = []; foreach my $line (split /\n/, $out) { if ($line ne "") { - my ($revision, $author, $email) = split "\t", $line; + my ($revision, $author, $email) = split /\t/, $line; push @$res, { revision => $revision, author => $author, email => $email }; } } diff --git a/src/lib/Hydra/Plugin/PathInput.pm b/src/lib/Hydra/Plugin/PathInput.pm index 5d78d9cfb..b5418846f 100644 --- a/src/lib/Hydra/Plugin/PathInput.pm +++ b/src/lib/Hydra/Plugin/PathInput.pm @@ -16,7 +16,7 @@ sub _parseValue { # The input is a local path or URL, optionally followed by a # time period specified in seconds. my ($config, $value) = @_; - my @parts = split ' ', $value; + my @parts = split / /, $value; (my $uri, my $freq) = @parts; # By default don't check a path more often than every 30 seconds, # but the second path argument can change that value or the global diff --git a/src/lib/Hydra/Plugin/RunCommand.pm b/src/lib/Hydra/Plugin/RunCommand.pm index 431637644..2c77455a3 100644 --- a/src/lib/Hydra/Plugin/RunCommand.pm +++ b/src/lib/Hydra/Plugin/RunCommand.pm @@ -85,7 +85,7 @@ sub isBuildEligibleForDynamicRunCommand { sub configSectionMatches { my ($name, $project, $jobset, $job) = @_; - my @elems = split ':', $name; + my @elems = split /:/, $name; die "invalid section name '$name'\n" if scalar(@elems) > 3; @@ -103,7 +103,7 @@ sub configSectionMatches { sub eventMatches { my ($conf, $event) = @_; - for my $x (split " ", ($conf->{events} // "buildFinished")) { + for my $x (split / /, ($conf->{events} // "buildFinished")) { return 1 if $x eq $event; } return 0; diff --git a/src/lib/Hydra/Plugin/SubversionInput.pm b/src/lib/Hydra/Plugin/SubversionInput.pm index d3579c40f..144b03194 100644 --- a/src/lib/Hydra/Plugin/SubversionInput.pm +++ b/src/lib/Hydra/Plugin/SubversionInput.pm @@ -20,7 +20,7 @@ sub fetchInput { return undef if $type ne "svn" && $type ne "svn-checkout"; # Allow users to specify a revision number next to the URI. - my ($uri, $revision) = split ' ', $value; + my ($uri, $revision) = split / /, $value; my $sha256; my $storePath; diff --git a/t/queue-runner/notifications.t b/t/queue-runner/notifications.t index d0e72409c..96b7ac392 100644 --- a/t/queue-runner/notifications.t +++ b/t/queue-runner/notifications.t @@ -109,7 +109,7 @@ subtest "Build: not substitutable, unsubstitutable" => sub { subtest "Second notification: step_finished" => sub { my ($channelName, $pid, $payload) = @{$dbh->func("pg_notifies")}; is($channelName, "step_finished", "The event is for the step finishing"); - my ($buildId, $stepNr, $logFile) = split "\t", $payload; + my ($buildId, $stepNr, $logFile) = split /\t/, $payload; is($buildId, $build->id, "The payload is the build's ID"); is($stepNr, 1, "The payload is the build's step number"); isnt($logFile, undef, "The log file is passed");