diff --git a/pkgs/applications/networking/p2p/gnunet/default.nix b/pkgs/applications/networking/p2p/gnunet/default.nix index 1abf982f9a3..6f69b8c7ca1 100644 --- a/pkgs/applications/networking/p2p/gnunet/default.nix +++ b/pkgs/applications/networking/p2p/gnunet/default.nix @@ -6,20 +6,16 @@ assert gtkSupport -> (gtk != null) && (libglade != null); -let version = "0.8.0b"; +let version = "0.8.1"; in stdenv.mkDerivation { name = "gnunet-${version}"; src = fetchurl { - url = "http://gnunet.org/download/GNUnet-${version}.tar.bz2"; - sha256 = "1d1abnfqbd1f8pjzq9p0za7jyy2lay7k8l09xadk83k8d96abwcs"; + url = "mirror://gnu/gnunet/GNUnet-${version}.tar.gz"; + sha256 = "0makh52fsrsxg2qgfi1n68sh2hllqxj453g335m05wk05d7minl4"; }; - configureFlags = '' - --without-included-ltdl --disable-ltdl-install --with-ltdl-include=${libtool}/include --with-ltdl-lib=${libtool}/lib - ''; - buildInputs = [ libextractor libmicrohttpd libgcrypt gmp curl libtool zlib guile adns sqlite libxml2 ncurses @@ -27,14 +23,19 @@ in makeWrapper ] ++ (if gtkSupport then [ gtk libglade ] else []); - patches = [ - ./tmpdir.patch - ./disable-http-tests.patch - ]; - preConfigure = '' - # Brute force: make sure the tests don't rely on `/tmp', for - # the sake of chroot builds. + # Brute force: since nix-worker chroots don't provide + # /etc/{resolv.conf,hosts}, replace all references to `localhost' + # by their IPv4 equivalent. + for i in $(find . \( -name \*.c -or -name \*.conf \) \ + -exec grep -l localhost {} \;) + do + echo "$i: substituting \`127.0.0.1' to \`localhost'..." + substituteInPlace "$i" --replace "localhost" "127.0.0.1" + done + + # Make sure the tests don't rely on `/tmp', for the sake of chroot + # builds. for i in $(find . \( -iname \*test\*.c -or -name \*.conf \) \ -exec grep -l /tmp {} \;) do @@ -43,16 +44,15 @@ in done ''; - # Tests have to be run xonce it's installed. - # FIXME: Re-enable tests when they are less broken. - #postInstall = '' - # GNUNET_PREFIX="$out" make check - #''; - doCheck = false; - # Help programs find the numerous modules that sit under `$out/lib/GNUnet'. + # 1. Run tests have once GNUnet is installed. + # 2. Help programs find the numerous modules that sit under + # `$out/lib/GNUnet'. + + # FIXME: `src/transports/test_udp' hangs forever. postInstall = '' + #GNUNET_PREFIX="$out" make check wrapProgram "$out/bin/gnunetd" \ --prefix LTDL_LIBRARY_PATH ":" "$out/lib/GNUnet" ''; @@ -78,5 +78,7 @@ in homepage = http://gnunet.org/; license = "GPLv2+"; + + maintainers = [ stdenv.lib.maintainers.ludo ]; }; } diff --git a/pkgs/applications/networking/p2p/gnunet/disable-http-tests.patch b/pkgs/applications/networking/p2p/gnunet/disable-http-tests.patch deleted file mode 100644 index 919a1fca63c..00000000000 --- a/pkgs/applications/networking/p2p/gnunet/disable-http-tests.patch +++ /dev/null @@ -1,88 +0,0 @@ -Disable HTTP tests as they seem to deadlock when building in a chroot on NixOS. - -diff --git a/src/transports/Makefile.in b/src/transports/Makefile.in -index b0b76a2..30a0bb5 100644 ---- a/src/transports/Makefile.in -+++ b/src/transports/Makefile.in -@@ -38,8 +38,8 @@ PRE_UNINSTALL = : - POST_UNINSTALL = : - host_triplet = @host@ - check_PROGRAMS = test_udp$(EXEEXT) test_tcp$(EXEEXT) \ -- test_http$(EXEEXT) testrepeat_udp$(EXEEXT) \ -- testrepeat_tcp$(EXEEXT) testrepeat_http$(EXEEXT) -+ testrepeat_udp$(EXEEXT) \ -+ testrepeat_tcp$(EXEEXT) - subdir = src/transports - DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in - ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 - -diff --git a/src/applications/session/Makefile.in b/src/applications/session/Makefile.in -index b2717f9..a048d21 100644 ---- a/src/applications/session/Makefile.in -+++ b/src/applications/session/Makefile.in -@@ -38,7 +38,7 @@ PRE_UNINSTALL = : - POST_UNINSTALL = : - host_triplet = @host@ - check_PROGRAMS = sessiontest_tcp$(EXEEXT) sessiontest_udp$(EXEEXT) \ -- sessiontest_nat$(EXEEXT) $(am__EXEEXT_1) -+ sessiontest_nat$(EXEEXT) - subdir = src/applications/session - DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in - ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 - -diff --git a/src/applications/tbench/Makefile.in b/src/applications/tbench/Makefile.in -index ea061bc..c6ee8f8 100644 ---- a/src/applications/tbench/Makefile.in -+++ b/src/applications/tbench/Makefile.in -@@ -39,8 +39,7 @@ PRE_UNINSTALL = : - POST_UNINSTALL = : - host_triplet = @host@ - bin_PROGRAMS = gnunet-tbench$(EXEEXT) --check_PROGRAMS = tbenchtest_tcp$(EXEEXT) tbenchtest_udp$(EXEEXT) \ -- $(am__EXEEXT_1) -+check_PROGRAMS = tbenchtest_tcp$(EXEEXT) tbenchtest_udp$(EXEEXT) - subdir = src/applications/tbench - DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in - ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 - -diff --git a/src/applications/advertising/Makefile.in b/src/applications/advertising/Makefile.in -index 454fa63..af7aefb 100644 ---- a/src/applications/advertising/Makefile.in -+++ b/src/applications/advertising/Makefile.in -@@ -38,7 +38,7 @@ PRE_UNINSTALL = : - POST_UNINSTALL = : - host_triplet = @host@ - check_PROGRAMS = advertisingtest_tcp$(EXEEXT) \ -- advertisingtest_udp$(EXEEXT) $(am__EXEEXT_1) -+ advertisingtest_udp$(EXEEXT) - subdir = src/applications/advertising - DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in - ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 - -diff --git a/src/applications/bootstrap_http/Makefile.in b/src/applications/bootstrap_http/Makefile.in -index 29800af..ad5c6a1 100644 ---- a/src/applications/bootstrap_http/Makefile.in -+++ b/src/applications/bootstrap_http/Makefile.in -@@ -37,7 +37,7 @@ NORMAL_UNINSTALL = : - PRE_UNINSTALL = : - POST_UNINSTALL = : - host_triplet = @host@ --check_PROGRAMS = httptest$(EXEEXT) -+check_PROGRAMS = - subdir = src/applications/bootstrap_http - DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in - ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 - -diff --git a/src/applications/hostlist/Makefile.in b/src/applications/hostlist/Makefile.in -index 126df5e..2317c60 100644 ---- a/src/applications/hostlist/Makefile.in -+++ b/src/applications/hostlist/Makefile.in -@@ -37,7 +37,7 @@ NORMAL_UNINSTALL = : - PRE_UNINSTALL = : - POST_UNINSTALL = : - host_triplet = @host@ --check_PROGRAMS = hostlisttest$(EXEEXT) -+check_PROGRAMS = - subdir = src/applications/hostlist - DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in - ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 diff --git a/pkgs/applications/networking/p2p/gnunet/tmpdir.patch b/pkgs/applications/networking/p2p/gnunet/tmpdir.patch deleted file mode 100644 index e47a253e0f0..00000000000 --- a/pkgs/applications/networking/p2p/gnunet/tmpdir.patch +++ /dev/null @@ -1,93 +0,0 @@ -Make sure the core libraries used by the tests honor $TMPDIR. - -diff --git a/src/applications/dstore_sqlite/dstore.c b/src/applications/dstore_sqlite/dstore.c -index cdcae81..4bb45a3 100644 ---- a/src/applications/dstore_sqlite/dstore.c -+++ b/src/applications/dstore_sqlite/dstore.c -@@ -129,6 +129,7 @@ db_reset () - int fd; - sqlite3 *dbh; - char *tmpl; -+ const char *tmpdir; - - if (fn != NULL) - { -@@ -136,7 +137,15 @@ db_reset () - GNUNET_free (fn); - } - payload = 0; -- tmpl = "/tmp/dstoreXXXXXX"; -+ -+ tmpdir = getenv ("TMPDIR"); -+ tmpdir = tmpdir ? tmpdir : "/tmp"; -+ -+#define TEMPLATE "/gnunet-dstoreXXXXXX" -+ tmpl = alloca (strlen (tmpdir) + sizeof (TEMPLATE) + 1); -+ strcpy (tmpl, tmpdir); -+ strcat (tmpl, TEMPLATE); -+#undef TEMPLATE - - #ifdef MINGW - fn = (char *) GNUNET_malloc (MAX_PATH + 1); -diff --git a/src/applications/fs/collection/collection.c b/src/applications/fs/collection/collection.c -index 5671cb3..da2b605 100644 ---- a/src/applications/fs/collection/collection.c -+++ b/src/applications/fs/collection/collection.c -@@ -487,6 +487,7 @@ GNUNET_CO_collection_publish_now () - char *dirData; - char this_revision_string[128]; - char next_revision_string[128]; -+ const char *tmpdir; - - GNUNET_mutex_lock (lock); - if ((collectionData == NULL) || -@@ -495,7 +496,17 @@ GNUNET_CO_collection_publish_now () - GNUNET_mutex_unlock (lock); - return; - } -- tmpName = GNUNET_strdup ("/tmp/gnunet-collectionXXXXXX"); -+ -+ tmpdir = getenv ("TMPDIR"); -+ tmpdir = tmpdir ? tmpdir : "/tmp"; -+ -+#define TEMPLATE "/gnunet-collectionXXXXXX" -+ tmpName = alloca (strlen (tmpdir) + sizeof (TEMPLATE) + 1); -+ strcpy (tmpName, tmpdir); -+ strcat (tmpName, TEMPLATE); -+#undef TEMPLATE -+ -+ tmpName = GNUNET_strdup (tmpName); - fd = mkstemp (tmpName); - if (fd == -1) - { -diff --git a/src/applications/fs/fsui/upload.c b/src/applications/fs/fsui/upload.c -index dc683a5..46a04af 100644 ---- a/src/applications/fs/fsui/upload.c -+++ b/src/applications/fs/fsui/upload.c -@@ -159,6 +159,7 @@ createDirectoryHelper (struct GNUNET_GE_Context *ectx, - int handle; - struct GNUNET_GE_Memory *mem; - struct GNUNET_GE_Context *ee; -+ const char *tmpdir; - - fis = NULL; - size = 0; -@@ -208,7 +209,17 @@ createDirectoryHelper (struct GNUNET_GE_Context *ectx, - pos = pos->next; - } - GNUNET_GE_memory_reset (mem); -- tempName = GNUNET_strdup ("/tmp/gnunet-upload-dir.XXXXXX"); -+ -+ tmpdir = getenv ("TMPDIR"); -+ tmpdir = tmpdir ? tmpdir : "/tmp"; -+ -+#define TEMPLATE "/gnunet-upload-dirXXXXXX" -+ tempName = alloca (strlen (tmpdir) + sizeof (TEMPLATE) + 1); -+ strcpy (tempName, tmpdir); -+ strcat (tempName, TEMPLATE); -+#undef TEMPLATE -+ -+ tempName = GNUNET_strdup (tempName); - handle = mkstemp (tempName); - if (handle == -1) - {