summary refs log tree commit diff
path: root/pkgs/build-support/fetchpatch
diff options
context:
space:
mode:
authorRobin Gloster <mail@glob.in>2017-07-26 12:59:02 +0200
committerRobin Gloster <mail@glob.in>2017-07-26 13:32:59 +0200
commit100107a3cd166da87b527eabf49f477ea2d18c9f (patch)
tree4a79217caebec478ef0493b3cd0d651a1bea52ca /pkgs/build-support/fetchpatch
parent1ec5b7f1d370a15c9a4db20e4c3802e8e7eb7d18 (diff)
downloadnixpkgs-100107a3cd166da87b527eabf49f477ea2d18c9f.tar
nixpkgs-100107a3cd166da87b527eabf49f477ea2d18c9f.tar.gz
nixpkgs-100107a3cd166da87b527eabf49f477ea2d18c9f.tar.bz2
nixpkgs-100107a3cd166da87b527eabf49f477ea2d18c9f.tar.lz
nixpkgs-100107a3cd166da87b527eabf49f477ea2d18c9f.tar.xz
nixpkgs-100107a3cd166da87b527eabf49f477ea2d18c9f.tar.zst
nixpkgs-100107a3cd166da87b527eabf49f477ea2d18c9f.zip
fetchpatch: add excludes parameter
Diffstat (limited to 'pkgs/build-support/fetchpatch')
-rw-r--r--pkgs/build-support/fetchpatch/default.nix9
1 files changed, 6 insertions, 3 deletions
diff --git a/pkgs/build-support/fetchpatch/default.nix b/pkgs/build-support/fetchpatch/default.nix
index a6ddf132cd5..a9bfac320fb 100644
--- a/pkgs/build-support/fetchpatch/default.nix
+++ b/pkgs/build-support/fetchpatch/default.nix
@@ -5,7 +5,7 @@
 # stripLen acts as the -p parameter when applying a patch.
 
 { lib, fetchurl, patchutils }:
-{ stripLen ? 0, addPrefixes ? false, ... }@args:
+{ stripLen ? 0, addPrefixes ? false, excludes ? [], ... }@args:
 
 fetchurl ({
   postFetch = ''
@@ -21,7 +21,10 @@ fetchurl ({
            --addnewprefix=b/ \
         ''} \
         --clean "$out" > "$tmpfile"
-    mv "$tmpfile" "$out"
+    ${patchutils}/bin/filterdiff \
+      -p1 \
+      ${builtins.toString (builtins.map (x: "-x ${x}") excludes)} \
+      "$tmpfile" > "$out"
     ${args.postFetch or ""}
   '';
-} // builtins.removeAttrs args ["stripLen" "addPrefixes"])
+} // builtins.removeAttrs args ["stripLen" "addPrefixes" "excludes"])