Author: rob
Date: Tue Sep 7 11:29:52 2010
New Revision: 23663
URL: https://svn.nixos.org/websvn/nix/?rev=23663&sc=1
Log:
hydra: if evaluator sees cached build, also add the buildproducts
Modified:
hydra/trunk/src/lib/Hydra/Helper/AddBuilds.pm
hydra/trunk/src/lib/Hydra/Helper/CatalystUtils.pm
hydra/trunk/src/script/hydra_build.pl
Modified: hydra/trunk/src/lib/Hydra/Helper/AddBuilds.pm
==============================================================================
--- hydra/trunk/src/lib/Hydra/Helper/AddBuilds.pm Tue Sep 7 09:54:11
2010 (r23662)
+++ hydra/trunk/src/lib/Hydra/Helper/AddBuilds.pm Tue Sep 7 11:29:52
2010 (r23663)
@@ -586,6 +586,68 @@
return ($jobs, $nixExprInput);
}
+sub addBuildProducts {
+ my ($db, $build) = @_;
+
+ my $outPath = $build->outpath;
+ my $productnr = 1;
+
+ if (-e "$outPath/nix-support/hydra-build-products") {
+ open LIST, "$outPath/nix-support/hydra-build-products" or die;
+ while (<LIST>) {
+ /^([\w\-]+)\s+([\w\-]+)\s+(\S+)(\s+(\S+))?$/ or next;
+ my $type = $1;
+ my $subtype = $2 eq "none" ? "" : $2;
+ my $path = $3;
+ my $defaultPath = $5;
+ next unless -e $path;
+
+ my $fileSize, my $sha1, my $sha256;
+
+ # !!! validate $path, $defaultPath
+
+ if (-f $path) {
+ my $st = stat($path) or die "cannot stat $path: $!";
+ $fileSize = $st->size;
+
+ $sha1 = `nix-hash --flat --type sha1 $path`
+ or die "cannot hash $path: $?";;
+ chomp $sha1;
+
+ $sha256 = `nix-hash --flat --type sha256 $path`
+ or die "cannot hash $path: $?";;
+ chomp $sha256;
+ }
+
+ my $name = $path eq $outPath ? "" : basename $path;
+
+ $db->resultset('BuildProducts')->create(
+ { build => $build->id
+ , productnr => $productnr++
+ , type => $type
+ , subtype => $subtype
+ , path => $path
+ , filesize => $fileSize
+ , sha1hash => $sha1
+ , sha256hash => $sha256
+ , name => $name
+ , defaultpath => $defaultPath
+ });
+ }
+ close LIST;
+ }
+
+ else {
+ $db->resultset('BuildProducts')->create(
+ { build => $build->id
+ , productnr => $productnr++
+ , type => "nix-build"
+ , subtype => ""
+ , path => $outPath
+ , name => $build->nixname
+ });
+ }
+}
# Check whether to add the build described by $buildInfo.
sub checkBuild {
@@ -666,6 +728,7 @@
, errormsg => ""
, releasename => getReleaseName($outPath)
});
+ addBuildProducts($build);
} else {
print STDERR "added to queue as build ", $build->id, "\n";
$build->create_related('buildschedulinginfo',
Modified: hydra/trunk/src/lib/Hydra/Helper/CatalystUtils.pm
==============================================================================
--- hydra/trunk/src/lib/Hydra/Helper/CatalystUtils.pm Tue Sep 7 09:54:11
2010 (r23662)
+++ hydra/trunk/src/lib/Hydra/Helper/CatalystUtils.pm Tue Sep 7 11:29:52
2010 (r23663)
@@ -117,8 +117,8 @@
my @storePaths = ();
foreach my $build (@builds2) {
- next unless isValidPath($build->outpath);
- if (isValidPath($build->drvpath)) {
+ next unless Hydra::Helper::Nix::isValidPath($build->outpath);
+ if (Hydra::Helper::Nix::isValidPath($build->drvpath)) {
# Adding `drvpath' implies adding `outpath' because of the
# `--include-outputs' flag passed to `nix-store'.
push @storePaths, $build->drvpath;
Modified: hydra/trunk/src/script/hydra_build.pl
==============================================================================
--- hydra/trunk/src/script/hydra_build.pl Tue Sep 7 09:54:11 2010
(r23662)
+++ hydra/trunk/src/script/hydra_build.pl Tue Sep 7 11:29:52 2010
(r23663)
@@ -383,64 +383,7 @@
});
if ($buildStatus == 0) {
-
- my $productnr = 1;
-
- if (-e "$outPath/nix-support/hydra-build-products") {
- open LIST, "$outPath/nix-support/hydra-build-products" or die;
- while (<LIST>) {
- /^([\w\-]+)\s+([\w\-]+)\s+(\S+)(\s+(\S+))?$/ or next;
- my $type = $1;
- my $subtype = $2 eq "none" ? "" : $2;
- my $path = $3;
- my $defaultPath = $5;
- next unless -e $path;
-
- my $fileSize, my $sha1, my $sha256;
-
- # !!! validate $path, $defaultPath
-
- if (-f $path) {
- my $st = stat($path) or die "cannot stat $path: $!";
- $fileSize = $st->size;
-
- $sha1 = `nix-hash --flat --type sha1 $path`
- or die "cannot hash $path: $?";;
- chomp $sha1;
-
- $sha256 = `nix-hash --flat --type sha256 $path`
- or die "cannot hash $path: $?";;
- chomp $sha256;
- }
-
- my $name = $path eq $outPath ? "" : basename $path;
-
- $db->resultset('BuildProducts')->create(
- { build => $build->id
- , productnr => $productnr++
- , type => $type
- , subtype => $subtype
- , path => $path
- , filesize => $fileSize
- , sha1hash => $sha1
- , sha256hash => $sha256
- , name => $name
- , defaultpath => $defaultPath
- });
- }
- close LIST;
- }
-
- else {
- $db->resultset('BuildProducts')->create(
- { build => $build->id
- , productnr => $productnr++
- , type => "nix-build"
- , subtype => ""
- , path => $outPath
- , name => $build->nixname
- });
- }
+ addBuildProducts($db, $build);
}
$build->schedulingInfo->delete;
_______________________________________________
nix-commits mailing list
[email protected]
http://mail.cs.uu.nl/mailman/listinfo/nix-commits