diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2022-03-09 12:25:35 +0100 |
---|---|---|
committer | Eelco Dolstra <edolstra@gmail.com> | 2022-03-09 12:25:35 +0100 |
commit | 761242afa08d5c9280ba6bd63a310b4334b83bb2 (patch) | |
tree | 7509dfda4c52ecab6e972e3f1ed9d3b1d0360b5b /src/libcmd | |
parent | a4604f19284254ac98f19a13ff7c2216de7fe176 (diff) |
BuildResult: Use DerivedPath
Diffstat (limited to 'src/libcmd')
-rw-r--r-- | src/libcmd/installables.cc | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/src/libcmd/installables.cc b/src/libcmd/installables.cc index d1ed19acf..b7623d4ba 100644 --- a/src/libcmd/installables.cc +++ b/src/libcmd/installables.cc @@ -826,15 +826,17 @@ BuiltPaths Installable::build( for (auto & buildResult : store->buildPathsWithResults(pathsToBuild, bMode, evalStore)) { if (!buildResult.success()) buildResult.rethrow(); - if (buildResult.drvPath) { - std::map<std::string, StorePath> outputs; - for (auto & path : buildResult.builtOutputs) - outputs.emplace(path.first.outputName, path.second.outPath); - res.push_back(BuiltPath::Built{*buildResult.drvPath, outputs}); - } else if (buildResult.outPath) { - res.push_back(BuiltPath::Opaque{*buildResult.outPath}); - } else - abort(); + std::visit(overloaded { + [&](const DerivedPath::Built & bfd) { + std::map<std::string, StorePath> outputs; + for (auto & path : buildResult.builtOutputs) + outputs.emplace(path.first.outputName, path.second.outPath); + res.push_back(BuiltPath::Built { bfd.drvPath, outputs }); + }, + [&](const DerivedPath::Opaque & bo) { + res.push_back(BuiltPath::Opaque { bo.path }); + }, + }, buildResult.path.raw()); } return res; } |