mirror of
https://github.com/NixOS/nix
synced 2025-06-25 19:01:16 +02:00
Tarball fetcher: Include revCount/lastModified in the fingerprint
This can influence the evaluation result so they should be included in
the fingerprint.
(cherry picked from commit 5b4102c3b2
)
This commit is contained in:
parent
e38f45b19f
commit
b91c7cf077
2 changed files with 12 additions and 2 deletions
|
@ -949,10 +949,20 @@ std::optional<Fingerprint> LockedFlake::getFingerprint(ref<Store> store) const
|
|||
auto fingerprint = flake.lockedRef.input.getFingerprint(store);
|
||||
if (!fingerprint) return std::nullopt;
|
||||
|
||||
*fingerprint += fmt(";%s;%s", flake.lockedRef.subdir, lockFile);
|
||||
|
||||
/* Include revCount and lastModified because they're not
|
||||
necessarily implied by the content fingerprint (e.g. for
|
||||
tarball flakes) but can influence the evaluation result. */
|
||||
if (auto revCount = flake.lockedRef.input.getRevCount())
|
||||
*fingerprint += fmt(";revCount=%d", *revCount);
|
||||
if (auto lastModified = flake.lockedRef.input.getLastModified())
|
||||
*fingerprint += fmt(";lastModified=%d", *lastModified);
|
||||
|
||||
// FIXME: as an optimization, if the flake contains a lock file
|
||||
// and we haven't changed it, then it's sufficient to use
|
||||
// flake.sourceInfo.storePath for the fingerprint.
|
||||
return hashString(HashAlgorithm::SHA256, fmt("%s;%s;%s", *fingerprint, flake.lockedRef.subdir, lockFile));
|
||||
return hashString(HashAlgorithm::SHA256, *fingerprint);
|
||||
}
|
||||
|
||||
Flake::~Flake() { }
|
||||
|
|
|
@ -419,7 +419,7 @@ namespace nlohmann {
|
|||
using namespace nix;
|
||||
|
||||
fetchers::PublicKey adl_serializer<fetchers::PublicKey>::from_json(const json & json) {
|
||||
fetchers::PublicKey res = { };
|
||||
fetchers::PublicKey res = { };
|
||||
if (auto type = optionalValueAt(json, "type"))
|
||||
res.type = getString(*type);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue