mirror of
https://github.com/NixOS/nix.git
synced 2024-11-22 06:42:28 +00:00
Tarball fetcher: Handle lock files that *do* contain lastModified
Fixes flake-regressions/tests/DeterminateSystems/eva/0.1.0: error: 'lastModified' attribute mismatch in input 'https://api.flakehub.com/f/pinned/ipetkov/crane/0.14.1/018ac45c-ff5e-7076-b956-d478a0336516/source.tar.gz?narHash=sha256-mnE14re43v3/Jc50Jv0BKPMtEk7FEtDSligP6B5HwlI%3D', expected 1695511445
This commit is contained in:
parent
78b5b4c105
commit
7d1f7f8d59
@ -220,8 +220,8 @@ void InputScheme::checkLocks(const Input & specified, const Input & final) const
|
||||
|
||||
if (auto prevLastModified = specified.getLastModified()) {
|
||||
if (final.getLastModified() != prevLastModified)
|
||||
throw Error("'lastModified' attribute mismatch in input '%s', expected %d",
|
||||
final.to_string(), *prevLastModified);
|
||||
throw Error("'lastModified' attribute mismatch in input '%s', expected %d, got %d",
|
||||
final.to_string(), *prevLastModified, final.getLastModified().value_or(-1));
|
||||
}
|
||||
|
||||
if (auto prevRev = specified.getRev()) {
|
||||
|
@ -384,11 +384,13 @@ struct TarballInputScheme : CurlInputScheme
|
||||
input = immutableInput;
|
||||
}
|
||||
|
||||
/* If we got a lastModified and the input is not final and
|
||||
doesn't have one, then return it. Note that we don't do
|
||||
this if the input is final for compatibility with old lock
|
||||
files that didn't include lastModified. */
|
||||
if (result.lastModified && !_input.isFinal() && !input.attrs.contains("lastModified"))
|
||||
/* If we got a lastModified, then return it. But for
|
||||
compatibility with old lock files that didn't include
|
||||
lastModified, don't do this if the original input was final
|
||||
and didn't contain a lastModified. */
|
||||
if (result.lastModified
|
||||
&& !input.attrs.contains("lastModified")
|
||||
&& (!_input.isFinal() || _input.attrs.contains("lastModified")))
|
||||
input.attrs.insert_or_assign("lastModified", uint64_t(result.lastModified));
|
||||
|
||||
input.attrs.insert_or_assign("narHash",
|
||||
|
Loading…
Reference in New Issue
Block a user