mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-11-12 12:07:47 +03:00
fetchurl: cleanup a bit by moving the warning into assert
This commit is contained in:
parent
9dcecbdb31
commit
9437e4da35
@ -132,6 +132,13 @@ let
|
||||
else throw "fetchurl requires a hash for fixed-output derivation: ${lib.concatStringsSep ", " urls_}";
|
||||
in
|
||||
|
||||
assert (lib.isList curlOpts) -> lib.warn ''
|
||||
fetchurl for ${toString (builtins.head urls_)}: curlOpts is a list (${lib.generators.toPretty { multiline = false; } curlOpts}), which is not supported anymore.
|
||||
- If you wish to get the same effect as before, for elements with spaces (even if escaped) to expand to multiple curl arguments, use a string argument instead:
|
||||
curlOpts = ${lib.strings.escapeNixString (toString curlOpts)};
|
||||
- If you wish for each list element to be passed as a separate curl argument, allowing arguments to contain spaces, use curlOptsList instead:
|
||||
curlOptsList = [ ${lib.concatMapStringsSep " " lib.strings.escapeNixString curlOpts} ];'' true;
|
||||
|
||||
stdenvNoCC.mkDerivation ((
|
||||
if (pname != "" && version != "") then
|
||||
{ inherit pname version; }
|
||||
@ -161,12 +168,7 @@ stdenvNoCC.mkDerivation ((
|
||||
|
||||
outputHashMode = if (recursiveHash || executable) then "recursive" else "flat";
|
||||
|
||||
curlOpts = lib.warnIf (lib.isList curlOpts) ''
|
||||
fetchurl for ${toString (builtins.head urls_)}: curlOpts is a list (${lib.generators.toPretty { multiline = false; } curlOpts}), which is not supported anymore.
|
||||
- If you wish to get the same effect as before, for elements with spaces (even if escaped) to expand to multiple curl arguments, use a string argument instead:
|
||||
curlOpts = ${lib.strings.escapeNixString (toString curlOpts)};
|
||||
- If you wish for each list element to be passed as a separate curl argument, allowing arguments to contain spaces, use curlOptsList instead:
|
||||
curlOptsList = [ ${lib.concatMapStringsSep " " lib.strings.escapeNixString curlOpts} ];'' curlOpts;
|
||||
inherit curlOpts;
|
||||
curlOptsList = lib.escapeShellArgs curlOptsList;
|
||||
inherit showURLs mirrorsFile postFetch downloadToTemp executable;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user