1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-20 09:19:36 +01:00

Merge branch 'enum-class' into no-hash-type-unknown

This commit is contained in:
John Ericson 2020-06-18 21:58:27 +00:00
commit bbbf3602a3
151 changed files with 2757 additions and 1788 deletions

View file

@ -196,9 +196,9 @@ struct TarballInput : Input
// NAR hashes are preferred over file hashes since tar/zip files
// don't have a canonical representation.
if (narHash)
url2.query.insert_or_assign("narHash", narHash->to_string(Base::SRI));
url2.query.insert_or_assign("narHash", narHash->to_string(Base::SRI, true));
else if (hash)
url2.query.insert_or_assign("hash", hash->to_string(Base::SRI));
url2.query.insert_or_assign("hash", hash->to_string(Base::SRI, true));
return url2;
}
@ -207,7 +207,7 @@ struct TarballInput : Input
Attrs attrs;
attrs.emplace("url", url.to_string());
if (hash)
attrs.emplace("hash", hash->to_string(Base::SRI));
attrs.emplace("hash", hash->to_string(Base::SRI, true));
return attrs;
}
@ -264,8 +264,7 @@ struct TarballInputScheme : InputScheme
auto input = std::make_unique<TarballInput>(parseURL(getStrAttr(attrs, "url")));
if (auto hash = maybeGetStrAttr(attrs, "hash"))
// FIXME: require SRI hash.
input->hash = Hash(*hash);
input->hash = newHashAllowEmpty(*hash, {});
return input;
}