From 6591118a2b73171359ff775b06be7df668af5818 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 12 Nov 2008 23:14:57 +0000 Subject: [PATCH] --- src/HydraFrontend/lib/HydraFrontend/Schema.pm | 4 ++-- .../lib/HydraFrontend/Schema/Buildinputs.pm | 6 +++-- .../lib/HydraFrontend/Schema/Buildlogs.pm | 4 ++-- .../lib/HydraFrontend/Schema/Buildproducts.pm | 4 ++-- .../HydraFrontend/Schema/Buildresultinfo.pm | 4 ++-- .../lib/HydraFrontend/Schema/Builds.pm | 4 ++-- .../Schema/Buildschedulinginfo.pm | 4 ++-- .../lib/HydraFrontend/Schema/Buildsteps.pm | 4 ++-- .../HydraFrontend/Schema/Jobsetinputalts.pm | 4 ++-- .../lib/HydraFrontend/Schema/Jobsetinputs.pm | 4 ++-- .../lib/HydraFrontend/Schema/Jobsets.pm | 4 ++-- .../lib/HydraFrontend/Schema/Projects.pm | 4 ++-- src/hydra.sql | 2 ++ src/scheduler.pl | 23 ++++++++++++++++++- 14 files changed, 50 insertions(+), 25 deletions(-) diff --git a/src/HydraFrontend/lib/HydraFrontend/Schema.pm b/src/HydraFrontend/lib/HydraFrontend/Schema.pm index 15346c06..3f61f553 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-12 17:11:42 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:F1nSglXZOlZaa+DozFyuSw +# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-13 00:06:06 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:ZbJ6NueGI5oUOzciArgKog # 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 330be8d5..e1d0998a 100644 --- a/src/HydraFrontend/lib/HydraFrontend/Schema/Buildinputs.pm +++ b/src/HydraFrontend/lib/HydraFrontend/Schema/Buildinputs.pm @@ -28,6 +28,8 @@ __PACKAGE__->add_columns( { data_type => "integer", is_nullable => 0, size => undef }, "path", { data_type => "text", is_nullable => 0, size => undef }, + "sha256hash", + { data_type => "VARCHAR", is_nullable => 0, size => undef }, ); __PACKAGE__->set_primary_key("id"); __PACKAGE__->belongs_to("build", "HydraFrontend::Schema::Builds", { id => "build" }); @@ -38,8 +40,8 @@ __PACKAGE__->belongs_to( ); -# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-12 17:11:42 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:6AC1Vo2bOr42lKnrBq/OJg +# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-13 00:06:06 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:aad+idPUM0h/+J0Hl5SdIg # 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 bbe3618e..db330ae1 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-12 17:11:42 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:fdoYDJVZVm+i55Fx3tAN9Q +# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-13 00:06:06 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:o8osOyKf+9S5A87XexVOeA # 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 56429e8c..eebec1f5 100644 --- a/src/HydraFrontend/lib/HydraFrontend/Schema/Buildproducts.pm +++ b/src/HydraFrontend/lib/HydraFrontend/Schema/Buildproducts.pm @@ -33,8 +33,8 @@ __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-12 17:11:42 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:N+3MtBcrTGOC3emLB+xNRQ +# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-13 00:06:06 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:52RNu4OcP3buytGZs+cGZQ # 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 18506a61..a25713d8 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-12 17:11:42 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:YMeFW1JK1ChtsgKbur76Mg +# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-13 00:06:06 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:+kbG4YYzbVVPWMwWTcQ32Q # 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 bba7e38e..efa77b07 100644 --- a/src/HydraFrontend/lib/HydraFrontend/Schema/Builds.pm +++ b/src/HydraFrontend/lib/HydraFrontend/Schema/Builds.pm @@ -79,8 +79,8 @@ __PACKAGE__->has_many( ); -# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-12 17:11:42 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:mfQ486yZBf8hAuPUAT3rNw +# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-13 00:06:06 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:l4QUKDHPL1mEZSlO9GgGzw __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 839a4f43..6dcda02a 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-12 17:11:42 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:KGrBqaYWcJJW8YWfTxU2aA +# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-13 00:06:06 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:EDzMzfQFnkl0bAmBlh5Omw # 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 b4ddd18c..1d387cb9 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-12 17:11:42 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:zjPeAZwkkJ7hZ5LZ00fm1A +# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-13 00:06:06 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:T25Mdcg1A77BB4gFF3LPZA # 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 74c3ad69..3b8edf0a 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-12 17:11:42 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:9qIw6bpHy7bKDNI3g1WKMA +# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-13 00:06:06 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:Qc9/eVs3wY6m9fztR3Yizg # 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 c1dbd83f..b5b5399a 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-12 17:11:42 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:OL3rSmVxWsUJoeaUieZGJA +# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-13 00:06:06 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:V2RU7h0eTPBUES0G306AgA # 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 5798c86a..ae2a2f8a 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-12 17:11:42 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:Ed14Jg43pSHx6rNdYW6kLg +# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-13 00:06:06 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:TMnJfLpgUhiMkJKB8I1qqQ # 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 508fcc45..d72398f3 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-12 17:11:42 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:qzleHgS4oapKEZ8hPyB3Sw +# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-13 00:06:06 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:UEZU36sQSaNML/YCAtpGkg # You can replace this text with custom content, and it will be preserved on regeneration diff --git a/src/hydra.sql b/src/hydra.sql index a3321138..0f4da162 100644 --- a/src/hydra.sql +++ b/src/hydra.sql @@ -103,6 +103,8 @@ create table BuildInputs ( path text, + sha256hash text, + foreign key (build) references Builds(id) on delete cascade, -- ignored by sqlite foreign key (dependency) references Builds(id) -- ignored by sqlite ); diff --git a/src/scheduler.pl b/src/scheduler.pl index 99c5150a..b76bf55d 100644 --- a/src/scheduler.pl +++ b/src/scheduler.pl @@ -16,6 +16,20 @@ sub isValidPath { } +sub getStorePathHash { + my ($storePath) = @_; + my $hash = `nix-store --query --hash $storePath` + or die "cannot get hash of $storePath"; + chomp $hash; + die unless $hash =~ /^sha256:(.*)$/; + $hash = $1; + $hash = `nix-hash --to-base16 --type sha256 $hash` + or die "cannot convert hash"; + chomp $hash; + return $hash; +} + + sub fetchInput { my ($input, $alt, $inputInfo) = @_; my $type = $input->type; @@ -26,7 +40,13 @@ sub fetchInput { or die "cannot copy path $uri to the Nix store"; chomp $storePath; print " copied to $storePath\n"; - $$inputInfo{$input->name} = {type => $type, uri => $uri, storePath => $storePath}; + + $$inputInfo{$input->name} = + { type => $type + , uri => $uri + , storePath => $storePath + , sha256hash => getStorePathHash $storePath + }; } elsif ($type eq "string") { @@ -105,6 +125,7 @@ sub checkJob { , value => $input->{value} , dependency => $input->{id} , path => ($input->{storePath} or "") # !!! temporary hack + , sha256hash => $input->{sha256hash} }); } });