fetchpatch: Add includes to compliment excludes, and require that both not be non-empty.

This commit was originally introduced as part of #41420 and then
reverted with the rest of that PR. However there was no reason to revert
his particular commit.
This commit is contained in:
John Ericson 2018-06-04 22:29:22 -04:00 committed by Timo Kaufmann
parent 064bff0ae0
commit aa6adfc324

View file

@ -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"])