From a2ea2a1945df9f164d1bdfffc1efbefd2f139b6b Mon Sep 17 00:00:00 2001 From: Danylo Hlynskyi Date: Sun, 18 Aug 2019 18:28:03 +0300 Subject: [PATCH] tortoisehg: untie from mercurial and update to 5.0.2 (#66173) * tortoisehg: untie from mercurial When I've added `tortoisehg` package, it turned out that mercurial updates sometimes broke thg. I've added a comment to `mercurial/default.nix` to update torotisehg version during mercurial updates, but this worked the other way round: mercurial stopped to be updated regularly (https://github.com/NixOS/nixpkgs/pull/60993). And sadly it didn't solve the issue - https://github.com/NixOS/nixpkgs/issues/61759. Here I'm trying to untie them. Tortoisehg will build a custom mercurial package if versions don't match. This makes updating tortoisehg more complicated, but it is still better than current situation. * expose custom mercurial from thg package --- .../version-management/mercurial/default.nix | 27 +++++++------- .../version-management/tortoisehg/default.nix | 35 ++++++++++++++----- 2 files changed, 42 insertions(+), 20 deletions(-) diff --git a/pkgs/applications/version-management/mercurial/default.nix b/pkgs/applications/version-management/mercurial/default.nix index 7f72e24aa53..ee0ab375666 100644 --- a/pkgs/applications/version-management/mercurial/default.nix +++ b/pkgs/applications/version-management/mercurial/default.nix @@ -1,20 +1,23 @@ { stdenv, fetchurl, python2Packages, makeWrapper, unzip , guiSupport ? false, tk ? null -, ApplicationServices }: +, ApplicationServices +, mercurialSrc ? fetchurl rec { + meta.name = "mercurial-${meta.version}"; + meta.version = "4.9.1"; + url = "https://mercurial-scm.org/release/${meta.name}.tar.gz"; + sha256 = "0iybbkd9add066729zg01kwz5hhc1s6lhp9rrnsmzq6ihyxj3p8v"; + } +}: let - # if you bump version, update pkgs.tortoisehg too or ping maintainer - version = "4.9.1"; - name = "mercurial-${version}"; inherit (python2Packages) docutils hg-git dulwich python; -in python2Packages.buildPythonApplication { - inherit name; - format = "other"; - src = fetchurl { - url = "https://mercurial-scm.org/release/${name}.tar.gz"; - sha256 = "0iybbkd9add066729zg01kwz5hhc1s6lhp9rrnsmzq6ihyxj3p8v"; - }; +in python2Packages.buildPythonApplication { + + inherit (mercurialSrc.meta) name version; + src = mercurialSrc; + + format = "other"; inherit python; # pass it so that the same version can be used in hg2git @@ -55,7 +58,7 @@ in python2Packages.buildPythonApplication { ''; meta = { - inherit version; + inherit (mercurialSrc.meta) 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/; diff --git a/pkgs/applications/version-management/tortoisehg/default.nix b/pkgs/applications/version-management/tortoisehg/default.nix index 7bd1e9586c9..a6cdf2e4373 100644 --- a/pkgs/applications/version-management/tortoisehg/default.nix +++ b/pkgs/applications/version-management/tortoisehg/default.nix @@ -1,13 +1,30 @@ -{lib, fetchurl, mercurial, python2Packages}: +{ lib, fetchurl, python2Packages +, mercurial +}@args: +let + tortoisehgSrc = fetchurl rec { + meta.name = "tortoisehg-${meta.version}"; + meta.version = "5.0.2"; + url = "https://bitbucket.org/tortoisehg/targz/downloads/${meta.name}.tar.gz"; + sha256 = "1fkawx4ymaacah2wpv2w7rxmv1mx08mg4x4r4fxh41jz1njjb8sz"; + }; -python2Packages.buildPythonApplication rec { - name = "tortoisehg-${version}"; - version = "5.0.2"; + mercurial = + if args.mercurial.meta.version == tortoisehgSrc.meta.version + then args.mercurial + else args.mercurial.override { + mercurialSrc = fetchurl rec { + meta.name = "mercurial-${meta.version}"; + meta.version = tortoisehgSrc.meta.version; + url = "https://mercurial-scm.org/release/${meta.name}.tar.gz"; + sha256 = "1y60hfc8gh4ha9sw650qs7hndqmvbn0qxpmqwpn4q18z5xwm1f19"; + }; + }; - src = fetchurl { - url = "https://bitbucket.org/tortoisehg/targz/downloads/${name}.tar.gz"; - sha256 = "1fkawx4ymaacah2wpv2w7rxmv1mx08mg4x4r4fxh41jz1njjb8sz"; - }; +in python2Packages.buildPythonApplication rec { + + inherit (tortoisehgSrc.meta) name version; + src = tortoisehgSrc; pythonPath = with python2Packages; [ pyqt4 mercurial qscintilla iniparse ]; @@ -28,6 +45,8 @@ python2Packages.buildPythonApplication rec { $out/bin/thg version ''; + passthru.mercurial = mercurial; + meta = { description = "Qt based graphical tool for working with Mercurial"; homepage = https://tortoisehg.bitbucket.io/;