fetch-*: remove md5 support

fixes #4491
This commit is contained in:
Robin Gloster 2017-03-13 13:31:44 +01:00
parent 1c3308e9c1
commit f57185db95
No known key found for this signature in database
GPG Key ID: 5E4C836C632C2882
8 changed files with 44 additions and 24 deletions

View File

@ -1,13 +1,16 @@
{stdenv, darcs, nix}: {url, rev ? null, context ? null, md5 ? "", sha256 ? ""}: {stdenv, darcs, nix}: {url, rev ? null, context ? null, md5 ? "", sha256 ? ""}:
if md5 != "" then
throw "fetchdarcs does not support md5 anymore, please use sha256"
else
stdenv.mkDerivation { stdenv.mkDerivation {
name = "fetchdarcs"; name = "fetchdarcs";
builder = ./builder.sh; builder = ./builder.sh;
buildInputs = [darcs]; buildInputs = [darcs];
outputHashAlgo = if sha256 == "" then "md5" else "sha256"; outputHashAlgo = "sha256";
outputHashMode = "recursive"; outputHashMode = "recursive";
outputHash = if sha256 == "" then md5 else sha256; outputHash = sha256;
inherit url rev context; inherit url rev context;
} }

View File

@ -4,14 +4,17 @@
{ stdenv, chicken }: { stdenv, chicken }:
{ name, version, md5 ? "", sha256 ? "" }: { name, version, md5 ? "", sha256 ? "" }:
if md5 != "" then
throw "fetchegg does not support md5 anymore, please use sha256"
else
stdenv.mkDerivation { stdenv.mkDerivation {
name = "chicken-${name}-export"; name = "chicken-${name}-export";
builder = ./builder.sh; builder = ./builder.sh;
buildInputs = [ chicken ]; buildInputs = [ chicken ];
outputHashAlgo = if sha256 == "" then "md5" else "sha256"; outputHashAlgo = "sha256";
outputHashMode = "recursive"; outputHashMode = "recursive";
outputHash = if sha256 == "" then md5 else sha256; outputHash = sha256;
inherit version; inherit version;

View File

@ -39,18 +39,20 @@ in
server admins start using the new version? server admins start using the new version?
*/ */
assert md5 != "" || sha256 != "";
assert deepClone -> leaveDotGit; assert deepClone -> leaveDotGit;
if md5 != "" then
throw "fetchgit does not support md5 anymore, please use sha256"
else
stdenv.mkDerivation { stdenv.mkDerivation {
inherit name; inherit name;
builder = ./builder.sh; builder = ./builder.sh;
fetcher = "${./nix-prefetch-git}"; # This must be a string to ensure it's called with bash. fetcher = "${./nix-prefetch-git}"; # This must be a string to ensure it's called with bash.
buildInputs = [git]; buildInputs = [git];
outputHashAlgo = if sha256 == "" then "md5" else "sha256"; outputHashAlgo = "sha256";
outputHashMode = "recursive"; outputHashMode = "recursive";
outputHash = if sha256 == "" then md5 else sha256; outputHash = sha256;
inherit url rev leaveDotGit fetchSubmodules deepClone branchName; inherit url rev leaveDotGit fetchSubmodules deepClone branchName;

View File

@ -1,5 +1,8 @@
{stdenv, mercurial, nix}: {name ? null, url, rev ? null, md5 ? null, sha256 ? null, fetchSubrepos ? false}: {stdenv, mercurial, nix}: {name ? null, url, rev ? null, md5 ? null, sha256 ? null, fetchSubrepos ? false}:
if md5 != null then
throw "fetchhg does not support md5 anymore, please use sha256"
else
# TODO: statically check if mercurial as the https support if the url starts woth https. # TODO: statically check if mercurial as the https support if the url starts woth https.
stdenv.mkDerivation { stdenv.mkDerivation {
name = "hg-archive" + (if name != null then "-${name}" else ""); name = "hg-archive" + (if name != null then "-${name}" else "");
@ -8,14 +11,11 @@ stdenv.mkDerivation {
impureEnvVars = stdenv.lib.fetchers.proxyImpureEnvVars; impureEnvVars = stdenv.lib.fetchers.proxyImpureEnvVars;
# Nix <= 0.7 compatibility.
id = md5;
subrepoClause = if fetchSubrepos then "S" else ""; subrepoClause = if fetchSubrepos then "S" else "";
outputHashAlgo = if md5 != null then "md5" else "sha256"; outputHashAlgo = "sha256";
outputHashMode = "recursive"; outputHashMode = "recursive";
outputHash = if md5 != null then md5 else sha256; outputHash = sha256;
inherit url rev; inherit url rev;
preferLocalBuild = true; preferLocalBuild = true;

View File

@ -8,9 +8,12 @@ attrs @
, md5 ? "" , md5 ? ""
, ... , ...
}: }:
if md5 != "" then
throw "fetchnuget does not support md5 anymore, please use sha256"
else
buildDotnetPackage ({ buildDotnetPackage ({
src = fetchurl { src = fetchurl {
inherit url sha256 md5; inherit url sha256;
name = "${baseName}.${version}.zip"; name = "${baseName}.${version}.zip";
}; };

View File

@ -25,14 +25,17 @@ let
name_ = if name == null then "${repoName}-r${toString rev}" else name; name_ = if name == null then "${repoName}-r${toString rev}" else name;
in in
if md5 != "" then
throw "fetchsvn does not support md5 anymore, please use sha256"
else
stdenv.mkDerivation { stdenv.mkDerivation {
name = name_; name = name_;
builder = ./builder.sh; builder = ./builder.sh;
buildInputs = [subversion]; buildInputs = [subversion];
outputHashAlgo = if sha256 == "" then "md5" else "sha256"; outputHashAlgo = "sha256";
outputHashMode = "recursive"; outputHashMode = "recursive";
outputHash = if sha256 == "" then md5 else sha256; outputHash = sha256;
inherit url rev sshSupport openssh ignoreExternals ignoreKeywords; inherit url rev sshSupport openssh ignoreExternals ignoreKeywords;

View File

@ -1,14 +1,18 @@
{stdenv, subversion, sshSupport ? false, openssh ? null, expect}: {stdenv, subversion, sshSupport ? false, openssh ? null, expect}:
{username, password, url, rev ? "HEAD", md5 ? "", sha256 ? ""}: {username, password, url, rev ? "HEAD", md5 ? "", sha256 ? ""}:
if md5 != "" then
throw "fetchsvnssh does not support md5 anymore, please use sha256"
else
stdenv.mkDerivation { stdenv.mkDerivation {
name = "svn-export-ssh"; name = "svn-export-ssh";
builder = ./builder.sh; builder = ./builder.sh;
buildInputs = [subversion expect]; buildInputs = [subversion expect];
outputHashAlgo = if sha256 == "" then "md5" else "sha256"; outputHashAlgo = "sha256";
outputHashMode = "recursive"; outputHashMode = "recursive";
outputHash = if sha256 == "" then md5 else sha256; outputHash = sha256;
sshSubversion = ./sshsubversion.exp; sshSubversion = ./sshsubversion.exp;

View File

@ -87,12 +87,14 @@ assert sha512 != "" -> builtins.compareVersions "1.11" builtins.nixVersion <= 0;
let let
hasHash = showURLs || (outputHash != "" && outputHashAlgo != "") hasHash = showURLs || (outputHash != "" && outputHashAlgo != "")
|| md5 != "" || sha1 != "" || sha256 != "" || sha512 != ""; || sha1 != "" || sha256 != "" || sha512 != "";
urls_ = if urls != [] then urls else [url]; urls_ = if urls != [] then urls else [url];
in in
if (!hasHash) then throw "Specify hash for fetchurl fixed-output derivation: ${stdenv.lib.concatStringsSep ", " urls_}" else stdenv.mkDerivation { if md5 != "" then throw "fetchsvnssh does not support md5 anymore, please use sha256 or sha512"
else if (!hasHash) then throw "Specify hash for fetchurl fixed-output derivation: ${stdenv.lib.concatStringsSep ", " urls_}"
else stdenv.mkDerivation {
name = name =
if showURLs then "urls" if showURLs then "urls"
else if name != "" then name else if name != "" then name
@ -110,9 +112,9 @@ if (!hasHash) then throw "Specify hash for fetchurl fixed-output derivation: ${s
# New-style output content requirements. # New-style output content requirements.
outputHashAlgo = if outputHashAlgo != "" then outputHashAlgo else outputHashAlgo = if outputHashAlgo != "" then outputHashAlgo else
if sha512 != "" then "sha512" else if sha256 != "" then "sha256" else if sha1 != "" then "sha1" else "md5"; if sha512 != "" then "sha512" else if sha256 != "" then "sha256" else "sha1";
outputHash = if outputHash != "" then outputHash else outputHash = if outputHash != "" then outputHash else
if sha512 != "" then sha512 else if sha256 != "" then sha256 else if sha1 != "" then sha1 else md5; if sha512 != "" then sha512 else if sha256 != "" then sha256 else sha1;
outputHashMode = if (recursiveHash || executable) then "recursive" else "flat"; outputHashMode = if (recursiveHash || executable) then "recursive" else "flat";