From 61b673c1f1dd8aadb78d110ac14765959ad3f46c Mon Sep 17 00:00:00 2001 From: aszlig Date: Fri, 27 Jan 2017 20:56:02 +0100 Subject: gajim: Enable running test suite This is a bit more involved, because first of all, the tests aren't distributed in the release tarball and second the test suite currently doesn't work but there are fixes for it that get released in the next upstream patch, so we cherry-pick the relevant commits as patches. We now also switch to fetching the tarball directly from their GitLab instance, because - as mentioned - it contains the tests and also contains the icon.index file, which we already had included as a patch and we can now drop it. The URLs to the cherry-picked upstream commits are the following: https://dev.gajim.org/gajim/gajim/commit/1f0d7387fd020df5dfc9a6349005ec7dedb7c008 https://dev.gajim.org/gajim/gajim/commit/491d32a2ec13ed3a482e151e0b403eda7b4151b8 https://dev.gajim.org/gajim/gajim/commit/46a19733d208fbd2404cbaeedd8c203d0b6557a4 All of these commits are in the gajim_0.16 branch and are thus very likely becoming part of Gajim 0.16.7. Signed-off-by: aszlig Cc: @7c6f434c --- .../instant-messengers/gajim/default.nix | 59 ++++++++++++++++++---- 1 file changed, 48 insertions(+), 11 deletions(-) diff --git a/pkgs/applications/networking/instant-messengers/gajim/default.nix b/pkgs/applications/networking/instant-messengers/gajim/default.nix index 52d1e3d79335..f0652bf4a1e0 100644 --- a/pkgs/applications/networking/instant-messengers/gajim/default.nix +++ b/pkgs/applications/networking/instant-messengers/gajim/default.nix @@ -1,6 +1,9 @@ -{ stdenv, fetchurl, python, intltool, pkgconfig, libX11 +{ stdenv, fetchurl, autoreconfHook, python, intltool, pkgconfig, libX11 , ldns, pythonPackages +# Test requirements +, xvfb_run, dnsutils + , enableJingle ? true, farstream ? null, gst_plugins_bad ? null , libnice ? null , enableE2E ? true @@ -25,17 +28,33 @@ stdenv.mkDerivation rec { version = "0.16.6"; src = fetchurl { - url = "http://www.gajim.org/downloads/0.16/gajim-${version}.tar.bz2"; - sha256 = "1p3qwzy07f0wkika9yigyiq167l2k6wn12flqa7x55z4ihbysmqk"; + name = "${name}.tar.bz2"; + url = "https://dev.gajim.org/gajim/gajim/repository/archive.tar.bz2?" + + "ref=${name}"; + sha256 = "1s0h4xll9490vh7ygmi4zsd1fa107f3s9ykhpq0snb04fllwhjq7"; }; - patches = [ - (fetchurl { - name = "gajim-icon-index.patch"; - url = "https://dev.gajim.org/gajim/gajim/commit/7d20ed2b98a3070add188efab7308a5a06d9f4a2.diff"; - sha256 = "0w54hr5dq9y36val55kmh8d6cid7h4fs2nghx09714jylz2nyxxv"; - }) - ]; + patches = let + # An attribute set of revisions to apply from the upstream repository. + cherries = { + misc-test-fixes = { + rev = "1f0d7387fd020df5dfc9a6349005ec7dedb7c008"; + sha256 = "0nazpzyg50kl0k8z4dkn033933iz60g1i6nzhib1nmzhwwbnacc5"; + }; + jingle-fix = { + rev = "491d32a2ec13ed3a482e151e0b403eda7b4151b8"; + sha256 = "1pfg1ysr0p6rcwmd8ikjs38av3c4gcxn8pxr6cnnj27n85gvi30g"; + }; + fix-connection-mock = { + rev = "46a19733d208fbd2404cbaeedd8c203d0b6557a4"; + sha256 = "0l3s577pksnz16r4mqa1zmz4y165amsx2mclrm4vzlszy35rmy2b"; + }; + }; + in mapAttrsToList (name: { rev, sha256 }: fetchurl { + name = "gajim-${name}.patch"; + url = "https://dev.gajim.org/gajim/gajim/commit/${rev}.diff"; + inherit sha256; + }) cherries; postPatch = '' sed -i -e '0,/^[^#]/ { @@ -47,6 +66,11 @@ stdenv.mkDerivation rec { sed -i -e 's/return helpers.is_in_path('"'"'drill.*/return True/' \ src/features_window.py sed -i -e "s|'drill'|'${ldns}/bin/drill'|" src/common/resolver.py + + # We want to run tests in installCheckPhase rather than checkPhase to test + # whether the *installed* version of Gajim works rather than just whether it + # works in the unpacked source tree. + sed -i -e '/sys\.path\.insert.*gajim_root.*\/src/d' test/lib/__init__.py '' + optionalString enableSpelling '' sed -i -e 's|=.*find_lib.*|= "${gtkspell2}/lib/libgtkspell.so"|' \ src/gtkspell.py @@ -57,9 +81,15 @@ stdenv.mkDerivation rec { ] ++ optionals enableJingle [ farstream gst_plugins_bad libnice ]; nativeBuildInputs = [ - pythonPackages.wrapPython intltool pkgconfig + autoreconfHook pythonPackages.wrapPython intltool pkgconfig + # Test dependencies + xvfb_run dnsutils ]; + autoreconfPhase = '' + sed -e 's/which/type -P/;s,\./configure,:,' autogen.sh | bash + ''; + propagatedBuildInputs = [ pythonPackages.pygobject2 pythonPackages.pyGtkGlade pythonPackages.pyasn1 @@ -89,6 +119,13 @@ stdenv.mkDerivation rec { done ''; + doInstallCheck = true; + installCheckPhase = '' + XDG_DATA_DIRS="$out/share/gajim''${XDG_DATA_DIRS:+:}$XDG_DATA_DIRS" \ + PYTHONPATH="test:$out/share/gajim/src:''${PYTHONPATH:+:}$PYTHONPATH" \ + xvfb-run make test + ''; + enableParallelBuilding = true; meta = { -- cgit 1.4.1