mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-21 22:43:01 +00:00
fetchpatch: add patchutils to nativeBuildInputs
This change allows using programs from patchutils in postFetch.
This commit is contained in:
parent
32b51c3352
commit
6ed79156ce
@ -14,6 +14,7 @@
|
|||||||
, includes ? []
|
, includes ? []
|
||||||
, revert ? false
|
, revert ? false
|
||||||
, postFetch ? ""
|
, postFetch ? ""
|
||||||
|
, nativeBuildInputs ? []
|
||||||
, ...
|
, ...
|
||||||
}@args:
|
}@args:
|
||||||
let
|
let
|
||||||
@ -29,6 +30,7 @@ in
|
|||||||
lib.throwIfNot (excludes == [] || includes == [])
|
lib.throwIfNot (excludes == [] || includes == [])
|
||||||
"fetchpatch: cannot use excludes and includes simultaneously"
|
"fetchpatch: cannot use excludes and includes simultaneously"
|
||||||
fetchurl ({
|
fetchurl ({
|
||||||
|
nativeBuildInputs = [ patchutils ] ++ nativeBuildInputs;
|
||||||
postFetch = ''
|
postFetch = ''
|
||||||
tmpfile="$TMPDIR/patch"
|
tmpfile="$TMPDIR/patch"
|
||||||
|
|
||||||
@ -48,12 +50,12 @@ fetchurl ({
|
|||||||
set -e
|
set -e
|
||||||
mv "$tmpfile" "$out"
|
mv "$tmpfile" "$out"
|
||||||
|
|
||||||
"${patchutils}/bin/lsdiff" \
|
lsdiff \
|
||||||
${lib.optionalString (relative != null) "-p1 -i ${lib.escapeShellArg relative}/'*'"} \
|
${lib.optionalString (relative != null) "-p1 -i ${lib.escapeShellArg relative}/'*'"} \
|
||||||
"$out" \
|
"$out" \
|
||||||
| sort -u | sed -e 's/[*?]/\\&/g' \
|
| sort -u | sed -e 's/[*?]/\\&/g' \
|
||||||
| xargs -I{} \
|
| xargs -I{} \
|
||||||
"${patchutils}/bin/filterdiff" \
|
filterdiff \
|
||||||
--include={} \
|
--include={} \
|
||||||
--strip=${toString stripLen} \
|
--strip=${toString stripLen} \
|
||||||
${lib.optionalString (extraPrefix != null) ''
|
${lib.optionalString (extraPrefix != null) ''
|
||||||
@ -70,7 +72,7 @@ fetchurl ({
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
${patchutils}/bin/filterdiff \
|
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)} \
|
||||||
@ -84,10 +86,10 @@ fetchurl ({
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
'' + lib.optionalString revert ''
|
'' + lib.optionalString revert ''
|
||||||
${patchutils}/bin/interdiff "$out" /dev/null > "$tmpfile"
|
interdiff "$out" /dev/null > "$tmpfile"
|
||||||
mv "$tmpfile" "$out"
|
mv "$tmpfile" "$out"
|
||||||
'' + postFetch;
|
'' + postFetch;
|
||||||
} // builtins.removeAttrs args [
|
} // builtins.removeAttrs args [
|
||||||
"relative" "stripLen" "decode" "extraPrefix" "excludes" "includes" "revert"
|
"relative" "stripLen" "decode" "extraPrefix" "excludes" "includes" "revert"
|
||||||
"postFetch"
|
"postFetch" "nativeBuildInputs"
|
||||||
])
|
])
|
||||||
|
@ -1073,14 +1073,14 @@ with pkgs;
|
|||||||
|
|
||||||
fetchpatch = callPackage ../build-support/fetchpatch {
|
fetchpatch = callPackage ../build-support/fetchpatch {
|
||||||
# 0.3.4 would change hashes: https://github.com/NixOS/nixpkgs/issues/25154
|
# 0.3.4 would change hashes: https://github.com/NixOS/nixpkgs/issues/25154
|
||||||
patchutils = buildPackages.patchutils_0_3_3;
|
patchutils = __splicedPackages.patchutils_0_3_3;
|
||||||
} // {
|
} // {
|
||||||
tests = pkgs.tests.fetchpatch;
|
tests = pkgs.tests.fetchpatch;
|
||||||
version = 1;
|
version = 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
fetchpatch2 = callPackage ../build-support/fetchpatch {
|
fetchpatch2 = callPackage ../build-support/fetchpatch {
|
||||||
patchutils = buildPackages.patchutils_0_4_2;
|
patchutils = __splicedPackages.patchutils_0_4_2;
|
||||||
} // {
|
} // {
|
||||||
tests = pkgs.tests.fetchpatch2;
|
tests = pkgs.tests.fetchpatch2;
|
||||||
version = 2;
|
version = 2;
|
||||||
|
Loading…
Reference in New Issue
Block a user