From 100107a3cd166da87b527eabf49f477ea2d18c9f Mon Sep 17 00:00:00 2001 From: Robin Gloster Date: Wed, 26 Jul 2017 12:59:02 +0200 Subject: [PATCH] fetchpatch: add excludes parameter --- pkgs/build-support/fetchpatch/default.nix | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/pkgs/build-support/fetchpatch/default.nix b/pkgs/build-support/fetchpatch/default.nix index a6ddf132cd5b..a9bfac320fb8 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"])