diff --git a/src/HydraFrontend/lib/HydraFrontend/Schema.pm b/src/HydraFrontend/lib/HydraFrontend/Schema.pm index 1a381468..a7d3ba11 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-11 18:02:00 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:gS2Lp7T6IZ160iYQbEhd+g +# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-12 15:09:21 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:B5e2QLKoLZK5s4Ntc5MuAA # 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 6b96dd61..6a350991 100644 --- a/src/HydraFrontend/lib/HydraFrontend/Schema/Buildinputs.pm +++ b/src/HydraFrontend/lib/HydraFrontend/Schema/Buildinputs.pm @@ -38,8 +38,8 @@ __PACKAGE__->belongs_to( ); -# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-11 18:02:00 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:MtL3cwH9upjNmhaZkGszRA +# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-12 15:09:21 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:gB3bnV6S6yuAk1ojYmaI8g # 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 2d67b001..05a933b5 100644 --- a/src/HydraFrontend/lib/HydraFrontend/Schema/Buildlogs.pm +++ b/src/HydraFrontend/lib/HydraFrontend/Schema/Buildlogs.pm @@ -21,8 +21,8 @@ __PACKAGE__->set_primary_key("build", "logphase"); __PACKAGE__->belongs_to("build", "HydraFrontend::Schema::Builds", { id => "build" }); -# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-11 18:02:00 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:vvyGq3BeKyyK7K6uDxJHyQ +# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-12 15:09:21 +# 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 diff --git a/src/HydraFrontend/lib/HydraFrontend/Schema/Buildproducts.pm b/src/HydraFrontend/lib/HydraFrontend/Schema/Buildproducts.pm index ff1f4cf3..7bed8468 100644 --- a/src/HydraFrontend/lib/HydraFrontend/Schema/Buildproducts.pm +++ b/src/HydraFrontend/lib/HydraFrontend/Schema/Buildproducts.pm @@ -10,19 +10,31 @@ __PACKAGE__->table("BuildProducts"); __PACKAGE__->add_columns( "build", { data_type => "integer", is_nullable => 0, size => undef }, - "path", - { data_type => "text", is_nullable => 0, size => undef }, + "productnr", + { data_type => "integer", is_nullable => 0, size => undef }, "type", { data_type => "text", is_nullable => 0, size => undef }, "subtype", { 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" }); -# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-11 18:02:00 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:et00AvSBi5LZUoIrIUOKFQ +# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-12 15:09:21 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:pY4RxKVCMKfiBDtNNXeBng # You can replace this text with custom content, and it will be preserved on regeneration diff --git a/src/HydraFrontend/lib/HydraFrontend/Schema/Buildresultinfo.pm b/src/HydraFrontend/lib/HydraFrontend/Schema/Buildresultinfo.pm index d14fd269..9ef94a73 100644 --- a/src/HydraFrontend/lib/HydraFrontend/Schema/Buildresultinfo.pm +++ b/src/HydraFrontend/lib/HydraFrontend/Schema/Buildresultinfo.pm @@ -25,8 +25,8 @@ __PACKAGE__->set_primary_key("id"); __PACKAGE__->belongs_to("id", "HydraFrontend::Schema::Builds", { id => "id" }); -# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-11 18:02:00 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:8zXrs7iT2h3xp6C/2q37uQ +# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-12 15:09:21 +# 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 diff --git a/src/HydraFrontend/lib/HydraFrontend/Schema/Builds.pm b/src/HydraFrontend/lib/HydraFrontend/Schema/Builds.pm index 5f393542..8fa9ec47 100644 --- a/src/HydraFrontend/lib/HydraFrontend/Schema/Builds.pm +++ b/src/HydraFrontend/lib/HydraFrontend/Schema/Builds.pm @@ -60,11 +60,6 @@ __PACKAGE__->has_many( "HydraFrontend::Schema::Buildinputs", { "foreign.dependency" => "self.id" }, ); -__PACKAGE__->has_many( - "buildproducts", - "HydraFrontend::Schema::Buildproducts", - { "foreign.build" => "self.id" }, -); __PACKAGE__->has_many( "buildlogs", "HydraFrontend::Schema::Buildlogs", @@ -75,10 +70,15 @@ __PACKAGE__->has_many( "HydraFrontend::Schema::Buildsteps", { "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 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:c8feWTpKijITXXSdJICuFg +# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-12 15:09:21 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:1fLVr/70ZuAOfnMp3rMzxg __PACKAGE__->has_many(dependents => 'HydraFrontend::Schema::Buildinputs', 'dependency'); diff --git a/src/HydraFrontend/lib/HydraFrontend/Schema/Buildschedulinginfo.pm b/src/HydraFrontend/lib/HydraFrontend/Schema/Buildschedulinginfo.pm index 3f521f67..76b58b75 100644 --- a/src/HydraFrontend/lib/HydraFrontend/Schema/Buildschedulinginfo.pm +++ b/src/HydraFrontend/lib/HydraFrontend/Schema/Buildschedulinginfo.pm @@ -23,8 +23,8 @@ __PACKAGE__->set_primary_key("id"); __PACKAGE__->belongs_to("id", "HydraFrontend::Schema::Builds", { id => "id" }); -# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-11 18:02:00 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:Z65HteUghCT7sXfXpsHYXg +# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-12 15:09:21 +# 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 diff --git a/src/HydraFrontend/lib/HydraFrontend/Schema/Buildsteps.pm b/src/HydraFrontend/lib/HydraFrontend/Schema/Buildsteps.pm index 21064ad8..a3dc1e46 100644 --- a/src/HydraFrontend/lib/HydraFrontend/Schema/Buildsteps.pm +++ b/src/HydraFrontend/lib/HydraFrontend/Schema/Buildsteps.pm @@ -35,8 +35,8 @@ __PACKAGE__->set_primary_key("id", "stepnr"); __PACKAGE__->belongs_to("id", "HydraFrontend::Schema::Builds", { id => "id" }); -# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-11 18:02:00 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:GmvM5Rhj4MY7eNQpqTz7bw +# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-12 15:09:21 +# 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 diff --git a/src/HydraFrontend/lib/HydraFrontend/Schema/Jobsetinputalts.pm b/src/HydraFrontend/lib/HydraFrontend/Schema/Jobsetinputalts.pm index 35013dce..1f0a6f55 100644 --- a/src/HydraFrontend/lib/HydraFrontend/Schema/Jobsetinputalts.pm +++ b/src/HydraFrontend/lib/HydraFrontend/Schema/Jobsetinputalts.pm @@ -33,8 +33,8 @@ __PACKAGE__->belongs_to( ); -# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-11 18:02:00 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:mng7GAPMDxsznKupYdhwQw +# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-12 15:09:21 +# 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 diff --git a/src/HydraFrontend/lib/HydraFrontend/Schema/Jobsetinputs.pm b/src/HydraFrontend/lib/HydraFrontend/Schema/Jobsetinputs.pm index 71f22994..d1d3a270 100644 --- a/src/HydraFrontend/lib/HydraFrontend/Schema/Jobsetinputs.pm +++ b/src/HydraFrontend/lib/HydraFrontend/Schema/Jobsetinputs.pm @@ -43,8 +43,8 @@ __PACKAGE__->has_many( ); -# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-11 18:02:00 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:vEXBbzKUTBQmGmL8uh9mIA +# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-12 15:09:21 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:PWJ32W99n1Zw44Rhj5P1Pg # 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 ca2c3c32..7af13620 100644 --- a/src/HydraFrontend/lib/HydraFrontend/Schema/Jobsets.pm +++ b/src/HydraFrontend/lib/HydraFrontend/Schema/Jobsets.pm @@ -48,8 +48,8 @@ __PACKAGE__->has_many( ); -# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-11 18:02:00 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:hMYI8zT3UB/k9IbddK1X4g +# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-12 15:09:21 +# 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 diff --git a/src/HydraFrontend/lib/HydraFrontend/Schema/Projects.pm b/src/HydraFrontend/lib/HydraFrontend/Schema/Projects.pm index bc10b085..cd419f17 100644 --- a/src/HydraFrontend/lib/HydraFrontend/Schema/Projects.pm +++ b/src/HydraFrontend/lib/HydraFrontend/Schema/Projects.pm @@ -24,8 +24,8 @@ __PACKAGE__->has_many( ); -# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-11 18:02:00 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:1DTnCjRw929OuAfeJ5gsXA +# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-12 15:09:21 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:Gj8h9Nexy9HmrFNeH2bWCQ # 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 aa45c7af..a859ef97 100644 --- a/src/HydraFrontend/root/build.tt +++ b/src/HydraFrontend/root/build.tt @@ -1,5 +1,6 @@ [% WRAPPER layout.tt title="Hydra Overview" %] [% USE date %] +[% USE mibs=format("%.2f") %]

