Merge pull request #268619 from tweag/lib-descriptions
[NixPkgs.git] / pkgs / development / libraries / libqtdbustest / default.nix
blob8ef8975a01afb7c0fc78e2124d61832dc83e1c8c
1 { stdenv
2 , lib
3 , fetchbzr
4 , fetchpatch
5 , testers
6 , cmake
7 , cmake-extras
8 , dbus
9 , dbus-test-runner
10 , gtest
11 , pkg-config
12 , procps
13 , python3
14 , qtbase
17 stdenv.mkDerivation (finalAttrs: {
18   pname = "libqtdbustest";
19   version = "unstable-2017-01-06";
21   src = fetchbzr {
22     url = "lp:libqtdbustest";
23     rev = "42";
24     sha256 = "sha256-5MQdGGtEVE/pM9u0B0xFXyITiRln9p+8/MLtrrCZqi8=";
25   };
27   patches = [
28     # Tests are overly pedantic when looking for launched process names in `ps`, break on python wrapper vs real python
29     # Just check if basename + arguments match, like libqtdbusmock does
30     ./less-pedantic-process-finding.patch
32     # Disable QProcess start timeout
33     (fetchpatch {
34       url = "https://salsa.debian.org/debian-ayatana-team/libqtdbustest/-/raw/0788df10bc6f2aa47c2b73fc1df944686a9ace1e/debian/patches/1003_no-QProcess-waitForstarted-timeout.patch";
35       hash = "sha256-ThDbn6URvkj5ARDMj+xO0fb1Qh2YQRzVy24O03KglHI=";
36     })
38     # More robust dbus address reading
39     (fetchpatch {
40       url = "https://salsa.debian.org/debian-ayatana-team/libqtdbustest/-/raw/7e55c79cd032c702b30d834c1fb0b65661fc6eeb/debian/patches/1004_make-reading-address-from-dbus-daemon-more-robust.patch";
41       hash = "sha256-hq8pdducp/udxoGWGt1dgL/7VHcbJO/oT1dOY1zew8M=";
42     })
43   ];
45   strictDeps = true;
47   postPatch =  lib.optionalString (!finalAttrs.doCheck) ''
48     # Don't build tests when we're not running them
49     sed -i -e '/add_subdirectory(tests)/d' CMakeLists.txt
50   '';
52   nativeBuildInputs = [
53     cmake
54     pkg-config
55   ];
57   buildInputs = [
58     cmake-extras
59     qtbase
60   ];
62   nativeCheckInputs = [
63     dbus
64     dbus-test-runner
65     procps
66     (python3.withPackages (ps: with ps; [
67       python-dbusmock
68     ]))
69   ];
71   checkInputs = [
72     gtest
73   ];
75   dontWrapQtApps = true;
77   doCheck = stdenv.buildPlatform.canExecute stdenv.hostPlatform;
79   enableParallelChecking = false;
81   checkPhase = ''
82     runHook preCheck
84     dbus-test-runner -t make -p test -p "''${enableParallelChecking:+-j $NIX_BUILD_CORES}"
86     runHook postCheck
87   '';
89   passthru.tests.pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage;
91   meta = with lib; {
92     description = "Library for testing DBus interactions using Qt";
93     homepage = "https://launchpad.net/libqtdbustest";
94     license = licenses.lgpl3Only;
95     platforms = platforms.unix;
96     maintainers = teams.lomiri.members;
97     mainProgram = "qdbus-simple-test-runner";
98     pkgConfigModules = [
99       "libqtdbustest-1"
100     ];
101   };