From b1da85140d74d28e1a74db4c7b048e71bfa3d1f3 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 5 Dec 2011 17:13:20 +0100 Subject: [PATCH] Fix sysbuild input type handling --- src/lib/Hydra/Helper/AddBuilds.pm | 31 +++++++++++++++++-------------- src/script/hydra-evaluator | 13 ++++--------- 2 files changed, 21 insertions(+), 23 deletions(-) diff --git a/src/lib/Hydra/Helper/AddBuilds.pm b/src/lib/Hydra/Helper/AddBuilds.pm index 3a7e9e6c..172db719 100644 --- a/src/lib/Hydra/Helper/AddBuilds.pm +++ b/src/lib/Hydra/Helper/AddBuilds.pm @@ -563,49 +563,52 @@ sub fetchInputHg { sub fetchInput { my ($db, $project, $jobset, $name, $type, $value) = @_; - my $input; + my @inputs; if ($type eq "path") { - $input = fetchInputPath($db, $project, $jobset, $name, $value); + push @inputs, fetchInputPath($db, $project, $jobset, $name, $value); } elsif ($type eq "svn") { - $input = fetchInputSVN($db, $project, $jobset, $name, $value, 0); + push @inputs, fetchInputSVN($db, $project, $jobset, $name, $value, 0); } elsif ($type eq "svn-checkout") { - $input = fetchInputSVN($db, $project, $jobset, $name, $value, 1); + push @inputs, fetchInputSVN($db, $project, $jobset, $name, $value, 1); } elsif ($type eq "build") { - $input = fetchInputBuild($db, $project, $jobset, $name, $value); + push @inputs, fetchInputBuild($db, $project, $jobset, $name, $value); } elsif ($type eq "sysbuild") { - $input = fetchInputSystemBuild($db, $project, $jobset, $name, $value); + push @inputs, fetchInputSystemBuild($db, $project, $jobset, $name, $value); } elsif ($type eq "git") { - $input = fetchInputGit($db, $project, $jobset, $name, $value); + push @inputs, fetchInputGit($db, $project, $jobset, $name, $value); } elsif ($type eq "hg") { - $input = fetchInputHg($db, $project, $jobset, $name, $value); + push @inputs, fetchInputHg($db, $project, $jobset, $name, $value); } elsif ($type eq "bzr") { - $input = fetchInputBazaar($db, $project, $jobset, $name, $value, 0); + push @inputs, fetchInputBazaar($db, $project, $jobset, $name, $value, 0); } elsif ($type eq "bzr-checkout") { - $input = fetchInputBazaar($db, $project, $jobset, $name, $value, 1); + push @inputs, fetchInputBazaar($db, $project, $jobset, $name, $value, 1); } elsif ($type eq "string") { die unless defined $value; - $input = { value => $value }; + push @inputs, { value => $value }; } elsif ($type eq "boolean") { die unless defined $value && ($value eq "true" || $value eq "false"); - $input = { value => $value }; + push @inputs, { value => $value }; } else { die "Input `" . $name . "' has unknown type `$type'."; } - $input->{type} = $type if defined $input; - return $input; + foreach my $input (@inputs) { + $input->{type} = $type if defined $input; + } + + return @inputs; } diff --git a/src/script/hydra-evaluator b/src/script/hydra-evaluator index 92632be3..c2e71ebb 100755 --- a/src/script/hydra-evaluator +++ b/src/script/hydra-evaluator @@ -25,15 +25,10 @@ sub fetchInputs { my ($project, $jobset, $inputInfo) = @_; foreach my $input ($jobset->jobsetinputs->all) { foreach my $alt ($input->jobsetinputalts->all) { - if($input->type eq "sysbuild") { - my @info = fetchInput($db, $project, $jobset, $input->name, $input->type, $alt->value); - foreach my $info_el (@info) { - push @{$$inputInfo{$input->name}}, $info_el if defined $info_el; - } - } else { - my $info = fetchInput($db, $project, $jobset, $input->name, $input->type, $alt->value); - push @{$$inputInfo{$input->name}}, $info if defined $info; - } + my @info = fetchInput($db, $project, $jobset, $input->name, $input->type, $alt->value); + foreach my $info_el (@info) { + push @{$$inputInfo{$input->name}}, $info_el if defined $info_el; + } } } }