diff options
-rw-r--r-- | pkgs/build-support/fetchpatch/default.nix | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/pkgs/build-support/fetchpatch/default.nix b/pkgs/build-support/fetchpatch/default.nix index d059715cedc..a3ca6685147 100644 --- a/pkgs/build-support/fetchpatch/default.nix +++ b/pkgs/build-support/fetchpatch/default.nix @@ -8,6 +8,7 @@ { relative ? null , stripLen ? 0 +, decode ? "cat" # custom command to decode patch e.g. base64 -d , extraPrefix ? null , excludes ? [] , includes ? [] @@ -36,6 +37,17 @@ fetchurl ({ exit 1 fi + set +e + ${decode} < "$out" > "$tmpfile" + if [ $? -ne 0 ] || [ ! -s "$tmpfile" ]; then + echo 'Failed to decode patch with command "'${lib.escapeShellArg decode}'"' >&2 + echo 'Fetched file was (limited to 128 bytes):' >&2 + od -A x -t x1z -v -N 128 "$out" >&2 + exit 1 + fi + set -e + mv "$tmpfile" "$out" + "${patchutils}/bin/lsdiff" \ ${lib.optionalString (relative != null) "-p1 -i ${lib.escapeShellArg relative}/'*'"} \ "$out" \ @@ -76,5 +88,6 @@ fetchurl ({ mv "$tmpfile" "$out" '' + postFetch; } // builtins.removeAttrs args [ - "relative" "stripLen" "extraPrefix" "excludes" "includes" "revert" "postFetch" + "relative" "stripLen" "decode" "extraPrefix" "excludes" "includes" "revert" + "postFetch" ]) |