This commit is contained in:
Eelco Dolstra 2008-11-12 14:29:32 +00:00
parent 356b77bb95
commit 25f227f678
16 changed files with 111 additions and 37 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-11 18:02:00 # Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-12 15:09:21
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:gS2Lp7T6IZ160iYQbEhd+g # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:B5e2QLKoLZK5s4Ntc5MuAA
# 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

@ -38,8 +38,8 @@ __PACKAGE__->belongs_to(
); );
# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-11 18:02:00 # Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-12 15:09:21
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:MtL3cwH9upjNmhaZkGszRA # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:gB3bnV6S6yuAk1ojYmaI8g
# 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

@ -21,8 +21,8 @@ __PACKAGE__->set_primary_key("build", "logphase");
__PACKAGE__->belongs_to("build", "HydraFrontend::Schema::Builds", { id => "build" }); __PACKAGE__->belongs_to("build", "HydraFrontend::Schema::Builds", { id => "build" });
# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-11 18:02:00 # Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-12 15:09:21
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:vvyGq3BeKyyK7K6uDxJHyQ # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:IfVP+l5/yBO6808VOMNADQ
# 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

@ -10,19 +10,31 @@ __PACKAGE__->table("BuildProducts");
__PACKAGE__->add_columns( __PACKAGE__->add_columns(
"build", "build",
{ data_type => "integer", is_nullable => 0, size => undef }, { data_type => "integer", is_nullable => 0, size => undef },
"path", "productnr",
{ data_type => "text", is_nullable => 0, size => undef }, { data_type => "integer", is_nullable => 0, size => undef },
"type", "type",
{ data_type => "text", is_nullable => 0, size => undef }, { data_type => "text", is_nullable => 0, size => undef },
"subtype", "subtype",
{ data_type => "text", is_nullable => 0, size => undef }, { data_type => "text", is_nullable => 0, size => undef },
"filesize",
{ data_type => "integer", is_nullable => 0, size => undef },
"sha1hash",
{ data_type => "text", is_nullable => 0, size => undef },
"sha256hash",
{ data_type => "text", is_nullable => 0, size => undef },
"path",
{ data_type => "text", is_nullable => 0, size => undef },
"name",
{ data_type => "text", is_nullable => 0, size => undef },
"description",
{ data_type => "text", is_nullable => 0, size => undef },
); );
__PACKAGE__->set_primary_key("build", "path"); __PACKAGE__->set_primary_key("build", "productnr");
__PACKAGE__->belongs_to("build", "HydraFrontend::Schema::Builds", { id => "build" }); __PACKAGE__->belongs_to("build", "HydraFrontend::Schema::Builds", { id => "build" });
# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-11 18:02:00 # Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-12 15:09:21
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:et00AvSBi5LZUoIrIUOKFQ # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:pY4RxKVCMKfiBDtNNXeBng
# 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__->set_primary_key("id");
__PACKAGE__->belongs_to("id", "HydraFrontend::Schema::Builds", { id => "id" }); __PACKAGE__->belongs_to("id", "HydraFrontend::Schema::Builds", { id => "id" });
# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-11 18:02:00 # Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-12 15:09:21
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:8zXrs7iT2h3xp6C/2q37uQ # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:wYS1iVMAyN/RtZG1Obi9tw
# 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

