summary refs log tree commit diff
path: root/pkgs/build-support/fetchpatch/default.nix
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/default.nix
parent4dff3ee959035fadc77b0c2ac949a006b4249b20 (diff)
downloadnixpkgs-9bd437d4b40dd967f7d45982b60b1949f30c6450.tar
nixpkgs-9bd437d4b40dd967f7d45982b60b1949f30c6450.tar.gz
nixpkgs-9bd437d4b40dd967f7d45982b60b1949f30c6450.tar.bz2
nixpkgs-9bd437d4b40dd967f7d45982b60b1949f30c6450.tar.lz
nixpkgs-9bd437d4b40dd967f7d45982b60b1949f30c6450.tar.xz
nixpkgs-9bd437d4b40dd967f7d45982b60b1949f30c6450.tar.zst
nixpkgs-9bd437d4b40dd967f7d45982b60b1949f30c6450.zip
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/default.nix')
-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 e3159d20530..c185497e691 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"])