From a77acc2a4fdd16a45c8e57805621f1b74231668d Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 5 Nov 2008 23:08:16 +0000 Subject: [PATCH] * BuildInputs table: link to dependencies, include store paths. --- src/HydraFrontend/lib/HydraFrontend/Schema.pm | 4 +-- .../lib/HydraFrontend/Schema/Buildinputs.pm | 8 +++-- .../lib/HydraFrontend/Schema/Buildlogs.pm | 4 +-- .../lib/HydraFrontend/Schema/Buildproducts.pm | 4 +-- .../lib/HydraFrontend/Schema/Builds.pm | 4 +-- .../lib/HydraFrontend/Schema/Jobsetinputs.pm | 4 +-- .../lib/HydraFrontend/Schema/Jobsets.pm | 4 +-- .../lib/HydraFrontend/Schema/Projects.pm | 4 +-- src/HydraFrontend/root/build.tt | 17 +++++++--- src/hydra.sql | 6 ++++ src/scheduler.pl | 34 ++++++++++++++----- 11 files changed, 63 insertions(+), 30 deletions(-) diff --git a/src/HydraFrontend/lib/HydraFrontend/Schema.pm b/src/HydraFrontend/lib/HydraFrontend/Schema.pm index 3c24cfa5..62cab360 100644 --- a/src/HydraFrontend/lib/HydraFrontend/Schema.pm +++ b/src/HydraFrontend/lib/HydraFrontend/Schema.pm @@ -8,8 +8,8 @@ use base 'DBIx::Class::Schema'; __PACKAGE__->load_classes; -# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-05 07:10:07 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:uu8sYu88Z2oes5zF82ugmg +# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-05 23:48:14 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:m+4HRK3Cwlb1lbJ+twj8zw # You can replace this text with custom content, and it will be preserved on regeneration diff --git a/src/HydraFrontend/lib/HydraFrontend/Schema/Buildinputs.pm b/src/HydraFrontend/lib/HydraFrontend/Schema/Buildinputs.pm index fab14699..8d848fd2 100644 --- a/src/HydraFrontend/lib/HydraFrontend/Schema/Buildinputs.pm +++ b/src/HydraFrontend/lib/HydraFrontend/Schema/Buildinputs.pm @@ -20,6 +20,10 @@ __PACKAGE__->add_columns( { data_type => "integer", is_nullable => 0, size => undef }, "tag", { data_type => "text", is_nullable => 0, size => undef }, + "inputid", + { data_type => "integer", is_nullable => 0, size => undef }, + "path", + { data_type => "text", is_nullable => 0, size => undef }, ); __PACKAGE__->set_primary_key("buildid", "name"); __PACKAGE__->belongs_to( @@ -29,8 +33,8 @@ __PACKAGE__->belongs_to( ); -# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-05 07:10:07 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:m8eC8wnRqF6OLO7EQ7gEvg +# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-05 23:48:14 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:wqjRb/WbGiyFTBcu8QId3Q # You can replace this text with custom content, and it will be preserved on regeneration diff --git a/src/HydraFrontend/lib/HydraFrontend/Schema/Buildlogs.pm b/src/HydraFrontend/lib/HydraFrontend/Schema/Buildlogs.pm index 9b180de7..9e1bdf2e 100644 --- a/src/HydraFrontend/lib/HydraFrontend/Schema/Buildlogs.pm +++ b/src/HydraFrontend/lib/HydraFrontend/Schema/Buildlogs.pm @@ -25,8 +25,8 @@ __PACKAGE__->belongs_to( ); -# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-05 07:10:07 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:aEqSRZwHoE8HMwlUb05r+w +# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-05 23:48:14 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:lU3XutG22RG9DJdxziFlgg # You can replace this text with custom content, and it will be preserved on regeneration diff --git a/src/HydraFrontend/lib/HydraFrontend/Schema/Buildproducts.pm b/src/HydraFrontend/lib/HydraFrontend/Schema/Buildproducts.pm index c78e83a2..3a2f9818 100644 --- a/src/HydraFrontend/lib/HydraFrontend/Schema/Buildproducts.pm +++ b/src/HydraFrontend/lib/HydraFrontend/Schema/Buildproducts.pm @@ -25,8 +25,8 @@ __PACKAGE__->belongs_to( ); -# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-05 07:10:07 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:ft672+6Aile/GNGUGMsGWw +# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-05 23:48:14 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:lfykD1HZfuy+uc7JM1sVCA # You can replace this text with custom content, and it will be preserved on regeneration diff --git a/src/HydraFrontend/lib/HydraFrontend/Schema/Builds.pm b/src/HydraFrontend/lib/HydraFrontend/Schema/Builds.pm index 2694d515..1e75e713 100644 --- a/src/HydraFrontend/lib/HydraFrontend/Schema/Builds.pm +++ b/src/HydraFrontend/lib/HydraFrontend/Schema/Builds.pm @@ -53,7 +53,7 @@ __PACKAGE__->has_many( ); -# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-05 07:10:07 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:uogJnVTVX17swfcbZgGQYg +# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-05 23:48:14 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:bneV9O2uXIrg3Wuencuj+Q 1; diff --git a/src/HydraFrontend/lib/HydraFrontend/Schema/Jobsetinputs.pm b/src/HydraFrontend/lib/HydraFrontend/Schema/Jobsetinputs.pm index 4bdbe8e4..f8ef6fbd 100644 --- a/src/HydraFrontend/lib/HydraFrontend/Schema/Jobsetinputs.pm +++ b/src/HydraFrontend/lib/HydraFrontend/Schema/Jobsetinputs.pm @@ -40,8 +40,8 @@ __PACKAGE__->belongs_to( ); -# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-05 07:10:07 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:q2kFjFI0X2cbHCrWi3GUCg +# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-05 23:48:14 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:fKqDK1YOZXl88jxNRwEvSA # You can replace this text with custom content, and it will be preserved on regeneration diff --git a/src/HydraFrontend/lib/HydraFrontend/Schema/Jobsets.pm b/src/HydraFrontend/lib/HydraFrontend/Schema/Jobsets.pm index ca03bde4..b234eb00 100644 --- a/src/HydraFrontend/lib/HydraFrontend/Schema/Jobsets.pm +++ b/src/HydraFrontend/lib/HydraFrontend/Schema/Jobsets.pm @@ -37,8 +37,8 @@ __PACKAGE__->has_many( ); -# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-05 07:10:07 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:Y3YaApHX3uowoamLrr3fAA +# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-05 23:48:14 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:R+xsUdoLpQ7JnbZagpMqJQ # You can replace this text with custom content, and it will be preserved on regeneration diff --git a/src/HydraFrontend/lib/HydraFrontend/Schema/Projects.pm b/src/HydraFrontend/lib/HydraFrontend/Schema/Projects.pm index cf7823e4..81b17a58 100644 --- a/src/HydraFrontend/lib/HydraFrontend/Schema/Projects.pm +++ b/src/HydraFrontend/lib/HydraFrontend/Schema/Projects.pm @@ -19,8 +19,8 @@ __PACKAGE__->has_many( ); -# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-05 07:10:07 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:gjIRVxp5x78v1ctQ6+ZqLg +# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-05 23:48:14 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:PpPVJuiXpYbj8HN3sA05Gw # You can replace this text with custom content, and it will be preserved on regeneration diff --git a/src/HydraFrontend/root/build.tt b/src/HydraFrontend/root/build.tt index 3eaad19c..9d355ed3 100644 --- a/src/HydraFrontend/root/build.tt +++ b/src/HydraFrontend/root/build.tt @@ -1,7 +1,7 @@ [% WRAPPER layout.tt title="Hydra Overview" %] [% USE date %] -

