summaryrefslogtreecommitdiff
path: root/pkgs/build-support/fetchpatch
diff options
context:
space:
mode:
authorJohn Ericson <John.Ericson@Obsidian.Systems>2018-01-04 14:55:19 -0500
committerJohn Ericson <John.Ericson@Obsidian.Systems>2018-01-18 12:19:49 -0500
commit9bd437d4b40dd967f7d45982b60b1949f30c6450 (patch)
treeba2ed176a5471a99c6986bb27a82788d38fc5bb9 /pkgs/build-support/fetchpatch
parentMerge pull request #33749 from dezgeg/release-refactor-1 (diff)
downloadnixpkgs-9bd437d4b40dd967f7d45982b60b1949f30c6450.tar.gz
fetchpatch: Add support for an arbitrary extra prefix
We still ensure the old and new ones start, respectfully, with `a/` and `b/`. Use with `stripLen` to ensure tha the old `a/` and `/b` are gone if a new prefix is added.
Diffstat (limited to 'pkgs/build-support/fetchpatch')
-rw-r--r--pkgs/build-support/fetchpatch/default.nix10
1 files changed, 5 insertions, 5 deletions
diff --git a/pkgs/build-support/fetchpatch/default.nix b/pkgs/build-support/fetchpatch/default.nix
index e3159d205301..c185497e6913 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, excludes ? [], ... }@args:
+{ stripLen ? 0, extraPrefix ? null, excludes ? [], ... }@args:
fetchurl ({
postFetch = ''
@@ -16,9 +16,9 @@ fetchurl ({
"${patchutils}/bin/filterdiff" \
--include={} \
--strip=${toString stripLen} \
- ${lib.optionalString addPrefixes ''
- --addoldprefix=a/ \
- --addnewprefix=b/ \
+ ${lib.optionalString (extraPrefix != null) ''
+ --addoldprefix=a/${extraPrefix} \
+ --addnewprefix=b/${extraPrefix} \
''} \
--clean "$out" > "$tmpfile"
${patchutils}/bin/filterdiff \
@@ -27,4 +27,4 @@ fetchurl ({
"$tmpfile" > "$out"
${args.postFetch or ""}
'';
-} // builtins.removeAttrs args ["stripLen" "addPrefixes" "excludes" "postFetch"])
+} // builtins.removeAttrs args ["stripLen" "extraPrefix" "excludes" "postFetch"])