Fix build with latest Nix

Recently a few internal APIs have changed[1]. The `outputPaths` function
has been removed and a lot of data structures are modeled with
`std::optional` which broke compilation.

This patch updates the code in `hydra-queue-runner` accordingly to make
sure that Hydra compiles again.

[1] https://github.com/NixOS/nix/pull/3883
This commit is contained in:
Maximilian Bosch
2020-09-26 23:37:39 +02:00
parent 2394140843
commit 9cc76f6d69
6 changed files with 59 additions and 45 deletions

View File

@ -16,10 +16,13 @@ BuildOutput getBuildOutput(
BuildOutput res;
/* Compute the closure size. */
auto outputs = drv.outputPaths(*store);
StorePathSet outputs;
StorePathSet closure;
for (auto & output : outputs)
store->computeFSClosure(output, closure);
for (auto & i : drv.outputsAndOptPaths(*store))
if (i.second.second) {
store->computeFSClosure(*i.second.second, closure);
outputs.insert(*i.second.second);
}
for (auto & path : closure) {
auto info = store->queryPathInfo(path);
res.closureSize += info->narSize;
@ -104,13 +107,13 @@ BuildOutput getBuildOutput(
/* If no build products were explicitly declared, then add all
outputs as a product of type "nix-build". */
if (!explicitProducts) {
for (auto & output : drv.outputs) {
for (auto & [name, output] : drv.outputs) {
BuildProduct product;
auto outPath = output.second.path(*store, drv.name);
product.path = store->printStorePath(outPath);
auto outPath = output.path(*store, drv.name, name);
product.path = store->printStorePath(*outPath);
product.type = "nix-build";
product.subtype = output.first == "out" ? "" : output.first;
product.name = outPath.name();
product.subtype = name == "out" ? "" : name;
product.name = outPath->name();
auto file = narMembers.find(product.path);
assert(file != narMembers.end());