nix eval-hydra-jobs: Check aggregate jobs in --dry-run mode

This commit is contained in:
Eelco Dolstra 2020-02-18 19:26:11 +01:00
parent 8f9dcfc671
commit 1351101c28

View file

@ -361,8 +361,17 @@ struct CmdEvalHydraJobs : MixJSON, MixDryRun, InstallableCommand
auto & job = i.value(); auto & job = i.value();
auto named = job.find("namedConstituents"); auto named = job.find("namedConstituents");
if (named == job.end() || dryRun) continue; if (named == job.end()) continue;
if (dryRun) {
for (std::string jobName2 : *named) {
auto job2 = state->jobs.find(jobName2);
if (job2 == state->jobs.end())
throw Error("aggregate job '%s' references non-existent job '%s'", jobName, jobName2);
std::string drvPath2 = (*job2)["drvPath"];
job["constituents"].push_back(drvPath2);
}
} else {
std::string drvPath = job["drvPath"]; std::string drvPath = job["drvPath"];
auto drv = readDerivation(*store, drvPath); auto drv = readDerivation(*store, drvPath);
@ -387,6 +396,8 @@ struct CmdEvalHydraJobs : MixJSON, MixDryRun, InstallableCommand
job["drvPath"] = newDrvPath; job["drvPath"] = newDrvPath;
job["outputs"]["out"] = store->printStorePath(outPath); job["outputs"]["out"] = store->printStorePath(outPath);
}
job.erase("namedConstituents"); job.erase("namedConstituents");
} }