diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2022-03-02 10:57:19 +0100 |
---|---|---|
committer | Eelco Dolstra <edolstra@gmail.com> | 2022-03-02 23:58:58 +0100 |
commit | b55d79728ccbd2581fa3aa7b2ec7f498aa2285d6 (patch) | |
tree | 730a2a80d984d557f3ff0c50da8916f97e6c02af /src/libcmd/installables.cc | |
parent | 3e3d0711d4c4409172b3e3f342e204d04d554f4b (diff) |
Add EvalState::coerceToStorePath() helper
This is useful whenever we want to evaluate something to a store path
(e.g. in get-drvs.cc).
Extracted from the lazy-trees branch (where we can require that a
store path must come from a store source tree accessor).
Diffstat (limited to 'src/libcmd/installables.cc')
-rw-r--r-- | src/libcmd/installables.cc | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/libcmd/installables.cc b/src/libcmd/installables.cc index f18be5287..3209456bf 100644 --- a/src/libcmd/installables.cc +++ b/src/libcmd/installables.cc @@ -468,10 +468,10 @@ std::vector<InstallableValue::DerivationInfo> InstallableAttrPath::toDerivations std::vector<DerivationInfo> res; for (auto & drvInfo : drvInfos) { - res.push_back({ - state->store->parseStorePath(drvInfo.queryDrvPath()), - drvInfo.queryOutputName() - }); + auto drvPath = drvInfo.queryDrvPath(); + if (!drvPath) + throw Error("'%s' is not a derivation", what()); + res.push_back({ *drvPath, drvInfo.queryOutputName() }); } return res; |