1
0
Fork 0
mirror of https://github.com/NixOS/hydra.git synced 2024-10-18 17:02:28 -04:00

* Add the name of the jobset to ReleaseSetJobs, otherwise we can't

distinguish between jobs with the same name in different jobsets
  (e.g. "trunk" vs "stdenv-branch" for Nixpkgs).
* Renamed the "attrName" field of Builds to "job".
* Renamed the "id" field of BuildSteps to "build".
This commit is contained in:
Eelco Dolstra 2009-03-12 14:18:30 +00:00
parent fec08462ee
commit a623ad157e
29 changed files with 96 additions and 88 deletions

View file

@ -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};
}

View file

@ -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 },

View file

@ -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")

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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;

View file

@ -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

View file

@ -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;

View file

@ -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');

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -4,7 +4,7 @@
[% USE HTML %]
<h1>
Job <tt>[% build.project.name %]:[% build.attrname %]</tt> build [% id %]
Job <tt>[% build.project.name %]:[% build.job %]</tt> build [% id %]
[% IF !build.finished %]
[% IF build.schedulingInfo.busy %]
(currently building)
@ -47,7 +47,7 @@
<img src="/static/images/failure.gif" alt="Failed" />
<span class="error">Build inhibited because a dependency previously failed to build</span>
[% failedDep = build.resultInfo.failedDep %]
(namely, <a href="[% c.uri_for('/build' failedDep.id.id 'nixlog' failedDep.stepnr) %]"><tt>[% failedDep.outpath %]</tt></a>)
(namely, <a href="[% c.uri_for('/build' failedDep.build.id 'nixlog' failedDep.stepnr) %]"><tt>[% failedDep.outpath %]</tt></a>)
[% ELSE %]
<img src="/static/images/failure.gif" alt="Failed" />
<span class="error">Build failed</span>
@ -81,7 +81,7 @@
</tr>
<tr>
<th>Job name:</th>
<td><a href="[% c.uri_for('/project' build.project.name 'job' build.attrname) %]"><tt>[% build.attrname %]</tt></a></td>
<td><a href="[% c.uri_for('/project' build.project.name 'job' build.job) %]"><tt>[% build.job %]</tt></a></td>
</tr>
<tr>
<th>Nix name:</th>
@ -187,7 +187,7 @@
<td><tt>[% type = input.type; inputTypes.$type %]</tt></td>
<td>
[% 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.job %]</tt> build [% input.dependency.id %]</a>
[% ELSIF input.type == "string" || input.type == "boolean" %]
<tt>"[% input.value %]"</tt>
[% ELSE %]
@ -298,7 +298,7 @@
<tbody>
[% FOREACH input IN build.dependents -%]
<tr>
<td><a href="[% c.uri_for('/build' input.build.id) %]">Job <tt>[% input.build.project.name %]:[% input.build.attrname %]</tt> build [% input.build.id %]</a></td>
<td><a href="[% c.uri_for('/build' input.build.id) %]">Job <tt>[% input.build.project.name %]:[% input.build.job %]</tt> build [% input.build.id %]</a></td>
<td><tt>[% input.name %]</tt></td>
<td><tt>[% input.build.system %]</tt></td>
<td>[% PROCESS renderDateTime timestamp = input.build.timestamp %]</td>

View file

@ -61,7 +61,7 @@
<td>[% build.schedulingInfo.priority %]</td>
[% END %]
<td><a href="[% c.uri_for('/project' build.get_column("project")) %]"><tt>[% build.get_column("project") %]</tt></a></td>
<td><a href="[% c.uri_for('/project' build.get_column("project") 'job' build.attrname) %]"><tt>[% build.attrname %]</tt></a></td>
<td><a href="[% c.uri_for('/project' build.get_column("project") 'job' build.job) %]"><tt>[% build.job %]</tt></a></td>
<td>[% build.resultInfo.releasename ? build.resultInfo.releasename : build.nixname %]</td>
<td><tt>[% build.system %]</tt></td>
<td>[% date.format(build.timestamp, '%Y-%m-%d %H:%M:%S') %]</td>

View file

@ -1,6 +1,6 @@
[% WRAPPER layout.tt title="Logfile" %]
<h1>Logfile for <tt>[% build.project.name %]:[% build.attrname %]</tt> build [% build.id %][%IF step %], step [% step.stepnr %] (<tt>[% step.outpath %]</tt>)[% END %]</h1>
<h1>Logfile for <tt>[% build.project.name %]:[% build.job %]</tt> build [% build.id %][%IF step %], step [% step.stepnr %] (<tt>[% step.outpath %]</tt>)[% END %]</h1>
<div class="buildlog">
[% logtext -%]

View file

@ -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});
});

View file

@ -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.

View file

@ -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}

View file

@ -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
},

View file

@ -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
);