-
-
Couldn't load subscription status.
- Fork 1.8k
Fix fetchToStore caching #14050
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix fetchToStore caching #14050
Changes from all commits
55c7ef9
28d11c5
3450a72
ec6d5c7
1d13049
4b9735b
6721ef5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,7 @@ | ||
| #include "nix/store/store-api.hh" | ||
| #include "nix/expr/eval.hh" | ||
| #include "nix/util/mounted-source-accessor.hh" | ||
| #include "nix/fetchers/fetch-to-store.hh" | ||
|
|
||
| namespace nix { | ||
|
|
||
|
|
@@ -18,4 +20,27 @@ SourcePath EvalState::storePath(const StorePath & path) | |
| return {rootFS, CanonPath{store->printStorePath(path)}}; | ||
| } | ||
|
|
||
| StorePath | ||
| EvalState::mountInput(fetchers::Input & input, const fetchers::Input & originalInput, ref<SourceAccessor> accessor) | ||
| { | ||
| auto storePath = fetchToStore(fetchSettings, *store, accessor, FetchMode::Copy, input.getName()); | ||
|
|
||
| allowPath(storePath); // FIXME: should just whitelist the entire virtual store | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would like this part done sooner rather than later |
||
|
|
||
| storeFS->mount(CanonPath(store->printStorePath(storePath)), accessor); | ||
|
|
||
| auto narHash = store->queryPathInfo(storePath)->narHash; | ||
| input.attrs.insert_or_assign("narHash", narHash.to_string(HashFormat::SRI, true)); | ||
|
|
||
| if (originalInput.getNarHash() && narHash != *originalInput.getNarHash()) | ||
| throw Error( | ||
| (unsigned int) 102, | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Isn't there an enum for this? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't think so... There is There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was meaning to clean that up and unify with |
||
| "NAR hash mismatch in input '%s', expected '%s' but got '%s'", | ||
| originalInput.to_string(), | ||
| narHash.to_string(HashFormat::SRI, true), | ||
| originalInput.getNarHash()->to_string(HashFormat::SRI, true)); | ||
|
|
||
| return storePath; | ||
| } | ||
|
|
||
| } // namespace nix | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This stuff has been on lazy trees for a while I know, but I guess a this point I am skeptical it is still needed? Especially with #14081
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, they're still needed.