@ -60,11 +60,6 @@ __PACKAGE__->has_many(
"HydraFrontend::Schema::Buildinputs", "HydraFrontend::Schema::Buildinputs",
{ "foreign.dependency" => "self.id" }, { "foreign.dependency" => "self.id" },
); );
__PACKAGE__->has_many(
"buildproducts",
"HydraFrontend::Schema::Buildproducts",
{ "foreign.build" => "self.id" },
);
__PACKAGE__->has_many( __PACKAGE__->has_many(
"buildlogs", "buildlogs",
"HydraFrontend::Schema::Buildlogs", "HydraFrontend::Schema::Buildlogs",
@ -75,10 +70,15 @@ __PACKAGE__->has_many(
"HydraFrontend::Schema::Buildsteps", "HydraFrontend::Schema::Buildsteps",
{ "foreign.id" => "self.id" }, { "foreign.id" => "self.id" },
); );
__PACKAGE__->has_many(
"buildproducts",
"HydraFrontend::Schema::Buildproducts",
{ "foreign.build" => "self.id" },
);
# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-11 18:02:00 # Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-12 15:09:21
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:c8feWTpKijITXXSdJICuFg # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:1fLVr/70ZuAOfnMp3rMzxg
__PACKAGE__->has_many(dependents => 'HydraFrontend::Schema::Buildinputs', 'dependency'); __PACKAGE__->has_many(dependents => 'HydraFrontend::Schema::Buildinputs', 'dependency');

View file

@ -23,8 +23,8 @@ __PACKAGE__->set_primary_key("id");
__PACKAGE__->belongs_to("id", "HydraFrontend::Schema::Builds", { id => "id" }); __PACKAGE__->belongs_to("id", "HydraFrontend::Schema::Builds", { id => "id" });
# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-11 18:02:00 # Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-12 15:09:21
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:Z65HteUghCT7sXfXpsHYXg # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:iRPGs/gpDnzo1PxQxG7xvw
# 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", "HydraFrontend::Schema::Builds", { id => "id" }); __PACKAGE__->belongs_to("id", "HydraFrontend::Schema::Builds", { id => "id" });
# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-11 18:02:00 # Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-12 15:09:21
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:GmvM5Rhj4MY7eNQpqTz7bw # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:mhkF1c7eX7lD/XrssbCZvA
# 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__->belongs_to(
); );
# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-11 18:02:00 # Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-12 15:09:21
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:mng7GAPMDxsznKupYdhwQw # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:hxSSWmfGbKz1L3Qcd3/3Vw
# 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-11 18:02:00 # Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-12 15:09:21
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:vEXBbzKUTBQmGmL8uh9mIA # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:PWJ32W99n1Zw44Rhj5P1Pg
# 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-11 18:02:00 # Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-12 15:09:21
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:hMYI8zT3UB/k9IbddK1X4g # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:FVgzVxkslYSC4yoG9JxA+A
# 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

@ -24,8 +24,8 @@ __PACKAGE__->has_many(
); );
# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-11 18:02:00 # Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-12 15:09:21
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:1DTnCjRw929OuAfeJ5gsXA # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:Gj8h9Nexy9HmrFNeH2bWCQ
# 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,5 +1,6 @@
[% WRAPPER layout.tt title="Hydra Overview" %] [% WRAPPER layout.tt title="Hydra Overview" %]
[% USE date %] [% USE date %]
[% USE mibs=format("%.2f") %]
<h1> <h1>
Job <tt>[% build.project.name %]:[% build.attrname %]</tt> build [% id %] Job <tt>[% build.project.name %]:[% build.attrname %]</tt> build [% id %]
@ -198,12 +199,29 @@
[% CASE "file" %] [% CASE "file" %]
[% SWITCH product.subtype %] [% SWITCH product.subtype %]
[% CASE "source-dist" %] [% CASE "source-dist" %]
<img src="/static/images/source-dist.png" alt="Source" /> Source distribution <tt>[% product.path %]</tt> <img src="/static/images/source-dist.png" alt="Source" /> Source distribution <tt>[% product.name %]</tt>
[% CASE "rpm" %] [% CASE "rpm" %]
<img src="/static/images/rpm-fedora.png" alt="RPM" /> RPM package <tt>[% product.path %]</tt> <img src="/static/images/rpm-fedora.png" alt="RPM" /> RPM package <tt>[% product.name %]</tt>
[% CASE DEFAULT %] [% CASE DEFAULT %]
File <tt>[% product.path %]</tt> of type <tt>[% product.subtype %]</tt> File <tt>[% product.path %]</tt> of type <tt>[% product.subtype %]</tt>
[% END %] [% END %]
[<a href="javascript:" onclick="javascript:$('#foo-[% product.productnr %]').toggle()">details</a>]
<div class="productDetails" id="foo-[% product.productnr %]">
<table>
<tr>
<th>URL:</th>
<td>
<a href="[% c.uri_for('/download' build.id product.productnr product.name) %]">
<tt>[% c.uri_for('/download' build.id product.productnr product.name) %]</tt>
</a>
</td>
</tr>
<tr><th>File size:</th><td>[% product.filesize %] bytes ([% mibs(product.filesize / (1024 * 1024)) %] MiB)</td></tr>
<tr><th>SHA-1 hash:</th><td>[% product.sha1hash %]</td></tr>
<tr><th>SHA-256 hash:</th><td>[% product.sha256hash %]</td></tr>
<tr><th>Full path:</th><td><tt>[% product.path %]</tt></td></tr>
</table>
</div>
[% CASE DEFAULT %] [% CASE DEFAULT %]
Something of type <tt>[% product.type %]</tt> Something of type <tt>[% product.type %]</tt>
[% END %] [% END %]
@ -217,6 +235,8 @@
[% IF build.buildlogs %] [% IF build.buildlogs %]
<div id="bla">
<h2>Logs</h2> <h2>Logs</h2>
<table> <table>
@ -228,6 +248,8 @@
[% END -%] [% END -%]
</table> </table>
</div>
[% END %] [% END %]

