aboutsummaryrefslogtreecommitdiff
path: root/src/libfetchers/tarball.cc
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2023-08-22 19:29:25 +0200
committerEelco Dolstra <edolstra@gmail.com>2023-08-22 21:51:26 +0200
commit81045f243f91adcd44da0080c9ac83d2c4176125 (patch)
tree8618a71ccad18c52952f8922da1f36b584a0b03d /src/libfetchers/tarball.cc
parent3fcdea4ca0f362d21637002918b49cd41358e8e2 (diff)
Tarball trees: Propagate lastModified
This makes them behave consistently with GitHub/GitLab flakes.
Diffstat (limited to 'src/libfetchers/tarball.cc')
-rw-r--r--src/libfetchers/tarball.cc5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/libfetchers/tarball.cc b/src/libfetchers/tarball.cc
index 107d38e92..e3a41e75e 100644
--- a/src/libfetchers/tarball.cc
+++ b/src/libfetchers/tarball.cc
@@ -232,7 +232,7 @@ struct CurlInputScheme : InputScheme
if (type != inputType()) return {};
// FIXME: some of these only apply to TarballInputScheme.
- std::set<std::string> allowedNames = {"type", "url", "narHash", "name", "unpack", "rev", "revCount"};
+ std::set<std::string> allowedNames = {"type", "url", "narHash", "name", "unpack", "rev", "revCount", "lastModified"};
for (auto & [name, value] : attrs)
if (!allowedNames.count(name))
throw Error("unsupported %s input attribute '%s'", *type, name);
@@ -310,6 +310,9 @@ struct TarballInputScheme : CurlInputScheme
input = immutableInput;
}
+ if (result.lastModified && !input.attrs.contains("lastModified"))
+ input.attrs.insert_or_assign("lastModified", uint64_t(result.lastModified));
+
return {result.tree.storePath, std::move(input)};
}
};