fetchpatch: patchutils -> buildPackages.patchutils

This commit is contained in:
volth 2018-08-21 20:58:56 +00:00 committed by John Ericson
parent 6097029455
commit caf2cae44b

View File

@ -4,7 +4,7 @@
# often change with updating of git or cgit. # often change with updating of git or cgit.
# stripLen acts as the -p parameter when applying a patch. # stripLen acts as the -p parameter when applying a patch.
{ lib, fetchurl, patchutils }: { lib, fetchurl, buildPackages }:
{ stripLen ? 0, extraPrefix ? null, excludes ? [], includes ? [], revert ? false, ... }@args: { stripLen ? 0, extraPrefix ? null, excludes ? [], includes ? [], revert ? false, ... }@args:
fetchurl ({ fetchurl ({
@ -14,10 +14,10 @@ fetchurl ({
echo "error: Fetched patch file '$out' is empty!" 1>&2 echo "error: Fetched patch file '$out' is empty!" 1>&2
exit 1 exit 1
fi fi
"${patchutils}/bin/lsdiff" "$out" \ "${buildPackages.patchutils}/bin/lsdiff" "$out" \
| sort -u | sed -e 's/[*?]/\\&/g' \ | sort -u | sed -e 's/[*?]/\\&/g' \
| xargs -I{} \ | xargs -I{} \
"${patchutils}/bin/filterdiff" \ "${buildPackages.patchutils}/bin/filterdiff" \
--include={} \ --include={} \
--strip=${toString stripLen} \ --strip=${toString stripLen} \
${lib.optionalString (extraPrefix != null) '' ${lib.optionalString (extraPrefix != null) ''
@ -32,7 +32,7 @@ fetchurl ({
cat "$out" 1>&2 cat "$out" 1>&2
exit 1 exit 1
fi fi
${patchutils}/bin/filterdiff \ ${buildPackages.patchutils}/bin/filterdiff \
-p1 \ -p1 \
${builtins.toString (builtins.map (x: "-x ${lib.escapeShellArg x}") excludes)} \ ${builtins.toString (builtins.map (x: "-x ${lib.escapeShellArg x}") excludes)} \
${builtins.toString (builtins.map (x: "-i ${lib.escapeShellArg x}") includes)} \ ${builtins.toString (builtins.map (x: "-i ${lib.escapeShellArg x}") includes)} \
@ -46,7 +46,7 @@ fetchurl ({
exit 1 exit 1
fi fi
'' + lib.optionalString revert '' '' + lib.optionalString revert ''
${patchutils}/bin/interdiff "$out" /dev/null > "$tmpfile" ${buildPackages.patchutils}/bin/interdiff "$out" /dev/null > "$tmpfile"
mv "$tmpfile" "$out" mv "$tmpfile" "$out"
'' + (args.postFetch or ""); '' + (args.postFetch or "");
meta.broken = excludes != [] && includes != []; meta.broken = excludes != [] && includes != [];