View file

@ -157,11 +157,22 @@ ul.productList {
padding-left: 1em; padding-left: 1em;
} }
ul.productList li {
margin-top: 1em;
}
tr.runningJob { tr.runningJob {
background-color: #ff3030; background-color: #ff3030;
color: white; color: white;
} }
.productDetails {
display: none;
margin-top: 1em;
margin-bottom: 1em;
margin-left: 3em;
}
/* Sortable tables */ /* Sortable tables */

View file

@ -2,6 +2,7 @@
use strict; use strict;
use File::Basename; use File::Basename;
use File::stat;
use HydraFrontend::Schema; use HydraFrontend::Schema;
@ -197,6 +198,8 @@ sub doBuild {
if ($outputCreated) { if ($outputCreated) {
my $productnr = 1;
if (-e "$outPath/log") { if (-e "$outPath/log") {
foreach my $logPath (glob "$outPath/log/*") { foreach my $logPath (glob "$outPath/log/*") {
print STDERR "found log $logPath\n"; print STDERR "found log $logPath\n";
@ -217,17 +220,36 @@ sub doBuild {
my $subtype = $2; my $subtype = $2;
my $path = $3; my $path = $3;
die unless -e $path; die unless -e $path;
my $st = stat($path) or die "cannot stat $path: $!";
my $sha1 = `nix-hash --flat --type sha1 $path`
or die "cannot hash $path: $?";;
chomp $sha1;
my $sha256 = `nix-hash --flat --type sha256 $path`
or die "cannot hash $path: $?";;
chomp $sha256;
$db->resultset('Buildproducts')->create( $db->resultset('Buildproducts')->create(
{ build => $build->id { build => $build->id
, productnr => $productnr++
, type => $type , type => $type
, subtype => $subtype , subtype => $subtype
, path => $path , path => $path
, filesize => $st->size
, sha1hash => $sha1
, sha256hash => $sha256
, name => basename $path
}); });
} }
close LIST; close LIST;
} elsif ($buildStatus == 0) { }
elsif ($buildStatus == 0) {
$db->resultset('Buildproducts')->create( $db->resultset('Buildproducts')->create(
{ build => $build->id { build => $build->id
, productnr => $productnr++
, type => "nix-build" , type => "nix-build"
, subtype => "" , subtype => ""
, path => $outPath , path => $outPath
@ -265,6 +287,7 @@ die unless $build;
# can be retried. # can be retried.
eval { eval {
doBuild $build; doBuild $build;
print "done\n";
}; };
if ($@) { if ($@) {
warn $@; warn $@;

View file

@ -109,10 +109,16 @@ create table BuildInputs (
create table BuildProducts ( create table BuildProducts (
build integer not null, build integer not null,
path text not null, productnr integer not null,
type text not null, -- "nix-build", "file", "doc", "report", ... type text not null, -- "nix-build", "file", "doc", "report", ...
subtype text not null, -- "source-dist", "rpm", ... subtype text not null, -- "source-dist", "rpm", ...
primary key (build, path), fileSize integer,
sha1hash text,
sha256hash text,
path text,
name text not null, -- generally just the filename part of `path'
description text, -- optionally, some description of this file/directory
primary key (build, productnr),
foreign key (build) references Builds(id) on delete cascade -- ignored by sqlite foreign key (build) references Builds(id) on delete cascade -- ignored by sqlite
); );