diff options
author | John Ericson <John.Ericson@Obsidian.Systems> | 2018-01-04 14:55:19 -0500 |
---|---|---|
committer | John Ericson <John.Ericson@Obsidian.Systems> | 2018-01-18 12:19:49 -0500 |
commit | 9bd437d4b40dd967f7d45982b60b1949f30c6450 (patch) | |
tree | ba2ed176a5471a99c6986bb27a82788d38fc5bb9 /pkgs/build-support/fetchpatch/default.nix | |
parent | 4dff3ee959035fadc77b0c2ac949a006b4249b20 (diff) | |
download | nixpkgs-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.nix | 10 |
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"]) |