1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-27 12:41:00 +01:00

"newtype" BuildableReq

This makes for better types errors and allows us to give it methods.
This commit is contained in:
John Ericson 2021-04-05 09:24:42 -04:00
parent 4fe41c6db3
commit 9dfb97c987
8 changed files with 24 additions and 16 deletions

View file

@ -73,7 +73,7 @@ DerivationGoal::DerivationGoal(const StorePath & drvPath,
state = &DerivationGoal::getDerivation;
name = fmt(
"building of '%s' from .drv file",
to_string(worker.store, BuildableReqFromDrv { drvPath, wantedOutputs }));
BuildableReqFromDrv { drvPath, wantedOutputs }.to_string(worker.store));
trace("created");
mcExpectedBuilds = std::make_unique<MaintainCount<uint64_t>>(worker.expectedBuilds);
@ -94,7 +94,7 @@ DerivationGoal::DerivationGoal(const StorePath & drvPath, const BasicDerivation
state = &DerivationGoal::haveDerivation;
name = fmt(
"building of '%s' from in-memory derivation",
to_string(worker.store, BuildableReqFromDrv { drvPath, drv.outputNames() }));
BuildableReqFromDrv { drvPath, drv.outputNames() }.to_string(worker.store));
trace("created");
mcExpectedBuilds = std::make_unique<MaintainCount<uint64_t>>(worker.expectedBuilds);

View file

@ -19,7 +19,7 @@ void Store::buildPaths(const std::vector<BuildableReq> & reqs, BuildMode buildMo
[&](BuildableOpaque bo) {
goals.insert(worker.makePathSubstitutionGoal(bo.path, buildMode == bmRepair ? Repair : NoRepair));
},
}, br);
}, br.raw());
}
worker.run(goals);

View file

@ -1200,7 +1200,7 @@ static StorePath pathPartOfReq(const BuildableReq & req)
[&](BuildableReqFromDrv bfd) {
return bfd.drvPath;
},
}, req);
}, req.raw());
}
@ -1340,7 +1340,7 @@ struct RestrictedStore : public virtual RestrictedStoreConfig, public virtual Lo
for (auto & req : paths) {
if (!goal.isAllowed(req))
throw InvalidPath("cannot build '%s' in recursive Nix because path is unknown", to_string(*next, req));
throw InvalidPath("cannot build '%s' in recursive Nix because path is unknown", req.to_string(*next));
}
next->buildPaths(paths, buildMode);