Build [% id %]

+

Job [% build.project %]:[% build.attrname %] build [% id %]

Information

@@ -56,14 +56,21 @@ - + [% FOREACH input IN build.buildinputs -%] - - - + + + + [% END -%] diff --git a/src/hydra.sql b/src/hydra.sql index ea6f9160..d90fe769 100644 --- a/src/hydra.sql +++ b/src/hydra.sql @@ -23,14 +23,20 @@ create table builds ( create table buildInputs ( buildId integer not null, + -- Copied from the jobSetInputs from which the build was created. name text not null, type text not null, uri text, revision integer, tag text, + inputId integer, -- build ID of the input, for type == 'build' + + path text not null, + primary key (buildId, name), foreign key (buildId) references builds(id) on delete cascade -- ignored by sqlite + foreign key (inputId) references builds(id) -- ignored by sqlite ); diff --git a/src/scheduler.pl b/src/scheduler.pl index aaeb75e0..9a8129a1 100644 --- a/src/scheduler.pl +++ b/src/scheduler.pl @@ -57,15 +57,27 @@ sub buildJob { }); print " build ID = ", $build->id, "\n"; - foreach my $input (keys %{$usedInputs}) { - $db->resultset('Buildinputs')->create( - { buildid => $build->id - , name => $usedInputs->{$input}->{orig}->name - , type => $usedInputs->{$input}->{orig}->type - , uri => $usedInputs->{$input}->{orig}->uri - , revision => $usedInputs->{$input}->{orig}->revision - , tag => $usedInputs->{$input}->{orig}->tag - }); + foreach my $inputName (keys %{$usedInputs}) { + my $input = $usedInputs->{$inputName}; + if (defined $input->{orig}) { + $db->resultset('Buildinputs')->create( + { buildid => $build->id + , name => $inputName + , type => $input->{orig}->type + , uri => $input->{orig}->uri + , revision => $input->{orig}->revision + , tag => $input->{orig}->tag + , path => $input->{storePath} + }); + } else { + $db->resultset('Buildinputs')->create( + { buildid => $build->id + , name => $inputName + , type => "build" + , inputid => $input->{id} + , path => $input->{storePath} + }); + } } my $logPath = "/nix/var/log/nix/drvs/" . basename $drvPath; @@ -197,6 +209,10 @@ sub checkJobSet { # !!! reschedule? die "missing input `$argName'"; } + $$usedInputs{$argName} = + { storePath => $storePath + , id => $prevBuild->id + }; } $extraArgs .= " --arg $argName '{path = " . $storePath . ";}'";
NametypeUri
NameTypeWhatStore path
[% input.name %][% input.type %][% input.uri %][% input.name %][% input.type %] + [% IF input.type == "build" %] + Build [% input.inputid %] + [% ELSE %] + [% input.uri %] + [% END %] + [% input.path %]