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:

1f0d7387fd
491d32a2ec
46a19733d2

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 <aszlig@redmoonstudios.org>
Cc: @7c6f434c
This commit is contained in:
aszlig 2017-01-27 20:56:02 +01:00
parent c466e31a0f
commit 61b673c1f1
No known key found for this signature in database
GPG Key ID: 1DE8E48E57DB5436

View File

@ -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 = {