Disallow multiple jobs with the same name

This has been deprecated since a8db329839.

Issue #60.
This commit is contained in:
Eelco Dolstra 2014-09-24 18:12:30 +02:00
parent 0d5a38a40b
commit 6284fd540d

View file

@ -351,8 +351,19 @@ sub evalJobs {
SuppressEmpty => '') SuppressEmpty => '')
or die "cannot parse XML output"; or die "cannot parse XML output";
my %jobNames;
my $errors;
my @filteredJobs = (); my @filteredJobs = ();
foreach my $job (@{$jobs->{job}}) { foreach my $job (@{$jobs->{job}}) {
# Ensure that there is only one job with the given
# name. FIXME: this check will become unnecessary after we
# remove support for multiple values per jobset input.
if (defined $jobNames{$job->{jobName}}) {
$errors .= "error: there are multiple jobs named $job->{jobName}\n\n";
next;
}
$jobNames{$job->{jobName}} = 1;
my $validJob = 1; my $validJob = 1;
foreach my $arg (@{$job->{arg}}) { foreach my $arg (@{$job->{arg}}) {
my $input = $inputInfo->{$arg->{name}}->[$arg->{altnr}]; my $input = $inputInfo->{$arg->{name}}->[$arg->{altnr}];
@ -362,15 +373,6 @@ sub evalJobs {
} }
$jobs->{job} = \@filteredJobs; $jobs->{job} = \@filteredJobs;
my %jobNames;
my $errors;
foreach my $job (@{$jobs->{job}}) {
$jobNames{$job->{jobName}}++;
if ($jobNames{$job->{jobName}} == 2) {
$errors .= "warning: there are multiple jobs named $job->{jobName}; support for this will go away soon!\n\n";
}
}
# Handle utf-8 characters in error messages. No idea why this works. # Handle utf-8 characters in error messages. No idea why this works.
utf8::decode($_->{msg}) foreach @{$jobs->{error}}; utf8::decode($_->{msg}) foreach @{$jobs->{error}};