diff --git a/src/lib/Hydra/Controller/Job.pm b/src/lib/Hydra/Controller/Job.pm index 15f21b3c..fb1fadf2 100644 --- a/src/lib/Hydra/Controller/Job.pm +++ b/src/lib/Hydra/Controller/Job.pm @@ -26,7 +26,7 @@ sub index : Chained('job') PathPart('') Args(0) { sub get_builds : Chained('job') PathPart('') CaptureArgs(0) { my ($self, $c) = @_; $c->stash->{allBuilds} = - $c->stash->{curProject}->builds->search({attrName => $c->stash->{jobName}}); + $c->stash->{curProject}->builds->search({job => $c->stash->{jobName}}); $c->stash->{channelBaseName} = $c->stash->{curProject}->name . "-" . $c->stash->{jobName}; } diff --git a/src/lib/Hydra/Helper/CatalystUtils.pm b/src/lib/Hydra/Helper/CatalystUtils.pm index 78170922..2b2b4f0b 100644 --- a/src/lib/Hydra/Helper/CatalystUtils.pm +++ b/src/lib/Hydra/Helper/CatalystUtils.pm @@ -49,13 +49,13 @@ sub getLatestBuilds { my @res = (); - foreach my $job ($builds->search({}, - {group_by => ['project', 'attrname', 'system']})) + foreach my $build ($builds->search({}, + {group_by => ['project', 'job', 'system']})) { my $attrs = - { project => $job->get_column('project') - , attrname => $job->attrname - , system => $job->system + { project => $build->get_column('project') + , job => $build->job + , system => $build->system , finished => 1 }; my ($build) = $builds->search({ %$attrs, %$extraAttrs }, diff --git a/src/lib/Hydra/Helper/Nix.pm b/src/lib/Hydra/Helper/Nix.pm index 6f65e2f5..4f83ba10 100644 --- a/src/lib/Hydra/Helper/Nix.pm +++ b/src/lib/Hydra/Helper/Nix.pm @@ -124,7 +124,7 @@ sub attrsToSQL { sub getPrimaryBuildsForReleaseSet { my ($project, $primaryJob) = @_; my @primaryBuilds = $project->builds->search( - { attrname => $primaryJob->job, finished => 1 }, + { job => $primaryJob->job, finished => 1 }, { join => 'resultInfo', order_by => "timestamp DESC" , '+select' => ["resultInfo.releasename"], '+as' => ["releasename"] , where => \ attrsToSQL($primaryJob->attrs, "me.id") @@ -154,7 +154,7 @@ sub getRelease { # as input. If there are multiple, prefer successful # ones, and then oldest. !!! order_by buildstatus is hacky ($thisBuild) = $primaryBuild->dependentBuilds->search( - { attrname => $job->job, finished => 1 }, + { job => $job->job, finished => 1 }, { join => 'resultInfo', rows => 1 , order_by => ["buildstatus", "timestamp"] , where => \ attrsToSQL($job->attrs, "build.id") diff --git a/src/lib/Hydra/Schema.pm b/src/lib/Hydra/Schema.pm index 226ded24..51c037ce 100644 --- a/src/lib/Hydra/Schema.pm +++ b/src/lib/Hydra/Schema.pm @@ -8,8 +8,8 @@ use base 'DBIx::Class::Schema'; __PACKAGE__->load_classes; -# Created by DBIx::Class::Schema::Loader v0.04005 @ 2009-03-12 14:17:32 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:bK7m5SJjCnJKOckiufcb9w +# Created by DBIx::Class::Schema::Loader v0.04005 @ 2009-03-12 14:55:11 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:oeLeU2T8C2dVBS+ugF0p8g # You can replace this text with custom content, and it will be preserved on regeneration diff --git a/src/lib/Hydra/Schema/BuildInputs.pm b/src/lib/Hydra/Schema/BuildInputs.pm index dd4a59ad..70f14611 100644 --- a/src/lib/Hydra/Schema/BuildInputs.pm +++ b/src/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 @ 2009-03-12 14:17:32 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:11XN47b5bRrRKiWtzLO+Pw +# Created by DBIx::Class::Schema::Loader v0.04005 @ 2009-03-12 14:55:11 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:CLL7aeJ0fe0NX3LCnNs4/A # You can replace this text with custom content, and it will be preserved on regeneration diff --git a/src/lib/Hydra/Schema/BuildProducts.pm b/src/lib/Hydra/Schema/BuildProducts.pm index ff5ea0c4..14681c90 100644 --- a/src/lib/Hydra/Schema/BuildProducts.pm +++ b/src/lib/Hydra/Schema/BuildProducts.pm @@ -35,8 +35,8 @@ __PACKAGE__->set_primary_key("build", "productnr"); __PACKAGE__->belongs_to("build", "Hydra::Schema::Builds", { id => "build" }); -# Created by DBIx::Class::Schema::Loader v0.04005 @ 2009-03-12 14:17:32 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:gUnxXuaqq40KFRIUSBmVuA +# Created by DBIx::Class::Schema::Loader v0.04005 @ 2009-03-12 14:55:11 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:9Eer/gLCKlOKfnwC+kfFaw # You can replace this text with custom content, and it will be preserved on regeneration diff --git a/src/lib/Hydra/Schema/BuildResultInfo.pm b/src/lib/Hydra/Schema/BuildResultInfo.pm index 3e4e240f..5d84cca2 100644 --- a/src/lib/Hydra/Schema/BuildResultInfo.pm +++ b/src/lib/Hydra/Schema/BuildResultInfo.pm @@ -35,13 +35,13 @@ __PACKAGE__->set_primary_key("id"); __PACKAGE__->belongs_to("id", "Hydra::Schema::Builds", { id => "id" }); -# Created by DBIx::Class::Schema::Loader v0.04005 @ 2009-03-12 14:17:32 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:xvSDu+FkyKp5wTAEGmiKOw +# Created by DBIx::Class::Schema::Loader v0.04005 @ 2009-03-12 14:55:11 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:ieF3JOI4N3XZUyMboZhrjg __PACKAGE__->belongs_to( "failedDep", "Hydra::Schema::BuildSteps", - { id => "faileddepbuild", stepnr => "faileddepstepnr" }, + { build => "faileddepbuild", stepnr => "faileddepstepnr" }, ); 1; diff --git a/src/lib/Hydra/Schema/BuildSchedulingInfo.pm b/src/lib/Hydra/Schema/BuildSchedulingInfo.pm index 851c6144..00b41134 100644 --- a/src/lib/Hydra/Schema/BuildSchedulingInfo.pm +++ b/src/lib/Hydra/Schema/BuildSchedulingInfo.pm @@ -27,8 +27,8 @@ __PACKAGE__->set_primary_key("id"); __PACKAGE__->belongs_to("id", "Hydra::Schema::Builds", { id => "id" }); -# Created by DBIx::Class::Schema::Loader v0.04005 @ 2009-03-12 14:17:32 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:xv5P0Erv5oEy4r3c9RuV0w +# Created by DBIx::Class::Schema::Loader v0.04005 @ 2009-03-12 14:55:11 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:oomDjaTJHIQjraUqhzFPsg # You can replace this text with custom content, and it will be preserved on regeneration diff --git a/src/lib/Hydra/Schema/BuildSteps.pm b/src/lib/Hydra/Schema/BuildSteps.pm index 4294d301..bd3ec11f 100644 --- a/src/lib/Hydra/Schema/BuildSteps.pm +++ b/src/lib/Hydra/Schema/BuildSteps.pm @@ -8,7 +8,7 @@ use base 'DBIx::Class'; __PACKAGE__->load_components("Core"); __PACKAGE__->table("BuildSteps"); __PACKAGE__->add_columns( - "id", + "build", { data_type => "integer", is_nullable => 0, size => undef }, "stepnr", { data_type => "integer", is_nullable => 0, size => undef }, @@ -31,11 +31,11 @@ __PACKAGE__->add_columns( "stoptime", { data_type => "integer", is_nullable => 0, size => undef }, ); -__PACKAGE__->set_primary_key("id", "stepnr"); -__PACKAGE__->belongs_to("id", "Hydra::Schema::Builds", { id => "id" }); +__PACKAGE__->set_primary_key("build", "stepnr"); +__PACKAGE__->belongs_to("build", "Hydra::Schema::Builds", { id => "build" }); -# Created by DBIx::Class::Schema::Loader v0.04005 @ 2009-03-12 14:17:32 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:Ne+uSrfxnk+wK60IrVoTww +# Created by DBIx::Class::Schema::Loader v0.04005 @ 2009-03-12 14:55:11 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:+nb1zsYcv9WziZ6IHcc/yw 1; diff --git a/src/lib/Hydra/Schema/Builds.pm b/src/lib/Hydra/Schema/Builds.pm index ef0a4e38..217c0878 100644 --- a/src/lib/Hydra/Schema/Builds.pm +++ b/src/lib/Hydra/Schema/Builds.pm @@ -18,7 +18,7 @@ __PACKAGE__->add_columns( { data_type => "text", is_nullable => 0, size => undef }, "jobset", { data_type => "text", is_nullable => 0, size => undef }, - "attrname", + "job", { data_type => "text", is_nullable => 0, size => undef }, "nixname", { data_type => "text", is_nullable => 0, size => undef }, @@ -57,7 +57,7 @@ __PACKAGE__->has_many( __PACKAGE__->has_many( "buildsteps", "Hydra::Schema::BuildSteps", - { "foreign.id" => "self.id" }, + { "foreign.build" => "self.id" }, ); __PACKAGE__->has_many( "buildinputs_builds", @@ -76,8 +76,8 @@ __PACKAGE__->has_many( ); -# Created by DBIx::Class::Schema::Loader v0.04005 @ 2009-03-12 14:17:32 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:iwt05CKHqfd33lW+wAC2mw +# Created by DBIx::Class::Schema::Loader v0.04005 @ 2009-03-12 14:55:11 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:UahvxjBmn7b70IK+QcnKHA __PACKAGE__->has_many(dependents => 'Hydra::Schema::BuildInputs', 'dependency'); diff --git a/src/lib/Hydra/Schema/CachedPathInputs.pm b/src/lib/Hydra/Schema/CachedPathInputs.pm index 5c981d47..79a9754a 100644 --- a/src/lib/Hydra/Schema/CachedPathInputs.pm +++ b/src/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 @ 2009-03-12 14:17:32 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:Hjklk18AGqKd7dDPUlqS9A +# Created by DBIx::Class::Schema::Loader v0.04005 @ 2009-03-12 14:55:11 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:+AZEuCFAfkl7SKwlxDBnaw # You can replace this text with custom content, and it will be preserved on regeneration diff --git a/src/lib/Hydra/Schema/CachedSubversionInputs.pm b/src/lib/Hydra/Schema/CachedSubversionInputs.pm index 7a5095a2..f19a0d8d 100644 --- a/src/lib/Hydra/Schema/CachedSubversionInputs.pm +++ b/src/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 @ 2009-03-12 14:17:32 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:OMt7YCEd4Vc3edHp2fxcrw +# Created by DBIx::Class::Schema::Loader v0.04005 @ 2009-03-12 14:55:11 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:2JtWOkH5OVGl7Cb7STLM5Q # You can replace this text with custom content, and it will be preserved on regeneration diff --git a/src/lib/Hydra/Schema/JobsetInputAlts.pm b/src/lib/Hydra/Schema/JobsetInputAlts.pm index 6755b253..b38057fa 100644 --- a/src/lib/Hydra/Schema/JobsetInputAlts.pm +++ b/src/lib/Hydra/Schema/JobsetInputAlts.pm @@ -31,8 +31,8 @@ __PACKAGE__->belongs_to( ); -# Created by DBIx::Class::Schema::Loader v0.04005 @ 2009-03-12 14:17:32 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:gQOuvSuoR2kczD57yaVSwQ +# Created by DBIx::Class::Schema::Loader v0.04005 @ 2009-03-12 14:55:11 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:ka/dxG48LaZOQeShZFs0Hw # You can replace this text with custom content, and it will be preserved on regeneration diff --git a/src/lib/Hydra/Schema/JobsetInputs.pm b/src/lib/Hydra/Schema/JobsetInputs.pm index 1cc0396d..dc3fb113 100644 --- a/src/lib/Hydra/Schema/JobsetInputs.pm +++ b/src/lib/Hydra/Schema/JobsetInputs.pm @@ -43,8 +43,8 @@ __PACKAGE__->has_many( ); -# Created by DBIx::Class::Schema::Loader v0.04005 @ 2009-03-12 14:17:32 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:GpIp3ENzylBZ9HQUNhO17Q +# Created by DBIx::Class::Schema::Loader v0.04005 @ 2009-03-12 14:55:11 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:earsp0XPWppy5/VOJkQ/PA # You can replace this text with custom content, and it will be preserved on regeneration diff --git a/src/lib/Hydra/Schema/Jobsets.pm b/src/lib/Hydra/Schema/Jobsets.pm index 5ed1fb07..84af627c 100644 --- a/src/lib/Hydra/Schema/Jobsets.pm +++ b/src/lib/Hydra/Schema/Jobsets.pm @@ -50,8 +50,8 @@ __PACKAGE__->has_many( ); -# Created by DBIx::Class::Schema::Loader v0.04005 @ 2009-03-12 14:17:32 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:BcAloJiRDPMvL/+GqsPiTw +# Created by DBIx::Class::Schema::Loader v0.04005 @ 2009-03-12 14:55:11 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:ADLNgkS2YPv4DuszwHau7g # You can replace this text with custom content, and it will be preserved on regeneration diff --git a/src/lib/Hydra/Schema/Projects.pm b/src/lib/Hydra/Schema/Projects.pm index 025595e5..984f3d89 100644 --- a/src/lib/Hydra/Schema/Projects.pm +++ b/src/lib/Hydra/Schema/Projects.pm @@ -45,8 +45,8 @@ __PACKAGE__->has_many( ); -# Created by DBIx::Class::Schema::Loader v0.04005 @ 2009-03-12 14:17:32 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:TTHljyVTOMxXzNATXkltNg +# Created by DBIx::Class::Schema::Loader v0.04005 @ 2009-03-12 14:55:11 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:R/GeZxDujiuKze++Mc2ZTw # You can replace this text with custom content, and it will be preserved on regeneration diff --git a/src/lib/Hydra/Schema/ReleaseSetJobs.pm b/src/lib/Hydra/Schema/ReleaseSetJobs.pm index 73d7bf51..db633df6 100644 --- a/src/lib/Hydra/Schema/ReleaseSetJobs.pm +++ b/src/lib/Hydra/Schema/ReleaseSetJobs.pm @@ -22,6 +22,8 @@ __PACKAGE__->add_columns( { data_type => "integer", is_nullable => 0, size => undef }, "description", { data_type => "text", is_nullable => 0, size => undef }, + "jobset", + { data_type => "text", is_nullable => 0, size => undef }, ); __PACKAGE__->set_primary_key("project", "release_", "job", "attrs"); __PACKAGE__->belongs_to("project", "Hydra::Schema::Projects", { name => "project" }); @@ -32,8 +34,8 @@ __PACKAGE__->belongs_to( ); -# Created by DBIx::Class::Schema::Loader v0.04005 @ 2009-03-12 14:17:32 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:YC+cgQcuvO4TxC5UpU7u4A +# Created by DBIx::Class::Schema::Loader v0.04005 @ 2009-03-12 14:55:11 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:OM2joIa3Bj6t9BhVrOjN8Q # You can replace this text with custom content, and it will be preserved on regeneration diff --git a/src/lib/Hydra/Schema/ReleaseSets.pm b/src/lib/Hydra/Schema/ReleaseSets.pm index b3410e3f..bce5091d 100644 --- a/src/lib/Hydra/Schema/ReleaseSets.pm +++ b/src/lib/Hydra/Schema/ReleaseSets.pm @@ -29,8 +29,8 @@ __PACKAGE__->has_many( ); -# Created by DBIx::Class::Schema::Loader v0.04005 @ 2009-03-12 14:17:32 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:Sv+5cdtqHDjWM0Zmmu0PSg +# Created by DBIx::Class::Schema::Loader v0.04005 @ 2009-03-12 14:55:11 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:gSzri22yKGHLKCjNLv9/VQ # You can replace this text with custom content, and it will be preserved on regeneration diff --git a/src/lib/Hydra/Schema/SystemTypes.pm b/src/lib/Hydra/Schema/SystemTypes.pm index e51a3a16..7b9f2209 100644 --- a/src/lib/Hydra/Schema/SystemTypes.pm +++ b/src/lib/Hydra/Schema/SystemTypes.pm @@ -16,8 +16,8 @@ __PACKAGE__->add_columns( __PACKAGE__->set_primary_key("system"); -# Created by DBIx::Class::Schema::Loader v0.04005 @ 2009-03-12 14:17:32 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:RLOKTpEzFYJMyzgMCg7zSg +# Created by DBIx::Class::Schema::Loader v0.04005 @ 2009-03-12 14:55:11 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:viZlvDAHk9k8ScuA/qfUGw # You can replace this text with custom content, and it will be preserved on regeneration diff --git a/src/lib/Hydra/Schema/UserRoles.pm b/src/lib/Hydra/Schema/UserRoles.pm index c13480f5..26424248 100644 --- a/src/lib/Hydra/Schema/UserRoles.pm +++ b/src/lib/Hydra/Schema/UserRoles.pm @@ -17,8 +17,8 @@ __PACKAGE__->set_primary_key("username", "role"); __PACKAGE__->belongs_to("username", "Hydra::Schema::Users", { username => "username" }); -# Created by DBIx::Class::Schema::Loader v0.04005 @ 2009-03-12 14:17:32 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:QTXCy6SeSRYYXW3odCVLiQ +# Created by DBIx::Class::Schema::Loader v0.04005 @ 2009-03-12 14:55:11 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:gRuZJKELtc15+vQFjxjkKQ # You can replace this text with custom content, and it will be preserved on regeneration diff --git a/src/lib/Hydra/Schema/Users.pm b/src/lib/Hydra/Schema/Users.pm index cd2c167c..4ea4cee2 100644 --- a/src/lib/Hydra/Schema/Users.pm +++ b/src/lib/Hydra/Schema/Users.pm @@ -30,8 +30,8 @@ __PACKAGE__->has_many( ); -# Created by DBIx::Class::Schema::Loader v0.04005 @ 2009-03-12 14:17:32 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:eQFOcWRNwb7IE1ifGrw4rQ +# Created by DBIx::Class::Schema::Loader v0.04005 @ 2009-03-12 14:55:11 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:Lomf54EURbBIbrWGojiFIw # You can replace this text with custom content, and it will be preserved on regeneration diff --git a/src/root/build.tt b/src/root/build.tt index eac660de..a6e15e59 100644 --- a/src/root/build.tt +++ b/src/root/build.tt @@ -4,7 +4,7 @@ [% USE HTML %]

- Job [% build.project.name %]:[% build.attrname %] build [% id %] + Job [% build.project.name %]:[% build.job %] build [% id %] [% IF !build.finished %] [% IF build.schedulingInfo.busy %] (currently building) @@ -47,7 +47,7 @@ Failed Build inhibited because a dependency previously failed to build [% failedDep = build.resultInfo.failedDep %] - (namely, [% failedDep.outpath %]) + (namely, [% failedDep.outpath %]) [% ELSE %] Failed Build failed @@ -81,7 +81,7 @@ Job name: - [% build.attrname %] + [% build.job %] Nix name: @@ -187,7 +187,7 @@ [% type = input.type; inputTypes.$type %] [% IF input.type == "build" %] - Job [% input.dependency.project.name %]:[% input.dependency.attrname %] build [% input.dependency.id %] + Job [% input.dependency.project.name %]:[% input.dependency.job %] build [% input.dependency.id %] [% ELSIF input.type == "string" || input.type == "boolean" %] "[% input.value %]" [% ELSE %] @@ -298,7 +298,7 @@ [% FOREACH input IN build.dependents -%] - Job [% input.build.project.name %]:[% input.build.attrname %] build [% input.build.id %] + Job [% input.build.project.name %]:[% input.build.job %] build [% input.build.id %] [% input.name %] [% input.build.system %] [% PROCESS renderDateTime timestamp = input.build.timestamp %] diff --git a/src/root/common.tt b/src/root/common.tt index 84da9965..157d5a4c 100644 --- a/src/root/common.tt +++ b/src/root/common.tt @@ -61,7 +61,7 @@ [% build.schedulingInfo.priority %] [% END %] [% build.get_column("project") %] - [% build.attrname %] + [% build.job %] [% build.resultInfo.releasename ? build.resultInfo.releasename : build.nixname %] [% build.system %] [% date.format(build.timestamp, '%Y-%m-%d %H:%M:%S') %] diff --git a/src/root/log.tt b/src/root/log.tt index 83629a7c..d2e809ff 100644 --- a/src/root/log.tt +++ b/src/root/log.tt @@ -1,6 +1,6 @@ [% WRAPPER layout.tt title="Logfile" %] -

Logfile for [% build.project.name %]:[% build.attrname %] build [% build.id %][%IF step %], step [% step.stepnr %] ([% step.outpath %])[% END %]

+

Logfile for [% build.project.name %]:[% build.job %] build [% build.id %][%IF step %], step [% step.stepnr %] ([% step.outpath %])[% END %]

[% logtext -%] diff --git a/src/script/hydra_build.pl b/src/script/hydra_build.pl index 90041c0b..490e1352 100755 --- a/src/script/hydra_build.pl +++ b/src/script/hydra_build.pl @@ -58,7 +58,7 @@ sub doBuild { {outPath => $dep}, {rows => 1, order_by => "stopTime DESC", type => 0, busy => 0}); if ($step && $step->status != 0) { $buildStatus = 5; - $failedDepBuild = $step->id->id; + $failedDepBuild = $step->build->id; $failedDepStepNr = $step->stepnr; goto done; } @@ -91,9 +91,8 @@ sub doBuild { if (/^@\s+build-started\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)$/) { $db->txn_do(sub { - $db->resultset('BuildSteps')->create( - { id => $build->id - , stepnr => $buildStepNr++ + $build->buildsteps->create( + { stepnr => $buildStepNr++ , type => 0 # = build , drvpath => $1 , outpath => $2 @@ -107,8 +106,8 @@ sub doBuild { elsif (/^@\s+build-succeeded\s+(\S+)\s+(\S+)$/) { my $drvPath = $1; $db->txn_do(sub { - (my $step) = $db->resultset('BuildSteps')->search( - {id => $build->id, type => 0, drvpath => $drvPath}, {}); + (my $step) = $build->buildsteps->search( + {type => 0, drvpath => $drvPath}, {}); die unless $step; $step->update({busy => 0, status => 0, stoptime => time}); }); @@ -119,14 +118,13 @@ sub doBuild { $someBuildFailed = 1; $thisBuildFailed = 1 if $drvPath eq $drvPathStep; $db->txn_do(sub { - (my $step) = $db->resultset('BuildSteps')->search( - {id => $build->id, type => 0, drvpath => $drvPathStep}, {}); + (my $step) = $build->buildsteps->search( + {type => 0, drvpath => $drvPathStep}, {}); if ($step) { $step->update({busy => 0, status => 1, errormsg => $4, stoptime => time}); } else { - $db->resultset('BuildSteps')->create( - { id => $build->id - , stepnr => $buildStepNr++ + $build->buildsteps->create( + { stepnr => $buildStepNr++ , type => 0 # = build , drvpath => $drvPathStep , outpath => $2 @@ -144,9 +142,8 @@ sub doBuild { elsif (/^@\s+substituter-started\s+(\S+)\s+(\S+)$/) { my $outPath = $1; $db->txn_do(sub { - $db->resultset('BuildSteps')->create( - { id => $build->id - , stepnr => $buildStepNr++ + $build->buildsteps->create( + { stepnr => $buildStepNr++ , type => 1 # = substitution , outpath => $1 , busy => 1 @@ -158,8 +155,8 @@ sub doBuild { elsif (/^@\s+substituter-succeeded\s+(\S+)$/) { my $outPath = $1; $db->txn_do(sub { - (my $step) = $db->resultset('BuildSteps')->search( - {id => $build->id, type => 1, outpath => $outPath}, {}); + (my $step) = $build->buildsteps->search( + {type => 1, outpath => $outPath}, {}); die unless $step; $step->update({busy => 0, status => 0, stoptime => time}); }); @@ -168,8 +165,8 @@ sub doBuild { elsif (/^@\s+substituter-failed\s+(\S+)\s+(\S+)\s+(\S+)$/) { my $outPath = $1; $db->txn_do(sub { - (my $step) = $db->resultset('BuildSteps')->search( - {id => $build->id, type => 1, outpath => $outPath}, {}); + (my $step) = $build->buildsteps->search( + {type => 1, outpath => $outPath}, {}); die unless $step; $step->update({busy => 0, status => 1, errormsg => $3, stoptime => time}); }); diff --git a/src/script/hydra_queue_runner.pl b/src/script/hydra_queue_runner.pl index 24c03a76..0a3cec2d 100755 --- a/src/script/hydra_queue_runner.pl +++ b/src/script/hydra_queue_runner.pl @@ -106,7 +106,7 @@ sub checkBuilds { # outside the transaction in case it aborts or something. foreach my $build (@buildsStarted) { my $id = $build->id; - print "starting build $id (", $build->project->name, ":", $build->attrname, ") on ", $build->system, "\n"; + print "starting build $id (", $build->project->name, ":", $build->job, ") on ", $build->system, "\n"; eval { my $logfile = $build->schedulingInfo->logfile; my $child = fork(); @@ -134,6 +134,12 @@ sub checkBuilds { } +if (scalar(@ARGV) == 1 && $ARGV[0] eq "--unlock") { + unlockDeadBuilds; + exit 0; +} + + while (1) { eval { # Clean up zombies. diff --git a/src/script/hydra_scheduler.pl b/src/script/hydra_scheduler.pl index ff1e7f0d..75f51c5e 100755 --- a/src/script/hydra_scheduler.pl +++ b/src/script/hydra_scheduler.pl @@ -155,7 +155,7 @@ sub fetchInputAlt { # Pick the most recent successful build of the specified job. (my $prevBuild) = $db->resultset('Builds')->search( - {finished => 1, project => $project->name, jobset => $jobset->name, attrname => $jobName, buildStatus => 0}, + {finished => 1, project => $project->name, jobset => $jobset->name, job => $jobName, buildStatus => 0}, {join => 'resultInfo', order_by => "timestamp DESC", rows => 1}); if (!defined $prevBuild || !isValidPath($prevBuild->outpath)) { @@ -218,7 +218,7 @@ sub checkJob { $db->txn_do(sub { if (scalar($db->resultset('Builds')->search( { project => $project->name, jobset => $jobset->name - , attrname => $jobName, outPath => $outPath })) > 0) + , job => $jobName, outPath => $outPath })) > 0) { print "already scheduled/done\n"; return; @@ -231,7 +231,7 @@ sub checkJob { , timestamp => time() , project => $project->name , jobset => $jobset->name - , attrname => $jobName + , job => $jobName , description => $job->{description} , longdescription => $job->{longDescription} , license => $job->{license} diff --git a/src/script/hydra_update_gc_roots.pl b/src/script/hydra_update_gc_roots.pl index 5e91572d..2949a0c9 100755 --- a/src/script/hydra_update_gc_roots.pl +++ b/src/script/hydra_update_gc_roots.pl @@ -38,14 +38,14 @@ foreach my $project ($db->resultset('Projects')->all) { # Go over all jobs in this project. foreach my $job ($project->builds->search({}, - {select => [{distinct => 'attrname'}], as => ['attrname']})) + {select => [{distinct => 'job'}], as => ['job']})) { - print "*** looking for builds to keep in job ", $project->name, ":", $job->attrname, "\n"; + print "*** looking for builds to keep in job ", $project->name, ":", $job->job, "\n"; # Keep the N most recent successful builds for each job and # platform. my @recentBuilds = $project->builds->search( - { attrname => $job->attrname + { job => $job->job , finished => 1 , buildStatus => 0 # == success }, diff --git a/src/sql/hydra.sql b/src/sql/hydra.sql index ce8c7747..f3fdb855 100644 --- a/src/sql/hydra.sql +++ b/src/sql/hydra.sql @@ -11,9 +11,9 @@ create table Builds ( timestamp integer not null, -- time this build was scheduled / finished building -- Info about the inputs. - project text not null, -- !!! foreign key - jobset text not null, -- !!! foreign key - attrName text not null, + project text not null, + jobset text not null, + job text not null, -- Info about the build result. nixName text, -- name attribute of the derivation @@ -85,7 +85,7 @@ create table BuildResultInfo ( create table BuildSteps ( - id integer not null, -- !!! rename to "build" + build integer not null, stepnr integer not null, type integer not null, -- 0 = build, 1 = substitution @@ -104,8 +104,8 @@ create table BuildSteps ( startTime integer, stopTime integer, - primary key (id, stepnr), - foreign key (id) references Builds(id) on delete cascade -- ignored by sqlite + primary key (build, stepnr), + foreign key (build) references Builds(id) on delete cascade -- ignored by sqlite ); @@ -370,7 +370,10 @@ create table ReleaseSetJobs ( description text, + jobset text not null, + primary key (project, release_, job, attrs), foreign key (project) references Projects(name) on delete cascade, -- ignored by sqlite foreign key (project, release_) references ReleaseSets(project, name) on delete cascade -- ignored by sqlite + foreign key (project, jobset) references Jobsets(project, name) on delete restrict -- ignored by sqlite );