aboutsummaryrefslogtreecommitdiff
path: root/src/libexpr/primops
diff options
context:
space:
mode:
authorRobert Hensing <robert@roberthensing.nl>2023-06-05 11:37:41 +0200
committerRobert Hensing <robert@roberthensing.nl>2023-06-30 18:22:47 +0200
commit55888633dd323c83cd1db3773d82dc954da34888 (patch)
tree426c71d523bd5ee7c9b6b06ab6cb3971b755d5ff /src/libexpr/primops
parent8dca95386c9ab8b13886716ec31e1b2936a3ef10 (diff)
makeContentAddressed: Add single path helper
Diffstat (limited to 'src/libexpr/primops')
-rw-r--r--src/libexpr/primops/fetchClosure.cc10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/libexpr/primops/fetchClosure.cc b/src/libexpr/primops/fetchClosure.cc
index 6d2271853..6a15c826f 100644
--- a/src/libexpr/primops/fetchClosure.cc
+++ b/src/libexpr/primops/fetchClosure.cc
@@ -94,14 +94,12 @@ static void prim_fetchClosure(EvalState & state, const PosIdx pos, Value * * arg
if (enableRewriting) {
if (!toPath || !state.store->isValidPath(*toPath)) {
- auto remappings = makeContentAddressed(*fromStore, *state.store, { *fromPath });
- auto i = remappings.find(*fromPath);
- assert(i != remappings.end());
- if (toPath && *toPath != i->second)
+ auto rewrittenPath = makeContentAddressed(*fromStore, *state.store, *fromPath);
+ if (toPath && *toPath != rewrittenPath)
throw Error({
.msg = hintfmt("rewriting '%s' to content-addressed form yielded '%s', while '%s' was expected",
state.store->printStorePath(*fromPath),
- state.store->printStorePath(i->second),
+ state.store->printStorePath(rewrittenPath),
state.store->printStorePath(*toPath)),
.errPos = state.positions[pos]
});
@@ -111,7 +109,7 @@ static void prim_fetchClosure(EvalState & state, const PosIdx pos, Value * * arg
"rewriting '%s' to content-addressed form yielded '%s'; "
"please set this in the 'toPath' attribute passed to 'fetchClosure'",
state.store->printStorePath(*fromPath),
- state.store->printStorePath(i->second)),
+ state.store->printStorePath(rewrittenPath)),
.errPos = state.positions[pos]
});
}