Prevent multiple builds with the same (job, outPath) tuple from being added
This happened in a pathological case in Nixpkgs: the "grub" job is evaluated for i686-linux and x86_64-linux, but in the latter case it returns the same derivation as in the former case. So only one build should be added.
This commit is contained in:
@ -532,7 +532,7 @@ sub clone_submit : Chained('build') PathPart('clone/submit') Args(0) {
|
||||
my %currentBuilds;
|
||||
my $newBuild = checkBuild(
|
||||
$c->model('DB'), $build->project, $build->jobset,
|
||||
$inputInfo, $nixExprInput, $job, \%currentBuilds, undef);
|
||||
$inputInfo, $nixExprInput, $job, \%currentBuilds, undef, {});
|
||||
|
||||
error($c, "This build has already been performed.") unless $newBuild;
|
||||
|
||||
|
@ -803,7 +803,7 @@ sub getPrevJobsetEval {
|
||||
|
||||
# Check whether to add the build described by $buildInfo.
|
||||
sub checkBuild {
|
||||
my ($db, $project, $jobset, $inputInfo, $nixExprInput, $buildInfo, $buildIds, $prevEval) = @_;
|
||||
my ($db, $project, $jobset, $inputInfo, $nixExprInput, $buildInfo, $buildIds, $prevEval, $jobOutPathMap) = @_;
|
||||
|
||||
my $jobName = $buildInfo->{jobName};
|
||||
my $drvPath = $buildInfo->{drvPath};
|
||||
@ -844,6 +844,14 @@ sub checkBuild {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
# Prevent multiple builds with the same (job, outPath) from
|
||||
# being added.
|
||||
my $prev = $$jobOutPathMap{$job->name . "\t" . $outPath};
|
||||
if (defined $prev) {
|
||||
print STDERR " already scheduled as build ", $prev, "\n";
|
||||
return;
|
||||
}
|
||||
|
||||
my $time = time();
|
||||
|
||||
@ -886,6 +894,7 @@ sub checkBuild {
|
||||
});
|
||||
|
||||
$buildIds->{$build->id} = 1;
|
||||
$$jobOutPathMap{$job->name . "\t" . $outPath} = $build->id;
|
||||
|
||||
if ($build->iscachedbuild) {
|
||||
print STDERR " marked as cached build ", $build->id, "\n";
|
||||
|
Reference in New Issue
Block a user