forked from mirrors/nixpkgs
fetchurl: Support SHA-512 hashes
This commit is contained in:
parent
d0fd551876
commit
3ecbe604ef
|
@ -61,6 +61,7 @@ in
|
|||
, md5 ? ""
|
||||
, sha1 ? ""
|
||||
, sha256 ? ""
|
||||
, sha512 ? ""
|
||||
|
||||
, recursiveHash ? false
|
||||
|
||||
|
@ -91,7 +92,7 @@ assert (urls == []) != (url == "");
|
|||
let
|
||||
|
||||
hasHash = showURLs || (outputHash != "" && outputHashAlgo != "")
|
||||
|| md5 != "" || sha1 != "" || sha256 != "";
|
||||
|| md5 != "" || sha1 != "" || sha256 != "" || sha512 != "";
|
||||
urls_ = if urls != [] then urls else [url];
|
||||
|
||||
in
|
||||
|
@ -114,9 +115,9 @@ if (!hasHash) then throw "Specify hash for fetchurl fixed-output derivation: ${s
|
|||
|
||||
# New-style output content requirements.
|
||||
outputHashAlgo = if outputHashAlgo != "" then outputHashAlgo else
|
||||
if sha256 != "" then "sha256" else if sha1 != "" then "sha1" else "md5";
|
||||
if sha512 != "" then "sha512" else if sha256 != "" then "sha256" else if sha1 != "" then "sha1" else "md5";
|
||||
outputHash = if outputHash != "" then outputHash else
|
||||
if sha256 != "" then sha256 else if sha1 != "" then sha1 else md5;
|
||||
if sha512 != "" then sha512 else if sha256 != "" then sha256 else if sha1 != "" then sha1 else md5;
|
||||
|
||||
outputHashMode = if (recursiveHash || executable) then "recursive" else "flat";
|
||||
|
||||
|
|
Loading…
Reference in a new issue