From c8afc263df71303d0e26c795354bcf1a5aa29423 Mon Sep 17 00:00:00 2001 From: Bob van der Linden Date: Sat, 13 Apr 2019 23:09:44 +0200 Subject: [PATCH 1/6] patchutils: generalize package --- pkgs/tools/text/patchutils/0.3.3.nix | 7 +++++++ .../text/patchutils/{default.nix => generic.nix} | 15 ++++++++------- pkgs/top-level/all-packages.nix | 4 +++- 3 files changed, 18 insertions(+), 8 deletions(-) create mode 100644 pkgs/tools/text/patchutils/0.3.3.nix rename pkgs/tools/text/patchutils/{default.nix => generic.nix} (63%) diff --git a/pkgs/tools/text/patchutils/0.3.3.nix b/pkgs/tools/text/patchutils/0.3.3.nix new file mode 100644 index 00000000000..b324137be6a --- /dev/null +++ b/pkgs/tools/text/patchutils/0.3.3.nix @@ -0,0 +1,7 @@ +{ callPackage, ... } @ args: + +callPackage ./generic.nix (args // rec { + version = "0.3.3"; + sha256 = "0g5df00cj4nczrmr4k791l7la0sq2wnf8rn981fsrz1f3d2yix4i"; + patches = [ ./drop-comments.patch ]; # we would get into a cycle when using fetchpatch on this one +}) diff --git a/pkgs/tools/text/patchutils/default.nix b/pkgs/tools/text/patchutils/generic.nix similarity index 63% rename from pkgs/tools/text/patchutils/default.nix rename to pkgs/tools/text/patchutils/generic.nix index 238676020e8..87d925e333f 100644 --- a/pkgs/tools/text/patchutils/default.nix +++ b/pkgs/tools/text/patchutils/generic.nix @@ -1,15 +1,16 @@ -{ stdenv, fetchurl }: - +{ stdenv, fetchurl +, version, sha256, patches ? [] +, ... +}: stdenv.mkDerivation rec { - name = "patchutils-0.3.3"; + pname = "patchutils"; + inherit version patches; src = fetchurl { - url = "http://cyberelk.net/tim/data/patchutils/stable/${name}.tar.xz"; - sha256 = "0g5df00cj4nczrmr4k791l7la0sq2wnf8rn981fsrz1f3d2yix4i"; + url = "http://cyberelk.net/tim/data/patchutils/stable/${pname}-${version}.tar.xz"; + inherit sha256; }; - patches = [ ./drop-comments.patch ]; # we would get into a cycle when using fetchpatch on this one - hardeningDisable = [ "format" ]; doCheck = false; # fails diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index c048f443161..261283800d7 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -4881,7 +4881,9 @@ in parcellite = callPackage ../tools/misc/parcellite { }; - patchutils = callPackage ../tools/text/patchutils { }; + patchutils = patchutils_0_3_3; + + patchutils_0_3_3 = callPackage ../tools/text/patchutils/0.3.3.nix { }; parted = callPackage ../tools/misc/parted { }; From 81e9ddfd7217583b7af3335d7aa098309a946cce Mon Sep 17 00:00:00 2001 From: Bob van der Linden Date: Sat, 13 Apr 2019 23:12:32 +0200 Subject: [PATCH 2/6] patchutils: add version 0.3.4 --- pkgs/tools/text/patchutils/0.3.4.nix | 6 ++++++ pkgs/top-level/all-packages.nix | 2 ++ 2 files changed, 8 insertions(+) create mode 100644 pkgs/tools/text/patchutils/0.3.4.nix diff --git a/pkgs/tools/text/patchutils/0.3.4.nix b/pkgs/tools/text/patchutils/0.3.4.nix new file mode 100644 index 00000000000..eab0e98f95c --- /dev/null +++ b/pkgs/tools/text/patchutils/0.3.4.nix @@ -0,0 +1,6 @@ +{ callPackage, ... } @ args: + +callPackage ./generic.nix (args // rec { + version = "0.3.4"; + sha256 = "0xp8mcfyi5nmb5a2zi5ibmyshxkb1zv1dgmnyn413m7ahgdx8mfg"; +}) diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 261283800d7..0291fccab14 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -4883,6 +4883,8 @@ in patchutils = patchutils_0_3_3; + patchutils_0_3_4 = callPackage ../tools/text/patchutils/0.3.4.nix { }; + patchutils_0_3_3 = callPackage ../tools/text/patchutils/0.3.3.nix { }; parted = callPackage ../tools/misc/parted { }; From 9555fd73f323deb21d25a4a045ba67ad2f87d2c6 Mon Sep 17 00:00:00 2001 From: Bob van der Linden Date: Sat, 13 Apr 2019 23:12:55 +0200 Subject: [PATCH 3/6] fetchpatch: explicitly use patchutils 0.3.3 --- pkgs/build-support/fetchpatch/default.nix | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/pkgs/build-support/fetchpatch/default.nix b/pkgs/build-support/fetchpatch/default.nix index 89d72f512f7..b5bbed28450 100644 --- a/pkgs/build-support/fetchpatch/default.nix +++ b/pkgs/build-support/fetchpatch/default.nix @@ -5,6 +5,9 @@ # stripLen acts as the -p parameter when applying a patch. { lib, fetchurl, buildPackages }: +let + patchutils = buildPackages.patchutils_0_3_3; +in { stripLen ? 0, extraPrefix ? null, excludes ? [], includes ? [], revert ? false, ... }@args: fetchurl ({ @@ -14,10 +17,10 @@ fetchurl ({ echo "error: Fetched patch file '$out' is empty!" 1>&2 exit 1 fi - "${buildPackages.patchutils}/bin/lsdiff" "$out" \ + "${patchutils}/bin/lsdiff" "$out" \ | sort -u | sed -e 's/[*?]/\\&/g' \ | xargs -I{} \ - "${buildPackages.patchutils}/bin/filterdiff" \ + "${patchutils}/bin/filterdiff" \ --include={} \ --strip=${toString stripLen} \ ${lib.optionalString (extraPrefix != null) '' @@ -32,7 +35,7 @@ fetchurl ({ cat "$out" 1>&2 exit 1 fi - ${buildPackages.patchutils}/bin/filterdiff \ + ${patchutils}/bin/filterdiff \ -p1 \ ${builtins.toString (builtins.map (x: "-x ${lib.escapeShellArg x}") excludes)} \ ${builtins.toString (builtins.map (x: "-i ${lib.escapeShellArg x}") includes)} \ @@ -46,7 +49,7 @@ fetchurl ({ exit 1 fi '' + lib.optionalString revert '' - ${buildPackages.patchutils}/bin/interdiff "$out" /dev/null > "$tmpfile" + ${patchutils}/bin/interdiff "$out" /dev/null > "$tmpfile" mv "$tmpfile" "$out" '' + (args.postFetch or ""); meta.broken = excludes != [] && includes != []; From 7de2e3ceb4d20c5f4e6bbcca6fb58022fbb5e3f1 Mon Sep 17 00:00:00 2001 From: Bob van der Linden Date: Sat, 13 Apr 2019 23:13:10 +0200 Subject: [PATCH 4/6] patchutils: use 0.3.4 by default --- pkgs/top-level/all-packages.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 0291fccab14..cc3087cc31b 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -4881,7 +4881,7 @@ in parcellite = callPackage ../tools/misc/parcellite { }; - patchutils = patchutils_0_3_3; + patchutils = patchutils_0_3_4; patchutils_0_3_4 = callPackage ../tools/text/patchutils/0.3.4.nix { }; From 1d883a0fde15ee934a10f33364b71d799f42ece9 Mon Sep 17 00:00:00 2001 From: Bob van der Linden Date: Sun, 14 Apr 2019 13:57:40 +0200 Subject: [PATCH 5/6] patchutils: rename 0.3.4 to default --- pkgs/tools/text/patchutils/{0.3.4.nix => default.nix} | 0 pkgs/top-level/all-packages.nix | 4 +--- 2 files changed, 1 insertion(+), 3 deletions(-) rename pkgs/tools/text/patchutils/{0.3.4.nix => default.nix} (100%) diff --git a/pkgs/tools/text/patchutils/0.3.4.nix b/pkgs/tools/text/patchutils/default.nix similarity index 100% rename from pkgs/tools/text/patchutils/0.3.4.nix rename to pkgs/tools/text/patchutils/default.nix diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index cc3087cc31b..f85d9c3b742 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -4881,9 +4881,7 @@ in parcellite = callPackage ../tools/misc/parcellite { }; - patchutils = patchutils_0_3_4; - - patchutils_0_3_4 = callPackage ../tools/text/patchutils/0.3.4.nix { }; + patchutils = callPackage ../tools/text/patchutils { }; patchutils_0_3_3 = callPackage ../tools/text/patchutils/0.3.3.nix { }; From e07c5ec107c720b9f1ace4bfa87fe8f359e358c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20=C4=8Cun=C3=A1t?= Date: Sun, 12 May 2019 15:16:45 +0200 Subject: [PATCH 6/6] fetchpatch: explain why we use 0.3.3 --- pkgs/build-support/fetchpatch/default.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/pkgs/build-support/fetchpatch/default.nix b/pkgs/build-support/fetchpatch/default.nix index b5bbed28450..2fb32b2324f 100644 --- a/pkgs/build-support/fetchpatch/default.nix +++ b/pkgs/build-support/fetchpatch/default.nix @@ -6,6 +6,7 @@ { lib, fetchurl, buildPackages }: let + # 0.3.4 would change hashes: https://github.com/NixOS/nixpkgs/issues/25154 patchutils = buildPackages.patchutils_0_3_3; in { stripLen ? 0, extraPrefix ? null, excludes ? [], includes ? [], revert ? false, ... }@args: