Author: rob
Date: Wed Sep 1 10:50:57 2010
New Revision: 23591
URL: https://svn.nixos.org/websvn/nix/?rev=23591&sc=1
Log:
hydra: at evaluation, check if path is already built, and mark as built in
stead of adding to the queue.
Modified:
hydra/trunk/src/lib/Hydra/Helper/AddBuilds.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 Wed Sep 1 10:12:56
2010 (r23590)
+++ hydra/trunk/src/lib/Hydra/Helper/AddBuilds.pm Wed Sep 1 10:50:57
2010 (r23591)
@@ -10,7 +10,7 @@
use File::Path;
our @ISA = qw(Exporter);
-our @EXPORT = qw(fetchInput evalJobs checkBuild inputsToArgs
captureStdoutStderr);
+our @EXPORT = qw(fetchInput evalJobs checkBuild inputsToArgs
captureStdoutStderr getReleaseName);
sub scmPath {
return getHydraPath . "/scm" ;
@@ -29,6 +29,18 @@
return $hash;
}
+sub getReleaseName {
+ my ($outPath) = @_;
+
+ my $releaseName;
+ if (-e "$outPath/nix-support/hydra-release-name") {
+ open FILE, "$outPath/nix-support/hydra-release-name" or die;
+ $releaseName = <FILE>;
+ chomp $releaseName;
+ close FILE;
+ }
+ return $releaseName;
+}
sub parseJobName {
# Parse a job specification of the form `<project>:<jobset>:<job>
@@ -607,10 +619,12 @@
return;
}
+ my $time = time();
+
# Nope, so add it.
$build = $job->builds->create(
{ finished => 0
- , timestamp => time()
+ , timestamp => $time
, description => $buildInfo->{description}
, longdescription => $buildInfo->{longDescription}
, license => $buildInfo->{license}
@@ -627,15 +641,29 @@
, nixexprpath => $jobset->nixexprpath
});
- print STDERR "added to queue as build ", $build->id, "\n";
$currentBuilds->{$build->id} = 1;
- $build->create_related('buildschedulinginfo',
- { priority => $priority
- , busy => 0
- , locker => ""
- });
+ if(isValidPath($outPath)) {
+ print STDERR "marked as cached build ", $build->id, "\n";
+ $build->update({ finished => 1 });
+ $build->create_related('buildresultinfo',
+ { iscachedbuild => 1
+ , buildstatus => 0
+ , starttime => $time
+ , stoptime => $time
+ , logfile => getBuildLog($drvPath)
+ , errormsg => ""
+ , releasename => getReleaseName($outPath)
+ });
+ } else {
+ print STDERR "added to queue as build ", $build->id, "\n";
+ $build->create_related('buildschedulinginfo',
+ { priority => $priority
+ , busy => 0
+ , locker => ""
+ });
+ }
my %inputs;
$inputs{$jobset->nixexprinput} = $nixExprInput;
Modified: hydra/trunk/src/script/hydra_build.pl
==============================================================================
--- hydra/trunk/src/script/hydra_build.pl Wed Sep 1 10:12:56 2010
(r23590)
+++ hydra/trunk/src/script/hydra_build.pl Wed Sep 1 10:50:57 2010
(r23591)
@@ -83,7 +83,7 @@
die unless defined $build->resultInfo;
- return if ! ( $build->jobset->enableemail && ($build->maintainers neq ""
|| $build->jobset->emailoverride neq "") );
+ return if ! ( $build->jobset->enableemail && ($build->maintainers ne "" ||
$build->jobset->emailoverride ne "") );
# Do we want to send mail?
@@ -376,13 +376,7 @@
txn_do($db, sub {
$build->update({finished => 1, timestamp => time});
- my $releaseName;
- if (-e "$outPath/nix-support/hydra-release-name") {
- open FILE, "$outPath/nix-support/hydra-release-name" or die;
- $releaseName = <FILE>;
- chomp $releaseName;
- close FILE;
- }
+ my $releaseName = getReleaseName($outPath);
$db->resultset('BuildResultInfo')->create(
{ id => $build->id
_______________________________________________
nix-commits mailing list
[email protected]
http://mail.cs.uu.nl/mailman/listinfo/nix-commits