summary refs log tree commit diff
path: root/pkgs/build-support/fetchpatch
diff options
context:
space:
mode:
authorJohn Ericson <John.Ericson@Obsidian.Systems>2018-06-04 22:29:22 -0400
committerMatthew Bauer <mjbauer95@gmail.com>2018-07-02 15:51:13 -0400
commit57bb96d6593040dbc7088e4f8d7dc065ea492d14 (patch)
tree594dfcbfff3126fad4d579b9549df9c52f8e209a /pkgs/build-support/fetchpatch
parenta260b3d681164bedaeb90fd578390147799d638c (diff)
downloadnixpkgs-57bb96d6593040dbc7088e4f8d7dc065ea492d14.tar
nixpkgs-57bb96d6593040dbc7088e4f8d7dc065ea492d14.tar.gz
nixpkgs-57bb96d6593040dbc7088e4f8d7dc065ea492d14.tar.bz2
nixpkgs-57bb96d6593040dbc7088e4f8d7dc065ea492d14.tar.lz
nixpkgs-57bb96d6593040dbc7088e4f8d7dc065ea492d14.tar.xz
nixpkgs-57bb96d6593040dbc7088e4f8d7dc065ea492d14.tar.zst
nixpkgs-57bb96d6593040dbc7088e4f8d7dc065ea492d14.zip
fetchpatch: Add includes to compliment excludes, and require that both not be non-empty.
Diffstat (limited to 'pkgs/build-support/fetchpatch')
-rw-r--r--pkgs/build-support/fetchpatch/default.nix6
1 files changed, 4 insertions, 2 deletions
diff --git a/pkgs/build-support/fetchpatch/default.nix b/pkgs/build-support/fetchpatch/default.nix
index c185497e691..16343d626ce 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, extraPrefix ? null, excludes ? [], ... }@args:
+{ stripLen ? 0, extraPrefix ? null, excludes ? [], includes ? [], ... }@args:
 
 fetchurl ({
   postFetch = ''
@@ -24,7 +24,9 @@ fetchurl ({
     ${patchutils}/bin/filterdiff \
       -p1 \
       ${builtins.toString (builtins.map (x: "-x ${x}") excludes)} \
+      ${builtins.toString (builtins.map (x: "-i ${x}") includes)} \
       "$tmpfile" > "$out"
     ${args.postFetch or ""}
   '';
-} // builtins.removeAttrs args ["stripLen" "extraPrefix" "excludes" "postFetch"])
+  meta.broken = excludes != [] && includes != [];
+} // builtins.removeAttrs args ["stripLen" "extraPrefix" "excludes" "includes" "postFetch"])