git.iko.soy/typeable/nixpkgs
on master help sign in
ell: fix cross compilation

The current `fix-dbus-tests.patch` uses automake and pkgconfig to figure out the path of `dbus-daemon`. This fails when cross-compiling, as tests aren't run (and `checkInputs`) not available. Instead of doing this, we can simply teach the tests to pick up dbus-daemon from $PATH. This was also sent upstream in https://lists.01.org/hyperkitty/list/ell@lists.01.org/thread/SQEZAIS2LZXSXGTXOW3GTAM5ZPXRLTN4/.

commit52261c4c2754ce26098eef93dd9354d3b6b4ef88 authorFlorian Klink <flokli@flokli.de> dateSun 27 Dec 2020, 13:18 (6 years ago) parent1cf1934
3 files changed+89−69
pkgs/os-specific/linux/ell/0001-unit-test-dbus-pick-up-dbus-daemon-from-PATH.patch+84 pkgs/os-specific/linux/ell/default.nix+5−4 pkgs/os-specific/linux/ell/fix-dbus-tests.patch−65
pkgs/os-specific/linux/ell/0001-unit-test-dbus-pick-up-dbus-daemon-from-PATH.patchnew file+84
@@ -0,0 +1,84 @@
1+From 55d499f4cd5667c04c21f7201d7f10484e187907 Mon Sep 17 00:00:00 2001
2+From: Florian Klink <flokli@flokli.de>
3+Date: Sun, 27 Dec 2020 13:03:12 +0100
4+Subject: [PATCH] unit/test-dbus: pick up dbus-daemon from $PATH
5+
6+This allows running the unit tests in environments where `dbus-daemon`
7+isn't in /usr/bin, but in $PATH.
8+
9+Signed-off-by: Florian Klink <flokli@flokli.de>
10+---
11+ unit/test-dbus-message-fds.c | 4 ++--
12+ unit/test-dbus-properties.c | 4 ++--
13+ unit/test-dbus.c | 4 ++--
14+ 3 files changed, 6 insertions(+), 6 deletions(-)
15+
16+diff --git a/unit/test-dbus-message-fds.c b/unit/test-dbus-message-fds.c
17+index 6f68bae..4b5662e 100644
18+--- a/unit/test-dbus-message-fds.c
19++++ b/unit/test-dbus-message-fds.c
20+@@ -51,7 +51,7 @@ static bool start_dbus_daemon(void)
21+ char *prg_envp[1];
22+ pid_t pid;
23+
24+- prg_argv[0] = "/usr/bin/dbus-daemon";
25++ prg_argv[0] = "dbus-daemon";
26+ prg_argv[1] = "--nopidfile";
27+ prg_argv[2] = "--nofork";
28+ prg_argv[3] = "--config-file=" UNITDIR "dbus.conf";
29+@@ -68,7 +68,7 @@ static bool start_dbus_daemon(void)
30+ }
31+
32+ if (pid == 0) {
33+- execve(prg_argv[0], prg_argv, prg_envp);
34++ execvpe(prg_argv[0], prg_argv, prg_envp);
35+ exit(EXIT_SUCCESS);
36+ }
37+
38+diff --git a/unit/test-dbus-properties.c b/unit/test-dbus-properties.c
39+index b435062..049f0f4 100644
40+--- a/unit/test-dbus-properties.c
41++++ b/unit/test-dbus-properties.c
42+@@ -49,7 +49,7 @@ static bool start_dbus_daemon(void)
43+ char *prg_envp[1];
44+ pid_t pid;
45+
46+- prg_argv[0] = "/usr/bin/dbus-daemon";
47++ prg_argv[0] = "dbus-daemon";
48+ prg_argv[1] = "--nopidfile";
49+ prg_argv[2] = "--nofork";
50+ prg_argv[3] = "--config-file=" UNITDIR "dbus.conf";
51+@@ -66,7 +66,7 @@ static bool start_dbus_daemon(void)
52+ }
53+
54+ if (pid == 0) {
55+- execve(prg_argv[0], prg_argv, prg_envp);
56++ execvpe(prg_argv[0], prg_argv, prg_envp);
57+ exit(EXIT_SUCCESS);
58+ }
59+
60+diff --git a/unit/test-dbus.c b/unit/test-dbus.c
61+index 67f0a7b..582847e 100644
62+--- a/unit/test-dbus.c
63++++ b/unit/test-dbus.c
64+@@ -45,7 +45,7 @@ static void start_dbus_daemon(void)
65+ char *prg_envp[1];
66+ pid_t pid;
67+
68+- prg_argv[0] = "/usr/bin/dbus-daemon";
69++ prg_argv[0] = "dbus-daemon";
70+ prg_argv[1] = "--nopidfile";
71+ prg_argv[2] = "--nofork";
72+ prg_argv[3] = "--config-file=" UNITDIR "dbus.conf";
73+@@ -62,7 +62,7 @@ static void start_dbus_daemon(void)
74+ }
75+
76+ if (pid == 0) {
77+- execve(prg_argv[0], prg_argv, prg_envp);
78++ execvpe(prg_argv[0], prg_argv, prg_envp);
79+ exit(EXIT_SUCCESS);
80+ }
81+
82+--
83+2.29.2
84+
pkgs/os-specific/linux/ell/default.nix+5−4
@@ -12,13 +12,14 @@ stdenv.mkDerivation rec {
1212 outputs = [ "out" "dev" ];
1313
1414 src = fetchgit {
15− url = "https://git.kernel.org/pub/scm/libs/${pname}/${pname}.git";
16− rev = version;
17− sha256 = "16z7xwlrpx1bsr2y1rgxxxixzwc84cwn2g557iqxhwsxfzy6q3dk";
15+ url = "https://git.kernel.org/pub/scm/libs/${pname}/${pname}.git";
16+ rev = version;
17+ sha256 = "16z7xwlrpx1bsr2y1rgxxxixzwc84cwn2g557iqxhwsxfzy6q3dk";
1818 };
1919
2020 patches = [
21− ./fix-dbus-tests.patch
21+ # Sent upstream in https://lists.01.org/hyperkitty/list/ell@lists.01.org/thread/SQEZAIS2LZXSXGTXOW3GTAM5ZPXRLTN4/
22+ ./0001-unit-test-dbus-pick-up-dbus-daemon-from-PATH.patch
2223 ];
2324
2425 nativeBuildInputs = [
pkgs/os-specific/linux/ell/fix-dbus-tests.patchdeleted−65
@@ -1,65 +0,0 @@
1−--- a/Makefile.am
2−+++ b/Makefile.am
3−@@ -140,6 +140,7 @@
4− ell_libell_private_la_SOURCES = $(ell_libell_la_SOURCES)
5−
6− AM_CFLAGS = -fvisibility=hidden -DUNITDIR=\""$(top_srcdir)/unit/"\" \
7−+ -DDBUS_DAEMON=\""$(DBUS_DAEMONDIR)/dbus-daemon"\" \
8− -DCERTDIR=\""$(top_builddir)/unit/"\"
9−
10− pkgconfigdir = $(libdir)/pkgconfig
11−--- a/configure.ac
12−+++ b/configure.ac
13−@@ -14,6 +14,8 @@
14−
15− AC_PREFIX_DEFAULT(/usr/local)
16−
17−+PKG_PROG_PKG_CONFIG
18−+
19− COMPILER_FLAGS
20−
21− AC_LANG_C
22−@@ -131,6 +133,10 @@
23− AC_CHECK_PROG(have_xxd, [xxd], [yes], [no])
24− fi
25−
26−+PKG_CHECK_MODULES(DBUS, dbus-1, dummy=yes,
27−+ AC_MSG_ERROR(D-Bus is required for running tests))
28−+PKG_CHECK_VAR(DBUS_DAEMONDIR, dbus-1, daemondir)
29−+
30− AM_CONDITIONAL(DBUS_TESTS, test "${little_endian}" = "yes")
31− AM_CONDITIONAL(CERT_TESTS, test "${have_openssl}" = "yes")
32−
33−--- a/unit/test-dbus-message-fds.c
34−+++ b/unit/test-dbus-message-fds.c
35−@@ -51,7 +51,7 @@
36− char *prg_envp[1];
37− pid_t pid;
38−
39−- prg_argv[0] = "/usr/bin/dbus-daemon";
40−+ prg_argv[0] = DBUS_DAEMON;
41− prg_argv[1] = "--nopidfile";
42− prg_argv[2] = "--nofork";
43− prg_argv[3] = "--config-file=" UNITDIR "dbus.conf";
44−--- a/unit/test-dbus-properties.c
45−+++ b/unit/test-dbus-properties.c
46−@@ -48,7 +48,7 @@
47− char *prg_envp[1];
48− pid_t pid;
49−
50−- prg_argv[0] = "/usr/bin/dbus-daemon";
51−+ prg_argv[0] = DBUS_DAEMON;
52− prg_argv[1] = "--nopidfile";
53− prg_argv[2] = "--nofork";
54− prg_argv[3] = "--config-file=" UNITDIR "dbus.conf";
55−--- a/unit/test-dbus.c
56−+++ b/unit/test-dbus.c
57−@@ -45,7 +45,7 @@
58− char *prg_envp[1];
59− pid_t pid;
60−
61−- prg_argv[0] = "/usr/bin/dbus-daemon";
62−+ prg_argv[0] = DBUS_DAEMON;
63− prg_argv[1] = "--nopidfile";
64− prg_argv[2] = "--nofork";
65− prg_argv[3] = "--config-file=" UNITDIR "dbus.conf";