From 63f3e26505b95965773f8cfa5220a4c645e57ae9 Mon Sep 17 00:00:00 2001 From: Luke Granger-Brown Date: Mon, 3 May 2021 17:32:36 +0000 Subject: [PATCH 1/8] mercurial: 5.6 -> 5.8 --- pkgs/applications/version-management/mercurial/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/applications/version-management/mercurial/default.nix b/pkgs/applications/version-management/mercurial/default.nix index 26d263b060d..12385ee7dca 100644 --- a/pkgs/applications/version-management/mercurial/default.nix +++ b/pkgs/applications/version-management/mercurial/default.nix @@ -8,11 +8,11 @@ let in python3Packages.buildPythonApplication rec { pname = "mercurial"; - version = "5.6"; + version = "5.8"; src = fetchurl { url = "https://mercurial-scm.org/release/mercurial-${version}.tar.gz"; - sha256 = "1hk2y30zzdnlv8f71kabvh0xi9c7qhp28ksh20vpd0r712sv79yz"; + sha256 = "17rhlmmkqz5ll3k68jfzpcifg3nndbcbc2nx7kw8xn3qcj7nlpgw"; }; format = "other"; From ae894f63f5388065e41dea6c77ce8a2ce0fc91e0 Mon Sep 17 00:00:00 2001 From: Luke Granger-Brown Date: Mon, 3 May 2021 17:35:26 +0000 Subject: [PATCH 2/8] mercurial: drop unnecessary unzip dep --- pkgs/applications/version-management/mercurial/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/applications/version-management/mercurial/default.nix b/pkgs/applications/version-management/mercurial/default.nix index 12385ee7dca..5d1611abd26 100644 --- a/pkgs/applications/version-management/mercurial/default.nix +++ b/pkgs/applications/version-management/mercurial/default.nix @@ -1,4 +1,4 @@ -{ lib, stdenv, fetchurl, python3Packages, makeWrapper, unzip +{ lib, stdenv, fetchurl, python3Packages, makeWrapper , guiSupport ? false, tk ? null , ApplicationServices }: @@ -19,7 +19,7 @@ in python3Packages.buildPythonApplication rec { passthru = { inherit python; }; # pass it so that the same version can be used in hg2git - nativeBuildInputs = [ makeWrapper unzip ]; + nativeBuildInputs = [ makeWrapper ]; buildInputs = [ docutils ] ++ lib.optionals stdenv.isDarwin [ ApplicationServices ]; From 0716841463629a08ac69fca4a8645b3eede030a6 Mon Sep 17 00:00:00 2001 From: Luke Granger-Brown Date: Mon, 3 May 2021 18:05:01 +0000 Subject: [PATCH 3/8] mercurial: build Rust extensions The Rust extensions provide speedups for core Mercurial functionality. We should start building with them. They're only CI-tested on Linux, so they're disabled for non-Linux platforms for now by default. --- .../version-management/mercurial/default.nix | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/pkgs/applications/version-management/mercurial/default.nix b/pkgs/applications/version-management/mercurial/default.nix index 5d1611abd26..9ea983fc71b 100644 --- a/pkgs/applications/version-management/mercurial/default.nix +++ b/pkgs/applications/version-management/mercurial/default.nix @@ -1,4 +1,5 @@ { lib, stdenv, fetchurl, python3Packages, makeWrapper +, rustSupport ? stdenv.hostPlatform.isLinux, rustPlatform , guiSupport ? false, tk ? null , ApplicationServices }: @@ -19,11 +20,25 @@ in python3Packages.buildPythonApplication rec { passthru = { inherit python; }; # pass it so that the same version can be used in hg2git - nativeBuildInputs = [ makeWrapper ]; + cargoDeps = if rustSupport then rustPlatform.fetchCargoTarball { + inherit src; + name = "${pname}-${version}"; + sha256 = "1kc2giqvfwsdl5fb0qmz96ws1gdrs3skfdzvpiif2i8f7r4nqlhd"; + sourceRoot = "${pname}-${version}/rust"; + } else null; + cargoRoot = if rustSupport then "rust" else null; + + nativeBuildInputs = [ makeWrapper ] + ++ lib.optionals rustSupport (with rustPlatform; [ + cargoSetupHook + rust.cargo + rust.rustc + ]); buildInputs = [ docutils ] ++ lib.optionals stdenv.isDarwin [ ApplicationServices ]; - makeFlags = [ "PREFIX=$(out)" ]; + makeFlags = [ "PREFIX=$(out)" ] + ++ lib.optional rustSupport "PURE=--rust"; postInstall = (lib.optionalString guiSupport '' mkdir -p $out/etc/mercurial From 38e505f20a8a23ef5731f1cc428539a1d6f2a6a3 Mon Sep 17 00:00:00 2001 From: Luke Granger-Brown Date: Mon, 3 May 2021 18:15:18 +0000 Subject: [PATCH 4/8] mercurial: add lukegb as maintainer, update metadata --- .../applications/version-management/mercurial/default.nix | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pkgs/applications/version-management/mercurial/default.nix b/pkgs/applications/version-management/mercurial/default.nix index 9ea983fc71b..8b9e60abe75 100644 --- a/pkgs/applications/version-management/mercurial/default.nix +++ b/pkgs/applications/version-management/mercurial/default.nix @@ -67,14 +67,14 @@ in python3Packages.buildPythonApplication rec { install -v -m644 -D contrib/zsh_completion $out/share/zsh/site-functions/_hg ''; - meta = { + meta = with lib; { inherit version; description = "A fast, lightweight SCM system for very large distributed projects"; homepage = "https://www.mercurial-scm.org"; downloadPage = "https://www.mercurial-scm.org/release/"; - license = lib.licenses.gpl2; - maintainers = [ lib.maintainers.eelco ]; + license = licenses.gpl2Plus; + maintainers = with maintainers; [ eelco lukegb ]; updateWalker = true; - platforms = lib.platforms.unix; + platforms = platforms.unix; }; } From eb3d65bf19d607b09753f696023d49bce2defd99 Mon Sep 17 00:00:00 2001 From: Luke Granger-Brown Date: Mon, 3 May 2021 18:38:56 +0000 Subject: [PATCH 5/8] mercurial: also compile translations Without gettext as a dependency, we won't compile the .po files. --- pkgs/applications/version-management/mercurial/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/applications/version-management/mercurial/default.nix b/pkgs/applications/version-management/mercurial/default.nix index 8b9e60abe75..5a0469b36c4 100644 --- a/pkgs/applications/version-management/mercurial/default.nix +++ b/pkgs/applications/version-management/mercurial/default.nix @@ -1,4 +1,4 @@ -{ lib, stdenv, fetchurl, python3Packages, makeWrapper +{ lib, stdenv, fetchurl, python3Packages, makeWrapper, gettext , rustSupport ? stdenv.hostPlatform.isLinux, rustPlatform , guiSupport ? false, tk ? null , ApplicationServices @@ -28,7 +28,7 @@ in python3Packages.buildPythonApplication rec { } else null; cargoRoot = if rustSupport then "rust" else null; - nativeBuildInputs = [ makeWrapper ] + nativeBuildInputs = [ makeWrapper gettext ] ++ lib.optionals rustSupport (with rustPlatform; [ cargoSetupHook rust.cargo From 53ddf53f2ca436f85ed022baba8812b9bf37d813 Mon Sep 17 00:00:00 2001 From: Luke Granger-Brown Date: Mon, 3 May 2021 18:59:14 +0000 Subject: [PATCH 6/8] mercurial: add re2 Mercurial can make use of the RE2 regex engine where available to speed up evaluation of regexes. --- pkgs/applications/version-management/mercurial/default.nix | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkgs/applications/version-management/mercurial/default.nix b/pkgs/applications/version-management/mercurial/default.nix index 5a0469b36c4..4623765bd32 100644 --- a/pkgs/applications/version-management/mercurial/default.nix +++ b/pkgs/applications/version-management/mercurial/default.nix @@ -5,7 +5,7 @@ }: let - inherit (python3Packages) docutils python; + inherit (python3Packages) docutils python fb-re2; in python3Packages.buildPythonApplication rec { pname = "mercurial"; @@ -28,6 +28,7 @@ in python3Packages.buildPythonApplication rec { } else null; cargoRoot = if rustSupport then "rust" else null; + propagatedBuildInputs = [ fb-re2 ]; nativeBuildInputs = [ makeWrapper gettext ] ++ lib.optionals rustSupport (with rustPlatform; [ cargoSetupHook From a715d90fb044f7f104950a178878c4866e9557cb Mon Sep 17 00:00:00 2001 From: Luke Granger-Brown Date: Tue, 4 May 2021 09:54:16 +0000 Subject: [PATCH 7/8] mercurial: add patches for Rust status implementation These fix https://bz.mercurial-scm.org/show_bug.cgi?id=6514, which breaks haskellPackages.retrie when run with the Rust status implementation. --- .../version-management/mercurial/default.nix | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/pkgs/applications/version-management/mercurial/default.nix b/pkgs/applications/version-management/mercurial/default.nix index 4623765bd32..066e0a5f137 100644 --- a/pkgs/applications/version-management/mercurial/default.nix +++ b/pkgs/applications/version-management/mercurial/default.nix @@ -1,4 +1,4 @@ -{ lib, stdenv, fetchurl, python3Packages, makeWrapper, gettext +{ lib, stdenv, fetchurl, fetchpatch, python3Packages, makeWrapper, gettext , rustSupport ? stdenv.hostPlatform.isLinux, rustPlatform , guiSupport ? false, tk ? null , ApplicationServices @@ -16,6 +16,19 @@ in python3Packages.buildPythonApplication rec { sha256 = "17rhlmmkqz5ll3k68jfzpcifg3nndbcbc2nx7kw8xn3qcj7nlpgw"; }; + patches = [ + # https://phab.mercurial-scm.org/D10638, needed for below patch to apply + (fetchpatch { + url = "https://phab.mercurial-scm.org/file/data/oymk4awh2dd7q6cwjbzu/PHID-FILE-bfcr7qrp5spg42wspxpd/D10638.diff"; + sha256 = "0mfi324is02l7cnd3j0gbmg5rpyyqn3afg3f73flnfwmz5njqa5f"; + }) + # https://phab.mercurial-scm.org/D10639, fixes https://bz.mercurial-scm.org/show_bug.cgi?id=6514 + (fetchpatch { + url = "https://phab.mercurial-scm.org/file/data/re4uqdhtknjiacx2ogwu/PHID-FILE-4m26id65dno5gzix2ngh/D10639.diff"; + sha256 = "0h5ilrd2x1789fr6sf4k1mcvxdh0xdyr94yawdacw87v3x12c8cb"; + }) + ]; + format = "other"; passthru = { inherit python; }; # pass it so that the same version can be used in hg2git From 35e57e81ae1cc6b8eff93a6e7dfb3237a6a7f1d3 Mon Sep 17 00:00:00 2001 From: Luke Granger-Brown Date: Tue, 4 May 2021 10:24:00 +0000 Subject: [PATCH 8/8] tortoisehg: fix build tortoisehg intentionally wants to back-date the Mercurial build, and some of the features we've added to the Mercurial build won't work correctly under hg 5.6. --- pkgs/applications/version-management/mercurial/default.nix | 3 ++- pkgs/applications/version-management/tortoisehg/default.nix | 6 +++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/pkgs/applications/version-management/mercurial/default.nix b/pkgs/applications/version-management/mercurial/default.nix index 066e0a5f137..3caf499d31a 100644 --- a/pkgs/applications/version-management/mercurial/default.nix +++ b/pkgs/applications/version-management/mercurial/default.nix @@ -1,4 +1,5 @@ { lib, stdenv, fetchurl, fetchpatch, python3Packages, makeWrapper, gettext +, re2Support ? true , rustSupport ? stdenv.hostPlatform.isLinux, rustPlatform , guiSupport ? false, tk ? null , ApplicationServices @@ -41,7 +42,7 @@ in python3Packages.buildPythonApplication rec { } else null; cargoRoot = if rustSupport then "rust" else null; - propagatedBuildInputs = [ fb-re2 ]; + propagatedBuildInputs = lib.optional re2Support fb-re2; nativeBuildInputs = [ makeWrapper gettext ] ++ lib.optionals rustSupport (with rustPlatform; [ cargoSetupHook diff --git a/pkgs/applications/version-management/tortoisehg/default.nix b/pkgs/applications/version-management/tortoisehg/default.nix index 6c97d153661..a0fa9318a13 100644 --- a/pkgs/applications/version-management/tortoisehg/default.nix +++ b/pkgs/applications/version-management/tortoisehg/default.nix @@ -9,12 +9,16 @@ let sha256 = "031bafj88wggpvw0lgvl0djhlbhs9nls9vzwvni8yn0m0bgzc9gr"; }; - tortoiseMercurial = mercurial.overridePythonAttrs (old: rec { + tortoiseMercurial = (mercurial.override { + rustSupport = false; + re2Support = lib.versionAtLeast tortoisehgSrc.meta.version "5.8"; + }).overridePythonAttrs (old: rec { inherit (tortoisehgSrc.meta) version; src = fetchurl { url = "https://mercurial-scm.org/release/mercurial-${version}.tar.gz"; sha256 = "1hk2y30zzdnlv8f71kabvh0xi9c7qhp28ksh20vpd0r712sv79yz"; }; + patches = []; }); in python3Packages.buildPythonApplication {