aboutsummaryrefslogtreecommitdiff
path: root/src/libstore/build/entry-points.cc
diff options
context:
space:
mode:
authorJohn Ericson <John.Ericson@Obsidian.Systems>2021-03-02 03:50:41 +0000
committerJohn Ericson <John.Ericson@Obsidian.Systems>2021-04-05 08:33:00 -0400
commit255d145ba7ac907d1cba8d088da556b591627756 (patch)
tree3fe8f3721b4416699b3a1f9ddf2a5c7d17c4471f /src/libstore/build/entry-points.cc
parent32f4454b9fa3ac30d58e738ece322eb19a0728ba (diff)
Use `BuildableReq` for `buildPaths` and `ensurePath`
This avoids an ambiguity where the `StorePathWithOutputs { drvPath, {} }` could mean "build `brvPath`" or "substitute `drvPath`" depending on context. It also brings the internals closer in line to the new CLI, by generalizing the `Buildable` type is used there and makes that distinction already. In doing so, relegate `StorePathWithOutputs` to being a type just for backwards compatibility (CLI and RPC).
Diffstat (limited to 'src/libstore/build/entry-points.cc')
-rw-r--r--src/libstore/build/entry-points.cc16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/libstore/build/entry-points.cc b/src/libstore/build/entry-points.cc
index 686364440..d1973d78b 100644
--- a/src/libstore/build/entry-points.cc
+++ b/src/libstore/build/entry-points.cc
@@ -6,16 +6,20 @@
namespace nix {
-void Store::buildPaths(const std::vector<StorePathWithOutputs> & drvPaths, BuildMode buildMode)
+void Store::buildPaths(const std::vector<BuildableReq> & reqs, BuildMode buildMode)
{
Worker worker(*this);
Goals goals;
- for (auto & path : drvPaths) {
- if (path.path.isDerivation())
- goals.insert(worker.makeDerivationGoal(path.path, path.outputs, buildMode));
- else
- goals.insert(worker.makePathSubstitutionGoal(path.path, buildMode == bmRepair ? Repair : NoRepair));
+ for (auto & br : reqs) {
+ std::visit(overloaded {
+ [&](BuildableReqFromDrv bfd) {
+ goals.insert(worker.makeDerivationGoal(bfd.drvPath, bfd.outputs, buildMode));
+ },
+ [&](BuildableOpaque bo) {
+ goals.insert(worker.makePathSubstitutionGoal(bo.path, buildMode == bmRepair ? Repair : NoRepair));
+ },
+ }, br);
}
worker.run(goals);