From c72f4dd67ab787591df5404fe2065dd9633bb50a Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 25 Nov 2008 18:34:24 +0000 Subject: [PATCH] * Boolean inputs. --- src/Hydra/lib/Hydra/Controller/Root.pm | 7 +++++-- src/Hydra/lib/Hydra/Schema.pm | 4 ++-- src/Hydra/lib/Hydra/Schema/Buildinputs.pm | 4 ++-- src/Hydra/lib/Hydra/Schema/Buildproducts.pm | 4 ++-- src/Hydra/lib/Hydra/Schema/Buildresultinfo.pm | 4 ++-- src/Hydra/lib/Hydra/Schema/Builds.pm | 4 ++-- src/Hydra/lib/Hydra/Schema/Buildschedulinginfo.pm | 4 ++-- src/Hydra/lib/Hydra/Schema/Buildsteps.pm | 4 ++-- src/Hydra/lib/Hydra/Schema/Cachedpathinputs.pm | 4 ++-- .../lib/Hydra/Schema/Cachedsubversioninputs.pm | 4 ++-- src/Hydra/lib/Hydra/Schema/Jobsetinputalts.pm | 4 ++-- src/Hydra/lib/Hydra/Schema/Jobsetinputs.pm | 4 ++-- src/Hydra/lib/Hydra/Schema/Jobsets.pm | 4 ++-- src/Hydra/lib/Hydra/Schema/Projects.pm | 4 ++-- src/Hydra/programs/Scheduler.pl | 14 ++++++++++++-- src/Hydra/root/build.tt | 2 +- src/Hydra/root/common.tt | 1 + src/Hydra/root/project.tt | 10 +++++++--- src/hydra.sql | 2 +- 19 files changed, 53 insertions(+), 35 deletions(-) diff --git a/src/Hydra/lib/Hydra/Controller/Root.pm b/src/Hydra/lib/Hydra/Controller/Root.pm index bb4a2c43..0efb5858 100644 --- a/src/Hydra/lib/Hydra/Controller/Root.pm +++ b/src/Hydra/lib/Hydra/Controller/Root.pm @@ -134,7 +134,7 @@ sub updateProject { my $inputType = trim $c->request->params->{"jobset-$baseName-input-$baseName2-type"}; die "Invalid input type: $inputType" unless $inputType eq "svn" || $inputType eq "cvs" || $inputType eq "tarball" || - $inputType eq "string" || $inputType eq "path"; + $inputType eq "string" || $inputType eq "path" || $inputType eq "boolean"; $inputNames{$inputName} = 1; @@ -161,7 +161,10 @@ sub updateProject { my $altnr = 0; foreach my $value (@{$values}) { print STDERR "VALUE: $value\n"; - $input->jobsetinputalts->create({altnr => $altnr++, value => trim $value}); + my $value = trim $value; + die "Invalid Boolean value: $value" if + $inputType eq "boolean" && !($value eq "true" || $value eq "false"); + $input->jobsetinputalts->create({altnr => $altnr++, value => $value}); } } diff --git a/src/Hydra/lib/Hydra/Schema.pm b/src/Hydra/lib/Hydra/Schema.pm index 5acec076..67f4f5ba 100644 --- a/src/Hydra/lib/Hydra/Schema.pm +++ b/src/Hydra/lib/Hydra/Schema.pm @@ -8,8 +8,8 @@ use base 'DBIx::Class::Schema'; __PACKAGE__->load_classes; -# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-25 18:59:54 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:woBkuPRoV3DnJmHdcZ2ZIg +# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-25 19:24:09 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:TBu7KS/p71rCVTI6cl7Thw # You can replace this text with custom content, and it will be preserved on regeneration diff --git a/src/Hydra/lib/Hydra/Schema/Buildinputs.pm b/src/Hydra/lib/Hydra/Schema/Buildinputs.pm index 48a065ef..6309293c 100644 --- a/src/Hydra/lib/Hydra/Schema/Buildinputs.pm +++ b/src/Hydra/lib/Hydra/Schema/Buildinputs.pm @@ -36,8 +36,8 @@ __PACKAGE__->belongs_to("build", "Hydra::Schema::Builds", { id => "build" }); __PACKAGE__->belongs_to("dependency", "Hydra::Schema::Builds", { id => "dependency" }); -# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-25 18:59:54 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:Mwn4Pp+vduPrAU9s089pAg +# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-25 19:24:09 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:Z/kUflLoTmq+0tM82kxVYw # You can replace this text with custom content, and it will be preserved on regeneration diff --git a/src/Hydra/lib/Hydra/Schema/Buildproducts.pm b/src/Hydra/lib/Hydra/Schema/Buildproducts.pm index 2bff9d60..115a698e 100644 --- a/src/Hydra/lib/Hydra/Schema/Buildproducts.pm +++ b/src/Hydra/lib/Hydra/Schema/Buildproducts.pm @@ -33,8 +33,8 @@ __PACKAGE__->set_primary_key("build", "productnr"); __PACKAGE__->belongs_to("build", "Hydra::Schema::Builds", { id => "build" }); -# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-25 18:59:54 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:kzQauEWWXur6WilY/1LcfA +# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-25 19:24:09 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:gmWXPz3CSN4WOUTrcxXzQw # You can replace this text with custom content, and it will be preserved on regeneration diff --git a/src/Hydra/lib/Hydra/Schema/Buildresultinfo.pm b/src/Hydra/lib/Hydra/Schema/Buildresultinfo.pm index 3c9fc59d..bfe69346 100644 --- a/src/Hydra/lib/Hydra/Schema/Buildresultinfo.pm +++ b/src/Hydra/lib/Hydra/Schema/Buildresultinfo.pm @@ -29,8 +29,8 @@ __PACKAGE__->set_primary_key("id"); __PACKAGE__->belongs_to("id", "Hydra::Schema::Builds", { id => "id" }); -# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-25 18:59:54 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:85sz3phT3arumqXladRtMQ +# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-25 19:24:09 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:7iNqQ1Q912X3/TiDPk/RWA # You can replace this text with custom content, and it will be preserved on regeneration diff --git a/src/Hydra/lib/Hydra/Schema/Builds.pm b/src/Hydra/lib/Hydra/Schema/Builds.pm index 98b1d152..e0c40be9 100644 --- a/src/Hydra/lib/Hydra/Schema/Builds.pm +++ b/src/Hydra/lib/Hydra/Schema/Builds.pm @@ -70,8 +70,8 @@ __PACKAGE__->has_many( ); -# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-25 18:59:54 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:1fnKUzCj0eAt4HWx0UB3SA +# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-25 19:24:09 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:u9AGxpJIQFY0RAILvnaIKA __PACKAGE__->has_many(dependents => 'Hydra::Schema::Buildinputs', 'dependency'); diff --git a/src/Hydra/lib/Hydra/Schema/Buildschedulinginfo.pm b/src/Hydra/lib/Hydra/Schema/Buildschedulinginfo.pm index 6689bdb1..a7a3571f 100644 --- a/src/Hydra/lib/Hydra/Schema/Buildschedulinginfo.pm +++ b/src/Hydra/lib/Hydra/Schema/Buildschedulinginfo.pm @@ -23,8 +23,8 @@ __PACKAGE__->set_primary_key("id"); __PACKAGE__->belongs_to("id", "Hydra::Schema::Builds", { id => "id" }); -# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-25 18:59:54 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:+a/kUdHtdjxdAOBSWdUsVA +# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-25 19:24:09 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:cqaeltO0pjpVPv2Ah54SQg # You can replace this text with custom content, and it will be preserved on regeneration diff --git a/src/Hydra/lib/Hydra/Schema/Buildsteps.pm b/src/Hydra/lib/Hydra/Schema/Buildsteps.pm index 29804812..054db79d 100644 --- a/src/Hydra/lib/Hydra/Schema/Buildsteps.pm +++ b/src/Hydra/lib/Hydra/Schema/Buildsteps.pm @@ -35,8 +35,8 @@ __PACKAGE__->set_primary_key("id", "stepnr"); __PACKAGE__->belongs_to("id", "Hydra::Schema::Builds", { id => "id" }); -# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-25 18:59:54 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:FYosIfp2O9OAolXdzalK+Q +# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-25 19:24:09 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:dJac1j1n7A2sQBrfgdLdYg # You can replace this text with custom content, and it will be preserved on regeneration diff --git a/src/Hydra/lib/Hydra/Schema/Cachedpathinputs.pm b/src/Hydra/lib/Hydra/Schema/Cachedpathinputs.pm index 39793c4a..cf14989e 100644 --- a/src/Hydra/lib/Hydra/Schema/Cachedpathinputs.pm +++ b/src/Hydra/lib/Hydra/Schema/Cachedpathinputs.pm @@ -22,8 +22,8 @@ __PACKAGE__->add_columns( __PACKAGE__->set_primary_key("srcpath", "sha256hash"); -# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-25 18:59:54 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:KhMAz8E3CDxG2D+zleQEFw +# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-25 19:24:09 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:5sHH9qbQ5WtUf2oRjXbwuw # You can replace this text with custom content, and it will be preserved on regeneration diff --git a/src/Hydra/lib/Hydra/Schema/Cachedsubversioninputs.pm b/src/Hydra/lib/Hydra/Schema/Cachedsubversioninputs.pm index ad071a4a..bc15f163 100644 --- a/src/Hydra/lib/Hydra/Schema/Cachedsubversioninputs.pm +++ b/src/Hydra/lib/Hydra/Schema/Cachedsubversioninputs.pm @@ -20,8 +20,8 @@ __PACKAGE__->add_columns( __PACKAGE__->set_primary_key("uri", "revision"); -# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-25 18:59:54 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:S62F6Z2wPT/+NoIApQcBmQ +# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-25 19:24:09 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:k1xO/rt0fxTjvtkPY/Jwfw # You can replace this text with custom content, and it will be preserved on regeneration diff --git a/src/Hydra/lib/Hydra/Schema/Jobsetinputalts.pm b/src/Hydra/lib/Hydra/Schema/Jobsetinputalts.pm index 9e7b648d..8f32fdd4 100644 --- a/src/Hydra/lib/Hydra/Schema/Jobsetinputalts.pm +++ b/src/Hydra/lib/Hydra/Schema/Jobsetinputalts.pm @@ -31,8 +31,8 @@ __PACKAGE__->belongs_to( ); -# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-25 18:59:54 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:6N8dRzQi9IYgP5F2rbDtWg +# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-25 19:24:09 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:B8hAt4GezVJ1/uo4ZQ3Q2g # You can replace this text with custom content, and it will be preserved on regeneration diff --git a/src/Hydra/lib/Hydra/Schema/Jobsetinputs.pm b/src/Hydra/lib/Hydra/Schema/Jobsetinputs.pm index 4468282e..2ae7dd6b 100644 --- a/src/Hydra/lib/Hydra/Schema/Jobsetinputs.pm +++ b/src/Hydra/lib/Hydra/Schema/Jobsetinputs.pm @@ -43,8 +43,8 @@ __PACKAGE__->has_many( ); -# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-25 18:59:54 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:QeB1Zh2L3q81y5j+fLcazw +# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-25 19:24:09 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:4ev1n8miWroPWPRoQBc0cA # You can replace this text with custom content, and it will be preserved on regeneration diff --git a/src/Hydra/lib/Hydra/Schema/Jobsets.pm b/src/Hydra/lib/Hydra/Schema/Jobsets.pm index b8ffe740..d932cf0e 100644 --- a/src/Hydra/lib/Hydra/Schema/Jobsets.pm +++ b/src/Hydra/lib/Hydra/Schema/Jobsets.pm @@ -48,8 +48,8 @@ __PACKAGE__->has_many( ); -# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-25 18:59:54 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:6aZCPgci+SLJuoGHcR3boA +# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-25 19:24:09 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:7kRl30K427lecYirFGBxew # You can replace this text with custom content, and it will be preserved on regeneration diff --git a/src/Hydra/lib/Hydra/Schema/Projects.pm b/src/Hydra/lib/Hydra/Schema/Projects.pm index 90ac9085..7f6ed3c3 100644 --- a/src/Hydra/lib/Hydra/Schema/Projects.pm +++ b/src/Hydra/lib/Hydra/Schema/Projects.pm @@ -30,8 +30,8 @@ __PACKAGE__->has_many( ); -# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-25 18:59:54 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:meEhwhiWsywgQlrkwOz48A +# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-25 19:24:09 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:ZBkLod0Yw87pgQGAEuk7Zg # You can replace this text with custom content, and it will be preserved on regeneration diff --git a/src/Hydra/programs/Scheduler.pl b/src/Hydra/programs/Scheduler.pl index e85bb6e7..b2b267a0 100644 --- a/src/Hydra/programs/Scheduler.pl +++ b/src/Hydra/programs/Scheduler.pl @@ -162,6 +162,11 @@ sub fetchInput { $$inputInfo{$input->name} = {type => $type, value => $alt->value}; } + elsif ($type eq "boolean") { + die unless defined $alt->value && ($alt->value eq "true" || $alt->value eq "false"); + $$inputInfo{$input->name} = {type => $type, value => $alt->value}; + } + else { die "input `" . $input->name . "' has unknown type `$type'"; } @@ -285,8 +290,10 @@ sub checkJobAlternatives { push @newArgs, "--arg", $argName, "{path = builtins.storePath " . $inputInfo->{$argName}->{storePath} . ";" . " rev = \"" . $inputInfo->{$argName}->{revision} . "\";}"; - } elsif (defined $inputInfo->{$argName}->{value}) { + } elsif ($inputInfo->{$argName}->{type} eq "string") { push @newArgs, "--argstr", $argName, $inputInfo->{$argName}->{value}; + } elsif ($inputInfo->{$argName}->{type} eq "boolean") { + push @newArgs, "--arg", $argName, $inputInfo->{$argName}->{value}; } checkJobAlternatives( $project, $jobset, $inputInfo, $nixExprPath, @@ -382,7 +389,10 @@ sub checkJobSet { $project, $jobset, {}, $nixExprPath, $jobName, $jobExpr, [], \@argsNeeded, 0); }; - warn $@ if $@; + if ($@) { + print "error checking job ", $jobName, ": $@"; + setJobsetError($jobset, $@); + } } } diff --git a/src/Hydra/root/build.tt b/src/Hydra/root/build.tt index bd4ec5a5..d094591b 100644 --- a/src/Hydra/root/build.tt +++ b/src/Hydra/root/build.tt @@ -145,7 +145,7 @@ [% IF input.type == "build" %] Job [% input.dependency.project.name %]:[% input.dependency.attrname %] build [% input.dependency.id %] - [% ELSIF input.type == "string" %] + [% ELSIF input.type == "string" || input.type == "boolean" %] "[% input.value %]" [% ELSE %] [% input.uri %] diff --git a/src/Hydra/root/common.tt b/src/Hydra/root/common.tt index a47753a5..16eaa8a4 100644 --- a/src/Hydra/root/common.tt +++ b/src/Hydra/root/common.tt @@ -3,6 +3,7 @@ , "cvs" = "CVS checkout" , "tarball" = "Download of a tarball" , "string" = "String value" + , "boolean" = "Boolean" , "path" = "Local path" , "build" = "Build output" } diff --git a/src/Hydra/root/project.tt b/src/Hydra/root/project.tt index 2798b630..7716232b 100644 --- a/src/Hydra/root/project.tt +++ b/src/Hydra/root/project.tt @@ -26,9 +26,13 @@ [% BLOCK renderInputAlt %] - [% IF edit %][% END -%] - [% INCLUDE maybeEditString param=param value=alt.value %] - [% IF edit %]
[% END %] + [% IF edit %] + + [% INCLUDE maybeEditString param=param value=alt.value %] +
+ [% ELSE %] + [% INCLUDE maybeEditString param=param value=alt.value %] + [% END %] [% END %] diff --git a/src/hydra.sql b/src/hydra.sql index 67ee3e90..cd52eb9c 100644 --- a/src/hydra.sql +++ b/src/hydra.sql @@ -193,7 +193,7 @@ create table JobsetInputs ( project text not null, jobset text not null, name text not null, - type text not null, -- "svn", "cvs", "path", "uri", "string" + type text not null, -- "svn", "cvs", "path", "uri", "string", "boolean" primary key (project, jobset, name), foreign key (project, jobset) references Jobsets(project, name) on delete cascade -- ignored by sqlite );