mirror of
https://github.com/NixOS/nix
synced 2025-06-25 06:31:14 +02:00
downloadFile(): Remove the "locked" (aka "immutable") flag
This was used in only one place, namely builtins.fetchurl with an expected hash. Since this can cause similar issues as described in #9814 and #9905 with the "locked" flag for fetchTarball and fetchTree, let's just remove it. Note that if an expected hash is given and the hash algorithm is SHA-256, then we will never do a download anyway if the resulting store path already exists. So removing the "locked" flag will only cause potentially unnecessary HTTP requests (subject to the tarball TTL) for non-SHA-256 hashes.
This commit is contained in:
parent
334874d101
commit
d29786f258
6 changed files with 11 additions and 13 deletions
|
@ -357,7 +357,7 @@ struct GitHubInputScheme : GitArchiveInputScheme
|
|||
auto json = nlohmann::json::parse(
|
||||
readFile(
|
||||
store->toRealPath(
|
||||
downloadFile(store, url, "source", false, headers).storePath)));
|
||||
downloadFile(store, url, "source", headers).storePath)));
|
||||
|
||||
return RefInfo {
|
||||
.rev = Hash::parseAny(std::string { json["sha"] }, HashAlgorithm::SHA1),
|
||||
|
@ -431,7 +431,7 @@ struct GitLabInputScheme : GitArchiveInputScheme
|
|||
auto json = nlohmann::json::parse(
|
||||
readFile(
|
||||
store->toRealPath(
|
||||
downloadFile(store, url, "source", false, headers).storePath)));
|
||||
downloadFile(store, url, "source", headers).storePath)));
|
||||
|
||||
return RefInfo {
|
||||
.rev = Hash::parseAny(std::string(json[0]["id"]), HashAlgorithm::SHA1)
|
||||
|
@ -495,7 +495,7 @@ struct SourceHutInputScheme : GitArchiveInputScheme
|
|||
std::string refUri;
|
||||
if (ref == "HEAD") {
|
||||
auto file = store->toRealPath(
|
||||
downloadFile(store, fmt("%s/HEAD", base_url), "source", false, headers).storePath);
|
||||
downloadFile(store, fmt("%s/HEAD", base_url), "source", headers).storePath);
|
||||
std::ifstream is(file);
|
||||
std::string line;
|
||||
getline(is, line);
|
||||
|
@ -511,7 +511,7 @@ struct SourceHutInputScheme : GitArchiveInputScheme
|
|||
std::regex refRegex(refUri);
|
||||
|
||||
auto file = store->toRealPath(
|
||||
downloadFile(store, fmt("%s/info/refs", base_url), "source", false, headers).storePath);
|
||||
downloadFile(store, fmt("%s/info/refs", base_url), "source", headers).storePath);
|
||||
std::ifstream is(file);
|
||||
|
||||
std::string line;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue