From 1ec5b7f1d370a15c9a4db20e4c3802e8e7eb7d18 Mon Sep 17 00:00:00 2001 From: Orivej Desh Date: Sun, 23 Jul 2017 10:28:43 +0000 Subject: [PATCH] mailutils: 2.2 -> 3.2 --- pkgs/tools/networking/mailutils/default.nix | 72 ++++++++++++++----- .../mailutils/fix-build-mb-len-max.patch | 14 ++++ .../mailutils/fix-test-ali-awk.patch | 16 +++++ pkgs/tools/networking/mailutils/no-gets.patch | 14 ---- .../networking/mailutils/path-to-cat.patch | 49 +++++++++++-- .../networking/mailutils/scm_c_string.patch | 15 ---- pkgs/top-level/all-packages.nix | 1 + 7 files changed, 131 insertions(+), 50 deletions(-) create mode 100644 pkgs/tools/networking/mailutils/fix-build-mb-len-max.patch create mode 100644 pkgs/tools/networking/mailutils/fix-test-ali-awk.patch delete mode 100644 pkgs/tools/networking/mailutils/no-gets.patch delete mode 100644 pkgs/tools/networking/mailutils/scm_c_string.patch diff --git a/pkgs/tools/networking/mailutils/default.nix b/pkgs/tools/networking/mailutils/default.nix index f83ea004db63..82d581650bb8 100644 --- a/pkgs/tools/networking/mailutils/default.nix +++ b/pkgs/tools/networking/mailutils/default.nix @@ -1,36 +1,76 @@ -{ fetchurl, stdenv, gettext, gdbm, libtool, pam, readline -, ncurses, gnutls, sasl, fribidi, gss , mysql, guile, texinfo, - gnum4, dejagnu, nettools }: +{ stdenv, fetchurl, fetchpatch, autoreconfHook, dejagnu, gettext, libtool, pkgconfig +, gdbm, pam, readline, ncurses, gnutls, guile, texinfo, gnum4, sasl, fribidi, nettools +, gss, mysql }: +let + p = "https://raw.githubusercontent.com/gentoo/gentoo/9c921e89d51876fd876f250324893fd90c019326/net-mail/mailutils/files"; +in stdenv.mkDerivation rec { - name = "mailutils-2.2"; + name = "${project}-${version}"; + project = "mailutils"; + version = "3.2"; src = fetchurl { - url = "mirror://gnu/mailutils/${name}.tar.bz2"; - sha256 = "0szbqa12zqzldqyw97lxqax3ja2adis83i7brdfsxmrfw68iaf65"; + url = "mirror://gnu/${project}/${name}.tar.xz"; + sha256 = "0zh7xn8yvnw9zkc7gi5290i34viwxp1rn0g1q9nyvmckkvk59lwn"; }; - hardeningDisable = [ "format" ]; + nativeBuildInputs = [ + autoreconfHook gettext libtool pkgconfig + ] ++ stdenv.lib.optional doCheck dejagnu; - patches = [ ./path-to-cat.patch ./no-gets.patch ./scm_c_string.patch ]; + buildInputs = [ + gdbm pam readline ncurses gnutls guile texinfo gnum4 sasl fribidi nettools + gss mysql.lib + ]; + + patches = [ + (fetchpatch { + url = "${p}/mailutils-3.2-fix-build.patch"; + sha256 = "0yzkfx3j1zkkb43fhchjqphw4xznbclj39bjzjggv32gppy6d1db"; + }) + ./fix-build-mb-len-max.patch + ./fix-test-ali-awk.patch + ./path-to-cat.patch + ]; + + readmsg-tests = stdenv.lib.optionals doCheck [ + (fetchurl { url = "${p}/hdr.at"; sha256 = "0phpkqyhs26chn63wjns6ydx9468ng3ssbjbfhcvza8h78jlsd98"; }) + (fetchurl { url = "${p}/nohdr.at"; sha256 = "1vkbkfkbqj6ml62s1am8i286hxwnpsmbhbnq0i2i0j1i7iwkk4b7"; }) + (fetchurl { url = "${p}/twomsg.at"; sha256 = "15m29rg2xxa17xhx6jp4s2vwa9d4khw8092vpygqbwlhw68alk9g"; }) + (fetchurl { url = "${p}/weed.at"; sha256 = "1101xakhc99f5gb9cs3mmydn43ayli7b270pzbvh7f9rbvh0d0nh"; }) + ]; postPatch = '' + sed -e '/AM_GNU_GETTEXT_VERSION/s/0.18/0.19/' -i configure.ac sed -i -e '/chown root:mail/d' \ -e 's/chmod [24]755/chmod 0755/' \ - */Makefile{,.in,.am} + */Makefile{.in,.am} ''; configureFlags = [ - "--with-gsasl" - "--with-gssapi=${gss}" + "--with-gssapi" + "--with-mysql" ]; - buildInputs = - [ gettext gdbm libtool pam readline ncurses - gnutls mysql.lib guile texinfo gnum4 sasl fribidi gss nettools ] - ++ stdenv.lib.optional doCheck dejagnu; + preCheck = '' + # Add missing files. + cp ${builtins.toString readmsg-tests} readmsg/tests/ + for f in hdr.at nohdr.at twomsg.at weed.at; do + mv readmsg/tests/*-$f readmsg/tests/$f + done + # Disable comsat tests that fail without tty in the sandbox. + tty -s || echo > comsat/tests/testsuite.at + # Disable mda tests that require /etc/passwd to contain root. + grep -qo '^root:' /etc/passwd || echo > maidag/tests/mda.at + # Provide libraries for mhn. + export LD_LIBRARY_PATH=$(pwd)/lib/.libs + ''; + postCheck = "unset LD_LIBRARY_PATH"; doCheck = true; + enableParallelBuilding = true; + hardeningDisable = [ "format" ]; meta = with stdenv.lib; { description = "Rich and powerful protocol-independent mail framework"; @@ -60,7 +100,7 @@ stdenv.mkDerivation rec { gpl3Plus /* tools */ ]; - maintainers = with maintainers; [ vrthra ]; + maintainers = with maintainers; [ orivej vrthra ]; homepage = http://www.gnu.org/software/mailutils/; diff --git a/pkgs/tools/networking/mailutils/fix-build-mb-len-max.patch b/pkgs/tools/networking/mailutils/fix-build-mb-len-max.patch new file mode 100644 index 000000000000..b28dfc5d99ca --- /dev/null +++ b/pkgs/tools/networking/mailutils/fix-build-mb-len-max.patch @@ -0,0 +1,14 @@ +diff --git a/frm/frm.h b/frm/frm.h +index 178b87d54..7931faada 100644 +--- a/frm/frm.h ++++ b/frm/frm.h +@@ -34,6 +34,9 @@ + #ifdef HAVE_ICONV_H + # include + #endif ++#ifdef HAVE_LIMITS_H ++# include ++#endif + #ifndef MB_LEN_MAX + # define MB_LEN_MAX 4 + #endif diff --git a/pkgs/tools/networking/mailutils/fix-test-ali-awk.patch b/pkgs/tools/networking/mailutils/fix-test-ali-awk.patch new file mode 100644 index 000000000000..3d301d530def --- /dev/null +++ b/pkgs/tools/networking/mailutils/fix-test-ali-awk.patch @@ -0,0 +1,16 @@ +diff --git a/mh/tests/ali.at b/mh/tests/ali.at +index 28c0e5451..c76cf9363 100644 +--- a/mh/tests/ali.at ++++ b/mh/tests/ali.at +@@ -85,9 +85,9 @@ ali -a ./mh_aliases korzen | tr -d ' ' + [expout]) + + MH_CHECK([ali: group id],[ali05 ali-group-id ali-gid],[ +-cat /etc/passwd | awk -F : '/^#/ { next } $4==0 { print $1 }' > expout ++cat /etc/passwd | awk -F : '/^#/ { next } $4==0 { print $1; exit }' > expout + test -s expout || AT_SKIP_TEST +-name=`awk -F : '/^#/ { next } $3==0 { print $1 }' /etc/group < /dev/null` ++name=`awk -F : '/^#/ { next } $3==0 { print $1; exit }' /etc/group < /dev/null` + test -z "$name" && AT_SKIP_TEST + + echo "korzen: +$name" > mh_aliases diff --git a/pkgs/tools/networking/mailutils/no-gets.patch b/pkgs/tools/networking/mailutils/no-gets.patch deleted file mode 100644 index d72fa3f056cc..000000000000 --- a/pkgs/tools/networking/mailutils/no-gets.patch +++ /dev/null @@ -1,14 +0,0 @@ ---- a/lib/stdio.in.h -+++ b/lib/stdio.in.h -@@ -138,8 +138,10 @@ - /* It is very rare that the developer ever has full control of stdin, - so any use of gets warrants an unconditional warning. Assume it is - always declared, since it is required by C89. */ --#undef gets -+#ifdef gets -+# undef gets - _GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead"); -+#endif - - #if @GNULIB_FOPEN@ - # if @REPLACE_FOPEN@ diff --git a/pkgs/tools/networking/mailutils/path-to-cat.patch b/pkgs/tools/networking/mailutils/path-to-cat.patch index a9ae7c5366d2..698ee08f340f 100644 --- a/pkgs/tools/networking/mailutils/path-to-cat.patch +++ b/pkgs/tools/networking/mailutils/path-to-cat.patch @@ -1,8 +1,47 @@ -Fix absolute path to `cat'. - ---- mailutils-2.2/testsuite/lib/mailutils.exp 2010-09-10 13:39:58.000000000 +0200 -+++ mailutils-2.2/testsuite/lib/mailutils.exp 2010-09-10 13:40:00.000000000 +0200 -@@ -719,7 +719,7 @@ proc mu_test_file {args} { +diff --git a/mh/show.c b/mh/show.c +index a43afe10c..6985386ec 100644 +--- a/mh/show.c ++++ b/mh/show.c +@@ -254,7 +254,7 @@ main (int argc, char **argv) + */ + + if (!use_showproc) +- showproc = "/bin/cat"; ++ showproc = "cat"; + else + showproc = mh_global_profile_get ("showproc", NULL); + +diff --git a/mh/tests/mhparam.at b/mh/tests/mhparam.at +index 54b7fc06a..3abd5bf9b 100644 +--- a/mh/tests/mhparam.at ++++ b/mh/tests/mhparam.at +@@ -28,7 +28,7 @@ mhparam -all | tr '\t' ' ' | sed 's/^Path:.*/Path: Mail/;s/^mhetcdir:.*/mhetcdir + [0], + [Path: Mail + mhetcdir: dir +-moreproc: /bin/cat ++moreproc: cat + Sequence-Negation: not + Draft-Folder: Mail/drafts + Aliasfile: .mh_aliases +diff --git a/mh/tests/testsuite.at b/mh/tests/testsuite.at +index c6820843c..6675a4a9c 100644 +--- a/mh/tests/testsuite.at ++++ b/mh/tests/testsuite.at +@@ -25,7 +25,7 @@ export MH + cat > $MH <