* Boolean inputs.

This commit is contained in:
Eelco Dolstra 2008-11-25 18:34:24 +00:00
parent 1698e490d0
commit c72f4dd67a
19 changed files with 53 additions and 35 deletions

View file

@ -134,7 +134,7 @@ sub updateProject {
my $inputType = trim $c->request->params->{"jobset-$baseName-input-$baseName2-type"}; my $inputType = trim $c->request->params->{"jobset-$baseName-input-$baseName2-type"};
die "Invalid input type: $inputType" unless die "Invalid input type: $inputType" unless
$inputType eq "svn" || $inputType eq "cvs" || $inputType eq "tarball" || $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; $inputNames{$inputName} = 1;
@ -161,7 +161,10 @@ sub updateProject {
my $altnr = 0; my $altnr = 0;
foreach my $value (@{$values}) { foreach my $value (@{$values}) {
print STDERR "VALUE: $value\n"; 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});
} }
} }

View file

@ -8,8 +8,8 @@ use base 'DBIx::Class::Schema';
__PACKAGE__->load_classes; __PACKAGE__->load_classes;
# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-25 18:59:54 # Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-25 19:24:09
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:woBkuPRoV3DnJmHdcZ2ZIg # 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 # You can replace this text with custom content, and it will be preserved on regeneration

View file

@ -36,8 +36,8 @@ __PACKAGE__->belongs_to("build", "Hydra::Schema::Builds", { id => "build" });
__PACKAGE__->belongs_to("dependency", "Hydra::Schema::Builds", { id => "dependency" }); __PACKAGE__->belongs_to("dependency", "Hydra::Schema::Builds", { id => "dependency" });
# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-25 18:59:54 # Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-25 19:24:09
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:Mwn4Pp+vduPrAU9s089pAg # 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 # You can replace this text with custom content, and it will be preserved on regeneration

View file

@ -33,8 +33,8 @@ __PACKAGE__->set_primary_key("build", "productnr");
__PACKAGE__->belongs_to("build", "Hydra::Schema::Builds", { id => "build" }); __PACKAGE__->belongs_to("build", "Hydra::Schema::Builds", { id => "build" });
# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-25 18:59:54 # Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-25 19:24:09
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:kzQauEWWXur6WilY/1LcfA # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:gmWXPz3CSN4WOUTrcxXzQw
# You can replace this text with custom content, and it will be preserved on regeneration # You can replace this text with custom content, and it will be preserved on regeneration

View file

@ -29,8 +29,8 @@ __PACKAGE__->set_primary_key("id");
__PACKAGE__->belongs_to("id", "Hydra::Schema::Builds", { id => "id" }); __PACKAGE__->belongs_to("id", "Hydra::Schema::Builds", { id => "id" });
# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-25 18:59:54 # Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-25 19:24:09
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:85sz3phT3arumqXladRtMQ # 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 # You can replace this text with custom content, and it will be preserved on regeneration

View file

@ -70,8 +70,8 @@ __PACKAGE__->has_many(
); );
# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-25 18:59:54 # Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-25 19:24:09
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:1fnKUzCj0eAt4HWx0UB3SA # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:u9AGxpJIQFY0RAILvnaIKA
__PACKAGE__->has_many(dependents => 'Hydra::Schema::Buildinputs', 'dependency'); __PACKAGE__->has_many(dependents => 'Hydra::Schema::Buildinputs', 'dependency');

View file

@ -23,8 +23,8 @@ __PACKAGE__->set_primary_key("id");
__PACKAGE__->belongs_to("id", "Hydra::Schema::Builds", { id => "id" }); __PACKAGE__->belongs_to("id", "Hydra::Schema::Builds", { id => "id" });
# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-25 18:59:54 # Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-25 19:24:09
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:+a/kUdHtdjxdAOBSWdUsVA # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:cqaeltO0pjpVPv2Ah54SQg
# You can replace this text with custom content, and it will be preserved on regeneration # You can replace this text with custom content, and it will be preserved on regeneration

View file

@ -35,8 +35,8 @@ __PACKAGE__->set_primary_key("id", "stepnr");
__PACKAGE__->belongs_to("id", "Hydra::Schema::Builds", { id => "id" }); __PACKAGE__->belongs_to("id", "Hydra::Schema::Builds", { id => "id" });
# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-25 18:59:54 # Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-25 19:24:09
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:FYosIfp2O9OAolXdzalK+Q # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:dJac1j1n7A2sQBrfgdLdYg
# You can replace this text with custom content, and it will be preserved on regeneration # You can replace this text with custom content, and it will be preserved on regeneration

View file

@ -22,8 +22,8 @@ __PACKAGE__->add_columns(
__PACKAGE__->set_primary_key("srcpath", "sha256hash"); __PACKAGE__->set_primary_key("srcpath", "sha256hash");
# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-25 18:59:54 # Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-25 19:24:09
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:KhMAz8E3CDxG2D+zleQEFw # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:5sHH9qbQ5WtUf2oRjXbwuw
# You can replace this text with custom content, and it will be preserved on regeneration # You can replace this text with custom content, and it will be preserved on regeneration

View file

@ -20,8 +20,8 @@ __PACKAGE__->add_columns(
__PACKAGE__->set_primary_key("uri", "revision"); __PACKAGE__->set_primary_key("uri", "revision");
# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-25 18:59:54 # Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-25 19:24:09
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:S62F6Z2wPT/+NoIApQcBmQ # 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 # You can replace this text with custom content, and it will be preserved on regeneration

View file

@ -31,8 +31,8 @@ __PACKAGE__->belongs_to(
); );
# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-25 18:59:54 # Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-25 19:24:09
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:6N8dRzQi9IYgP5F2rbDtWg # 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 # You can replace this text with custom content, and it will be preserved on regeneration

View file

@ -43,8 +43,8 @@ __PACKAGE__->has_many(
); );
# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-25 18:59:54 # Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-25 19:24:09
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:QeB1Zh2L3q81y5j+fLcazw # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:4ev1n8miWroPWPRoQBc0cA
# You can replace this text with custom content, and it will be preserved on regeneration # You can replace this text with custom content, and it will be preserved on regeneration