Job [% build.project.name %]:[% build.attrname %] build [% id %] @@ -198,12 +199,29 @@ [% CASE "file" %] [% SWITCH product.subtype %] [% CASE "source-dist" %] - Source Source distribution [% product.path %] + Source Source distribution [% product.name %] [% CASE "rpm" %] - RPM RPM package [% product.path %] + RPM RPM package [% product.name %] [% CASE DEFAULT %] File [% product.path %] of type [% product.subtype %] [% END %] + [details] +
+ + + + + + + + + +
URL: + + [% c.uri_for('/download' build.id product.productnr product.name) %] + +
File size:[% product.filesize %] bytes ([% mibs(product.filesize / (1024 * 1024)) %] MiB)
SHA-1 hash:[% product.sha1hash %]
SHA-256 hash:[% product.sha256hash %]
Full path:[% product.path %]
+
[% CASE DEFAULT %] Something of type [% product.type %] [% END %] @@ -216,6 +234,8 @@ [% IF build.buildlogs %] + +

Logs

@@ -228,6 +248,8 @@ [% END -%] +
+ [% END %] diff --git a/src/HydraFrontend/root/hydra.css b/src/HydraFrontend/root/hydra.css index d4c3e065..23fc4f33 100644 --- a/src/HydraFrontend/root/hydra.css +++ b/src/HydraFrontend/root/hydra.css @@ -157,11 +157,22 @@ ul.productList { padding-left: 1em; } +ul.productList li { + margin-top: 1em; +} + tr.runningJob { background-color: #ff3030; color: white; } +.productDetails { + display: none; + margin-top: 1em; + margin-bottom: 1em; + margin-left: 3em; +} + /* Sortable tables */ diff --git a/src/build.pl b/src/build.pl index 637bd19a..ee0f7579 100644 --- a/src/build.pl +++ b/src/build.pl @@ -2,6 +2,7 @@ use strict; use File::Basename; +use File::stat; use HydraFrontend::Schema; @@ -197,6 +198,8 @@ sub doBuild { if ($outputCreated) { + my $productnr = 1; + if (-e "$outPath/log") { foreach my $logPath (glob "$outPath/log/*") { print STDERR "found log $logPath\n"; @@ -217,17 +220,36 @@ sub doBuild { my $subtype = $2; my $path = $3; 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( { build => $build->id + , productnr => $productnr++ , type => $type , subtype => $subtype , path => $path + , filesize => $st->size + , sha1hash => $sha1 + , sha256hash => $sha256 + , name => basename $path }); } close LIST; - } elsif ($buildStatus == 0) { + } + + elsif ($buildStatus == 0) { $db->resultset('Buildproducts')->create( { build => $build->id + , productnr => $productnr++ , type => "nix-build" , subtype => "" , path => $outPath @@ -265,6 +287,7 @@ die unless $build; # can be retried. eval { doBuild $build; + print "done\n"; }; if ($@) { warn $@; diff --git a/src/hydra.sql b/src/hydra.sql index d000b7ff..9ee27f87 100644 --- a/src/hydra.sql +++ b/src/hydra.sql @@ -109,10 +109,16 @@ create table BuildInputs ( create table BuildProducts ( build integer not null, - path text not null, + productnr integer not null, type text not null, -- "nix-build", "file", "doc", "report", ... 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 );