* Register GC roots properly.
This commit is contained in:
@ -28,8 +28,6 @@ sub doBuild {
|
||||
my $failedDepBuild;
|
||||
my $failedDepStepNr;
|
||||
|
||||
registerRoot $outPath;
|
||||
|
||||
if (!isValidPath($outPath)) {
|
||||
$isCachedBuild = 0;
|
||||
|
||||
@ -75,7 +73,8 @@ sub doBuild {
|
||||
# to get notifications about specific build steps, the
|
||||
# associated log files, etc.
|
||||
my $cmd = "nix-store --max-silent-time 1800 --keep-going --no-build-output " .
|
||||
"--log-type flat --print-build-trace --realise $drvPath 2>&1";
|
||||
"--log-type flat --print-build-trace --realise $drvPath " .
|
||||
"--add-root " . gcRootFor $outPath . " 2>&1";
|
||||
|
||||
my $buildStepNr = 1;
|
||||
|
||||
|
@ -267,9 +267,6 @@ sub checkJob {
|
||||
, sha256hash => $input->{sha256hash}
|
||||
});
|
||||
}
|
||||
|
||||
# !!! this should really by done by nix-instantiate to prevent a GC race.
|
||||
registerRoot $drvPath;
|
||||
});
|
||||
};
|
||||
|
||||
@ -330,9 +327,12 @@ sub checkJobSet {
|
||||
$nixExprPath .= "/" . $jobset->nixexprpath;
|
||||
|
||||
(my $res, my $jobsXml, my $stderr) = captureStdoutStderr(
|
||||
"hydra_eval_jobs", $nixExprPath, inputsToArgs($inputInfo));
|
||||
"hydra_eval_jobs", $nixExprPath, "--gc-roots-dir", getGCRootsDir,
|
||||
inputsToArgs($inputInfo));
|
||||
die "cannot evaluate the Nix expression containing the jobs:\n$stderr" unless $res;
|
||||
|
||||
print STDERR "$stderr";
|
||||
|
||||
my $jobs = XMLin($jobsXml,
|
||||
ForceArray => ['error', 'job', 'arg'],
|
||||
KeyAttr => [],
|
||||
|
@ -83,14 +83,14 @@ my @buildsToKeep = $db->resultset('Builds')->search({finished => 1, keep => 1},
|
||||
keepBuild $_ foreach @buildsToKeep;
|
||||
|
||||
|
||||
# For scheduled builds, we register the derivation and the output as a GC root.
|
||||
# For scheduled builds, we register the derivation as a GC root.
|
||||
print STDERR "*** looking for scheduled builds\n";
|
||||
foreach my $build ($db->resultset('Builds')->search({finished => 0}, {join => 'schedulingInfo'})) {
|
||||
if (isValidPath($build->drvpath)) {
|
||||
print STDERR "keeping scheduled build ", $build->id, " (",
|
||||
strftime("%Y-%m-%d %H:%M:%S", localtime($build->timestamp)), ")\n";
|
||||
registerRoot $build->drvpath;
|
||||
registerRoot $build->outpath;
|
||||
registerRoot $build->outpath if -e $build->outpath;
|
||||
} else {
|
||||
print STDERR "warning: derivation ", $build->drvpath, " has disappeared\n";
|
||||
}
|
||||
|
Reference in New Issue
Block a user