* BuildInputs table: link to dependencies, include store paths.

This commit is contained in:
Eelco Dolstra 2008-11-05 23:08:16 +00:00
parent 0ea294e77e
commit a77acc2a4f
11 changed files with 63 additions and 30 deletions

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-05 07:10:07 # Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-05 23:48:14
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:uu8sYu88Z2oes5zF82ugmg # 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 # You can replace this text with custom content, and it will be preserved on regeneration

View file

@ -20,6 +20,10 @@ __PACKAGE__->add_columns(
{ data_type => "integer", is_nullable => 0, size => undef }, { data_type => "integer", is_nullable => 0, size => undef },
"tag", "tag",
{ data_type => "text", is_nullable => 0, size => undef }, { 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__->set_primary_key("buildid", "name");
__PACKAGE__->belongs_to( __PACKAGE__->belongs_to(
@ -29,8 +33,8 @@ __PACKAGE__->belongs_to(
); );
# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-05 07:10:07 # Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-05 23:48:14
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:m8eC8wnRqF6OLO7EQ7gEvg # 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 # You can replace this text with custom content, and it will be preserved on regeneration

View file

@ -25,8 +25,8 @@ __PACKAGE__->belongs_to(
); );
# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-05 07:10:07 # Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-05 23:48:14
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:aEqSRZwHoE8HMwlUb05r+w # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:lU3XutG22RG9DJdxziFlgg
# 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

@ -25,8 +25,8 @@ __PACKAGE__->belongs_to(
); );
# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-05 07:10:07 # Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-05 23:48:14
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:ft672+6Aile/GNGUGMsGWw # 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 # You can replace this text with custom content, and it will be preserved on regeneration

View file

@ -53,7 +53,7 @@ __PACKAGE__->has_many(
); );
# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-05 07:10:07 # Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-05 23:48:14
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:uogJnVTVX17swfcbZgGQYg # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:bneV9O2uXIrg3Wuencuj+Q
1; 1;

View file

@ -40,8 +40,8 @@ __PACKAGE__->belongs_to(
); );
# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-05 07:10:07 # Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-05 23:48:14
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:q2kFjFI0X2cbHCrWi3GUCg # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:fKqDK1YOZXl88jxNRwEvSA
# 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

@ -37,8 +37,8 @@ __PACKAGE__->has_many(
); );
# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-05 07:10:07 # Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-05 23:48:14
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:Y3YaApHX3uowoamLrr3fAA # 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 # You can replace this text with custom content, and it will be preserved on regeneration

View file

@ -19,8 +19,8 @@ __PACKAGE__->has_many(
); );
# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-05 07:10:07 # Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-05 23:48:14
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:gjIRVxp5x78v1ctQ6+ZqLg # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:PpPVJuiXpYbj8HN3sA05Gw
# 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

@ -1,7 +1,7 @@
[% WRAPPER layout.tt title="Hydra Overview" %] [% WRAPPER layout.tt title="Hydra Overview" %]
[% USE date %] [% USE date %]
<h1>Build [% id %]</h1> <h1>Job <tt>[% build.project %]:[% build.attrname %]</tt> build [% id %]</h1>
<h2>Information</h2> <h2>Information</h2>
@ -56,14 +56,21 @@
<table class="tablesorter"> <table class="tablesorter">
<thead> <thead>
<tr><th>Name</th><th>type</th><th>Uri</th></tr> <tr><th>Name</th><th>Type</th><th>What</th><th>Store path</th></tr>
</thead> </thead>
<tbody> <tbody>
[% FOREACH input IN build.buildinputs -%] [% FOREACH input IN build.buildinputs -%]
<tr> <tr>
<td>[% input.name %]</td> <td><tt>[% input.name %]</tt></td>
<td>[% input.type %]</td> <td><tt>[% input.type %]</tt></td>
<td>[% input.uri %]</td> <td>
[% IF input.type == "build" %]
<a href="[% c.uri_for('/build' input.inputid) %]">Build [% input.inputid %]</a>
[% ELSE %]
<tt>[% input.uri %]</tt>
[% END %]
</td>
<td><tt>[% input.path %]</tt></td>
</tr> </tr>
[% END -%] [% END -%]
</tbody> </tbody>

View file

@ -23,14 +23,20 @@ create table builds (
create table buildInputs ( create table buildInputs (
buildId integer not null, buildId integer not null,
-- Copied from the jobSetInputs from which the build was created. -- Copied from the jobSetInputs from which the build was created.
name text not null, name text not null,
type text not null, type text not null,
uri text, uri text,
revision integer, revision integer,
tag text, tag text,
inputId integer, -- build ID of the input, for type == 'build'
path text not null,
primary key (buildId, name), primary key (buildId, name),
foreign key (buildId) references builds(id) on delete cascade -- ignored by sqlite foreign key (buildId) references builds(id) on delete cascade -- ignored by sqlite
foreign key (inputId) references builds(id) -- ignored by sqlite
); );

View file

@ -57,15 +57,27 @@ sub buildJob {
}); });
print " build ID = ", $build->id, "\n"; print " build ID = ", $build->id, "\n";
foreach my $input (keys %{$usedInputs}) { foreach my $inputName (keys %{$usedInputs}) {
my $input = $usedInputs->{$inputName};
if (defined $input->{orig}) {
$db->resultset('Buildinputs')->create( $db->resultset('Buildinputs')->create(
{ buildid => $build->id { buildid => $build->id
, name => $usedInputs->{$input}->{orig}->name , name => $inputName
, type => $usedInputs->{$input}->{orig}->type , type => $input->{orig}->type
, uri => $usedInputs->{$input}->{orig}->uri , uri => $input->{orig}->uri
, revision => $usedInputs->{$input}->{orig}->revision , revision => $input->{orig}->revision
, tag => $usedInputs->{$input}->{orig}->tag , 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; my $logPath = "/nix/var/log/nix/drvs/" . basename $drvPath;
@ -197,6 +209,10 @@ sub checkJobSet {
# !!! reschedule? # !!! reschedule?
die "missing input `$argName'"; die "missing input `$argName'";
} }
$$usedInputs{$argName} =
{ storePath => $storePath
, id => $prevBuild->id
};
} }
$extraArgs .= " --arg $argName '{path = " . $storePath . ";}'"; $extraArgs .= " --arg $argName '{path = " . $storePath . ";}'";