mirror of
https://github.com/NixOS/nix
synced 2025-07-07 06:01:48 +02:00
Tarball fetcher: Fix fetchToStore() and eval caching
(cherry picked from commit 9d95c228ee
)
This commit is contained in:
parent
50a71b69b0
commit
241c539f6f
2 changed files with 11 additions and 0 deletions
|
@ -260,6 +260,7 @@ std::pair<ref<SourceAccessor>, Input> Input::getAccessorUnchecked(ref<Store> sto
|
||||||
|
|
||||||
auto [accessor, final] = scheme->getAccessor(store, *this);
|
auto [accessor, final] = scheme->getAccessor(store, *this);
|
||||||
|
|
||||||
|
assert(!accessor->fingerprint);
|
||||||
accessor->fingerprint = scheme->getFingerprint(store, final);
|
accessor->fingerprint = scheme->getFingerprint(store, final);
|
||||||
|
|
||||||
return {accessor, std::move(final)};
|
return {accessor, std::move(final)};
|
||||||
|
|
|
@ -365,6 +365,16 @@ struct TarballInputScheme : CurlInputScheme
|
||||||
|
|
||||||
return {result.accessor, input};
|
return {result.accessor, input};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::optional<std::string> getFingerprint(ref<Store> store, const Input & input) const override
|
||||||
|
{
|
||||||
|
if (auto narHash = input.getNarHash())
|
||||||
|
return narHash->to_string(HashFormat::SRI, true);
|
||||||
|
else if (auto rev = input.getRev())
|
||||||
|
return rev->gitRev();
|
||||||
|
else
|
||||||
|
return std::nullopt;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
static auto rTarballInputScheme = OnStartup([] { registerInputScheme(std::make_unique<TarballInputScheme>()); });
|
static auto rTarballInputScheme = OnStartup([] { registerInputScheme(std::make_unique<TarballInputScheme>()); });
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue