daemon: When repairing, rebuild if there is no substituter.

master
Eelco Dolstra 2016-01-06 22:07:59 +01:00 committed by Ludovic Courtès
parent 1a9574e3a7
commit c56cd90cc9
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5
1 changed files with 11 additions and 2 deletions

View File

@ -3482,8 +3482,17 @@ void LocalStore::repairPath(const Path & path)
worker.run(goals);
if (goal->getExitCode() != Goal::ecSuccess)
throw Error(format("cannot repair path `%1%'") % path, worker.exitStatus());
if (goal->getExitCode() != Goal::ecSuccess) {
/* Since substituting the path didn't work, if we have a valid
deriver, then rebuild the deriver. */
Path deriver = queryDeriver(path);
if (deriver != "" && isValidPath(deriver)) {
goals.clear();
goals.insert(worker.makeDerivationGoal(deriver, StringSet(), bmRepair));
worker.run(goals);
} else
throw Error(format("cannot repair path `%1%'") % path, worker.exitStatus());
}
}