View file

@ -48,8 +48,8 @@ __PACKAGE__->has_many(
); );
# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-25 18:59:54 # Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-25 19:24:09
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:6aZCPgci+SLJuoGHcR3boA # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:7kRl30K427lecYirFGBxew
# You can replace this text with custom content, and it will be preserved on regeneration # You can replace this text with custom content, and it will be preserved on regeneration

View file

@ -30,8 +30,8 @@ __PACKAGE__->has_many(
); );
# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-25 18:59:54 # Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-25 19:24:09
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:meEhwhiWsywgQlrkwOz48A # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:ZBkLod0Yw87pgQGAEuk7Zg
# You can replace this text with custom content, and it will be preserved on regeneration # You can replace this text with custom content, and it will be preserved on regeneration

View file

@ -162,6 +162,11 @@ sub fetchInput {
$$inputInfo{$input->name} = {type => $type, value => $alt->value}; $$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 { else {
die "input `" . $input->name . "' has unknown type `$type'"; die "input `" . $input->name . "' has unknown type `$type'";
} }
@ -285,8 +290,10 @@ sub checkJobAlternatives {
push @newArgs, "--arg", $argName, push @newArgs, "--arg", $argName,
"{path = builtins.storePath " . $inputInfo->{$argName}->{storePath} . ";" . "{path = builtins.storePath " . $inputInfo->{$argName}->{storePath} . ";" .
" rev = \"" . $inputInfo->{$argName}->{revision} . "\";}"; " rev = \"" . $inputInfo->{$argName}->{revision} . "\";}";
} elsif (defined $inputInfo->{$argName}->{value}) { } elsif ($inputInfo->{$argName}->{type} eq "string") {
push @newArgs, "--argstr", $argName, $inputInfo->{$argName}->{value}; push @newArgs, "--argstr", $argName, $inputInfo->{$argName}->{value};
} elsif ($inputInfo->{$argName}->{type} eq "boolean") {
push @newArgs, "--arg", $argName, $inputInfo->{$argName}->{value};
} }
checkJobAlternatives( checkJobAlternatives(
$project, $jobset, $inputInfo, $nixExprPath, $project, $jobset, $inputInfo, $nixExprPath,
@ -382,7 +389,10 @@ sub checkJobSet {
$project, $jobset, {}, $nixExprPath, $project, $jobset, {}, $nixExprPath,
$jobName, $jobExpr, [], \@argsNeeded, 0); $jobName, $jobExpr, [], \@argsNeeded, 0);
}; };
warn $@ if $@; if ($@) {
print "error checking job ", $jobName, ": $@";
setJobsetError($jobset, $@);
}
} }
} }

View file

@ -145,7 +145,7 @@
<td> <td>
[% IF input.type == "build" %] [% IF input.type == "build" %]
<a href="[% c.uri_for('/build' input.dependency.id) %]">Job <tt>[% input.dependency.project.name %]:[% input.dependency.attrname %]</tt> build [% input.dependency.id %]</a> <a href="[% c.uri_for('/build' input.dependency.id) %]">Job <tt>[% input.dependency.project.name %]:[% input.dependency.attrname %]</tt> build [% input.dependency.id %]</a>
[% ELSIF input.type == "string" %] [% ELSIF input.type == "string" || input.type == "boolean" %]
<tt>"[% input.value %]"</tt> <tt>"[% input.value %]"</tt>
[% ELSE %] [% ELSE %]
<tt>[% input.uri %]</tt> <tt>[% input.uri %]</tt>

View file

@ -3,6 +3,7 @@
, "cvs" = "CVS checkout" , "cvs" = "CVS checkout"
, "tarball" = "Download of a tarball" , "tarball" = "Download of a tarball"
, "string" = "String value" , "string" = "String value"
, "boolean" = "Boolean"
, "path" = "Local path" , "path" = "Local path"
, "build" = "Build output" , "build" = "Build output"
} }

View file

@ -26,9 +26,13 @@
[% BLOCK renderInputAlt %] [% BLOCK renderInputAlt %]
[% IF edit %]<button type="button" onclick='$(this).parents(".inputalt").remove()'><img src="/static/images/failure.gif" alt="Delete value" /></button>[% END -%] [% IF edit %]
[% INCLUDE maybeEditString param=param value=alt.value %] <button type="button" onclick='$(this).parents(".inputalt").remove()'><img src="/static/images/failure.gif" alt="Delete value" /></button>
[% IF edit %]<br />[% END %] [% INCLUDE maybeEditString param=param value=alt.value %]
<br />
[% ELSE %]
[% INCLUDE maybeEditString param=param value=alt.value %]
[% END %]
[% END %] [% END %]

View file

@ -193,7 +193,7 @@ create table JobsetInputs (
project text not null, project text not null,
jobset text not null, jobset text not null,
name 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), primary key (project, jobset, name),
foreign key (project, jobset) references Jobsets(project, name) on delete cascade -- ignored by sqlite foreign key (project, jobset) references Jobsets(project, name) on delete cascade -- ignored by sqlite
); );