Merge pull request #1047 from NixOS/revert-825-fix/unhelpful-errors-in-aggregates

Revert "Fix unhelpful error messages in aggregate jobs."
This commit is contained in:
Graham Christensen 2021-10-23 22:23:40 -04:00 committed by GitHub
commit 7fbf5cbd42
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -438,16 +438,12 @@ int main(int argc, char * * argv)
for (auto i = state->jobs.begin(); i != state->jobs.end(); ++i) {
auto jobName = i.key();
auto & job = i.value();
// For the error message
std::string lastTriedJobName = i.key();
auto named = job.find("namedConstituents");
if (named == job.end()) continue;
try {
if (myArgs.dryRun) {
for (std::string jobName2 : *named) {
lastTriedJobName = jobName2;
auto job2 = state->jobs.find(jobName2);
if (job2 == state->jobs.end())
throw Error("aggregate job '%s' references non-existent job '%s'", jobName, jobName2);
@ -459,23 +455,14 @@ int main(int argc, char * * argv)
auto drv = store->readDerivation(drvPath);
for (std::string jobName2 : *named) {
lastTriedJobName = jobName2;
auto job2 = state->jobs.find(jobName2);
if (job2 == state->jobs.end())
throw Error("aggregate job '%s' references non-existent job '%s'", jobName, jobName2);
if ((*job2).find("error") != (*job2).end()) {
if (job.find("error") == job.end()) {
job["error"] = fmt("Errors aggregating aggregate job '%1%'.\n", jobName);
}
job["error"] = fmt("While handling '%1%': %2%\n", jobName2, (std::string) (*job2)["error"]);
} else {
auto drvPath2 = store->parseStorePath((std::string) (*job2)["drvPath"]);
auto drv2 = store->readDerivation(drvPath2);
job["constituents"].push_back(store->printStorePath(drvPath2));
drv.inputDrvs[drvPath2] = {drv2.outputs.begin()->first};
}
}
std::string drvName(drvPath.name());
assert(hasSuffix(drvName, drvExtension));
@ -491,13 +478,6 @@ int main(int argc, char * * argv)
job["drvPath"] = newDrvPath;
job["outputs"]["out"] = store->printStorePath(outPath);
}
} catch (std::exception & e) {
// Print more information to help debugging.
printError("Unexpected error in hydra-eval-jobs when handling job '%s', when producing aggregate job '%s':", lastTriedJobName, jobName);
// And throw the original exception!
throw;
}
job.erase("namedConstituents");
}