diff options
author | Sergey Poznyakoff <gray@gnu.org> | 2017-11-11 11:10:49 +0200 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org> | 2017-11-11 11:10:49 +0200 |
commit | 499992bf3bbf7e7d3e1203563f856f6db229d73c (patch) | |
tree | e34d7f1c16bef5ce978fe40a35f41abea5a3f49f | |
parent | ba1c15e2290246d272037404c46f44abd9d98c0e (diff) | |
download | wydawca-499992bf3bbf7e7d3e1203563f856f6db229d73c.tar.gz wydawca-499992bf3bbf7e7d3e1203563f856f6db229d73c.tar.bz2 |
Fix build with mailutils 3.4
* Makefile.am (ACLOCAL_AMFLAGS): Add am.
* NEWS: Update.
* am/mailutils.m4: New file. A fixed version of upstream mailutils.m4
* configure.ac: Require mailutils 3.3. Raise patchlevel.
* tests/nullmail.c: New file.
* tests/.gitignore: Add nullmail
* tests/Makefile.am: Build nullmail
* tests/etc/nullmail: Remove
* tests/etc/Makefile.am: Remove nullmail script.
* tests/atlocal.in (WY_TESTDIR): New variable.
* tests/check-notify.at: Use new nullmail tool. Update expected
output.
* tests/mailstats.at: Likewise.
* tests/notify-upl.at: Likewise.
* tests/etc/mailstats.rcin: Fix mailer command line.
* tests/etc/notify.rcin: Likewise.
-rw-r--r-- | Makefile.am | 2 | ||||
-rw-r--r-- | NEWS | 4 | ||||
-rw-r--r-- | am/mailutils.m4 | 89 | ||||
-rw-r--r-- | configure.ac | 4 | ||||
-rw-r--r-- | tests/.gitignore | 1 | ||||
-rw-r--r-- | tests/Makefile.am | 4 | ||||
-rw-r--r-- | tests/atlocal.in | 2 | ||||
-rw-r--r-- | tests/check-notify.at | 4 | ||||
-rw-r--r-- | tests/etc/Makefile.am | 1 | ||||
-rw-r--r-- | tests/etc/mailstats.rcin | 2 | ||||
-rw-r--r-- | tests/etc/notify.rcin | 2 | ||||
-rwxr-xr-x | tests/etc/nullmail | 11 | ||||
-rw-r--r-- | tests/mailstats.at | 4 | ||||
-rw-r--r-- | tests/notify-upl.at | 8 | ||||
-rw-r--r-- | tests/nullmail.c | 84 |
15 files changed, 191 insertions, 31 deletions
diff --git a/Makefile.am b/Makefile.am index 831bc79..897c567 100644 --- a/Makefile.am +++ b/Makefile.am @@ -11,13 +11,13 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with wydawca. If not, see <http://www.gnu.org/licenses/>. -ACLOCAL_AMFLAGS = -I m4 -I grecs/am -I imprimatur +ACLOCAL_AMFLAGS = -I m4 -I am -I grecs/am -I imprimatur SUBDIRS=grecs libltdl include src modules imprimatur doc etc tests # We never remove files from the configuration directory distuninstallcheck_listfiles = \ find $(prefix) -type f -not -path '$(sysconfdir)/*' @@ -1,14 +1,14 @@ -Wydawca NEWS -- history of user-visible changes. 2013-03-12 +Wydawca NEWS -- history of user-visible changes. 2017-11-11 Copyright (C) 2007-2013, 2017 Sergey Poznyakoff See the end of file for copying conditions. Please send Wydawca bug reports to <bug-wydawca@gnu.org.ua>. -Version 2.99.90 +Version 2.99.91 (git) Version 2.2 "HGY", 2013-01-01 * Implements upload protocol version 1.2 * Input file locations include start and end columns. diff --git a/am/mailutils.m4 b/am/mailutils.m4 new file mode 100644 index 0000000..9bb79a0 --- /dev/null +++ b/am/mailutils.m4 @@ -0,0 +1,89 @@ +dnl A fixed version of AM_MAILUTILS macro. +dnl The macro shipped with mailutils 3.3 mishandles the "mailer" +dnl link requirement. Until it is fixed upstream, wydawca will be +dnl using this version. + +dnl Copyright (C) 2006-2007, 2010-2012, 2014-2017 Free Software +dnl Foundation, Inc. +dnl +dnl GNU Mailutils is free software; you can redistribute it and/or +dnl modify it under the terms of the GNU General Public License as +dnl published by the Free Software Foundation; either version 3, or (at +dnl your option) any later version. +dnl +dnl GNU Mailutils is distributed in the hope that it will be useful, but +dnl WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +dnl General Public License for more details. +dnl +dnl You should have received a copy of the GNU General Public License +dnl along with GNU Mailutils. If not, see <http://www.gnu.org/licenses/>. + +m4_define([am_mu_vercmp],[ +m4_pushdef([_ver_A_],m4_car($1))dnl +m4_pushdef([_ver_B_],m4_car($2))dnl +m4_if(_ver_B_,,:,[if test m4_if(_ver_A_,,0,_ver_A_) -lt _ver_B_; then + $3 +elif test m4_if(_ver_A_,,0,_ver_A_) -eq _ver_B_; then +am_mu_vercmp(m4_cdr($1),m4_cdr($2),[$3]) +fi +m4_popdef([_ver_A_])dnl +m4_popdef([_ver_B_])dnl])]) + +dnl AM_GNU_MAILUTILS(minversion, link-req, [act-if-found], [ac-if-not-found]) +dnl $1 $2 $3 $4 +dnl Verify if GNU Mailutils is installed and if its version is `minversion' +dnl or newer. If not installed, execute `ac-if-not-found' or, if it is not +dnl given, spit out an error message. +dnl +dnl If Mailutils is found, set: +dnl MAILUTILS_CONFIG to the full name of the mailutils-config program; +dnl MAILUTILS_VERSION to the Mailutils version (string); +dnl MAILUTILS_VERSION_MAJOR Mailutils version: major number +dnl MAILUTILS_VERSION_MINOR Mailutils version: minor number +dnl MAILUTILS_VERSION_PATCH Mailutils version: patchlevel number (or 0, +dnl if not defined) +dnl MAILUTILS_LIBS to the list of cc(1) flags needed to link in the +dnl libraries requested by `link-req'; +dnl MAILUTILS_INCLUDES to the list of cc(1) flags needed to set include +dnl paths to the Mailutils headers. +dnl +dnl Finally, if `act-if-found' is given, execute it. Otherwise, append the +dnl value of $MAILUTILS_LIBS to LIBS. +dnl +AC_DEFUN([AM_GNU_MAILUTILS], + [AC_PATH_PROG(MAILUTILS_CONFIG, mailutils-config, none, $PATH) + if test "$MAILUTILS_CONFIG" = "none"; then + m4_if($4,,[AC_MSG_ERROR(cannot find GNU Mailutils)], [$4]) + fi + AC_SUBST(MAILUTILS_CONFIG) + AC_SUBST(MAILUTILS_VERSION) + AC_SUBST(MAILUTILS_INCLUDES) + AC_SUBST(MAILUTILS_LIBS) + + m4_ifndef([MU_VERSION_PARSE_DEFINED],[[ +mu_version_parse() { + set -- `echo "@S|@1" | sed 's/^\([0-9\.][0-9\.]*\).*/\1/;s/\./ /g'` + major=@S|@{1:-0} + minor=@S|@{2:-0} + patch=@S|@{3:-0} +}] + m4_pushdef([MU_VERSION_PARSE_DEFINED])]) + + MAILUTILS_VERSION=`$MAILUTILS_CONFIG --info version|sed 's/VERSION=//'` + mu_version_parse $MAILUTILS_VERSION + AC_DEFINE_UNQUOTED([MAILUTILS_VERSION_MAJOR], $major, [Mailutils version major number]) + AC_DEFINE_UNQUOTED([MAILUTILS_VERSION_MINOR], $minor, [Mailutils version minor number]) + AC_DEFINE_UNQUOTED([MAILUTILS_VERSION_PATCH], $patch, [Mailutils version patchlevel number]) + + AC_DEFINE_UNQUOTED(MAILUTILS_VERSION, "$MAILUTILS_VERSION", [Mailutils version number]) + m4_if($1,,,[ + am_mu_vercmp(m4_quote($major, $minor, $patch), + m4_dquote(m4_bpatsubst($1, [\.],[,])), + [AC_MSG_ERROR([Mailutils v. $MAILUTILS_VERSION is too old; required is at least ]$1)]) + ]) + MAILUTILS_LIBS=`$MAILUTILS_CONFIG --link $2` + MAILUTILS_INCLUDES=`$MAILUTILS_CONFIG --compile` + m4_if($3,,[LIBS="$LIBS $MAILUTILS_LIBS"], [$3]) +]) + diff --git a/configure.ac b/configure.ac index 85dce1a..3e18a57 100644 --- a/configure.ac +++ b/configure.ac @@ -12,13 +12,13 @@ # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with wydawca. If not, see <http://www.gnu.org/licenses/>. AC_PREREQ(2.63) -AC_INIT([wydawca], 2.99.90, [bug-wydawca@gnu.org.ua], [wydawca], +AC_INIT([wydawca], 2.99.91, [bug-wydawca@gnu.org.ua], [wydawca], [http://www.gnu.org.ua/software/wydawca]) AC_CONFIG_SRCDIR([src/wydawca.c]) AC_CONFIG_AUX_DIR([build-aux]) AC_CONFIG_HEADER([config.h]) AC_CONFIG_MACRO_DIR(m4) AM_INIT_AUTOMAKE([1.11 gnits tar-ustar dist-bzip2 dist-xz std-options silent-rules subdir-objects]) @@ -65,13 +65,13 @@ AC_CHECK_FUNCS([fchdir memset strchr strdup strerror strrchr setegid setregid\ inotify_init]) # ********************** # Mailutils # ********************** -AM_GNU_MAILUTILS(2.0, [mailer], [status_mailutils=yes], [status_mailutils=no]) +AM_GNU_MAILUTILS(3.3, [mailer], [status_mailutils=yes], [status_mailutils=no]) AM_CONDITIONAL([COND_MAILUTILS],[test $status_mailutils = yes]) AC_SUBST(WY_MAILUTILS,[$status_mailutils]) # ********************** # MySQL # ********************** diff --git a/tests/.gitignore b/tests/.gitignore index 1df6b71..461469e 100644 --- a/tests/.gitignore +++ b/tests/.gitignore @@ -7,6 +7,7 @@ testsuite.log source dest wstest wsbatch pushck bkupname +nullmail diff --git a/tests/Makefile.am b/tests/Makefile.am index 3f7a491..ebd86ff 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -87,6 +87,10 @@ AM_CPPFLAGS = \ -I$(top_srcdir)/src LDADD=@GRECS_LDADD@ pushck_LDADD=../src/pushd.o bkupname_LDADD=../src/backup.o @GRECS_LDADD@ +if COND_MAILUTILS + check_PROGRAMS += nullmail + nullmail_LDADD = @MAILUTILS_LIBS@ +endif diff --git a/tests/atlocal.in b/tests/atlocal.in index af69a75..083c968 100644 --- a/tests/atlocal.in +++ b/tests/atlocal.in @@ -9,12 +9,13 @@ XFAILFILE=$abs_builddir/.badversion trap "cleanup; test -r $XFAILFILE && cat $XFAILFILE; exit $?" 1 2 13 15 WY_CONFSRC=@abs_top_srcdir@/tests/etc WY_DISTDIR=@abs_top_srcdir@/tests/dist WY_SRC=@abs_top_builddir@/tests/source WY_DST=@abs_top_builddir@/tests/dest +WY_TESTDIR=@abs_top_builddir@/tests WY_MAILUTILS=@WY_MAILUTILS@ MKDIR_P="@MKDIR_P@" wydawca_init_testdirs() { for dir in "$WY_SRC" "$WY_SRC/test" "${WY_SRC}/fail" "${WY_SRC}/ok" "$WY_DST" do @@ -32,12 +33,13 @@ wydawca_clean_testdirs() { wydawca_expandmeta() { sed "s/@USER@/$USER/g; s,@WY_SRC@,$WY_SRC,g; s,@WY_DST@,$WY_DST,g; s,@WY_CONFSRC@,$WY_CONFSRC,g; + s,@WY_TESTDIR@,$WY_TESTDIR,g; s,@WY_MODDIR@,@abs_top_builddir@/modules/mailutils,g" $1 > $2 } wydawca_config() { wydawca_expandmeta $WY_CONFSRC/${1}in $1 } diff --git a/tests/check-notify.at b/tests/check-notify.at index 65aa8b7..fa5cbeb 100644 --- a/tests/check-notify.at +++ b/tests/check-notify.at @@ -40,18 +40,16 @@ wydawca: [[INFO]] symlinks created: 0 wydawca: [[INFO]] symlinks removed: 0 wydawca: [[INFO]] check failures: 1 wydawca: [[NOTICE]] AT_PACKAGE_TARNAME (AT_PACKAGE_NAME AT_PACKAGE_VERSION) finished ]) AT_DATA([outtmpl], -[-F wydawca-noreply@localhost @USER@@localhost -========= +[From wydawca-noreply@localhost From: wydawca-noreply@localhost To: "Wydawca Test User" <@USER@@localhost> Subject: file rejected -X-Mailer: AT_PACKAGE_TARNAME (AT_PACKAGE_NAME AT_PACKAGE_VERSION) Your upload of file has been rejected by the distribution verification procedure with the following diagnostics: WYDAWCA_SPOOL=ckfail WYDAWCA_SOURCE=@WY_SRC@/fail diff --git a/tests/etc/Makefile.am b/tests/etc/Makefile.am index ffb8f99..34d6024 100644 --- a/tests/etc/Makefile.am +++ b/tests/etc/Makefile.am @@ -19,13 +19,12 @@ noinst_DATA = @WYDAWCA_GPGFILES@ EXTRA_DIST = \ pubring.asc\ secring.asc\ wydawca.rcin\ notify.rcin\ - nullmail\ mailstats.rcin GPG_FLAGS = --quiet --no-permission-warning --homedir . pubring.gpg secring.gpg: $(srcdir)/pubring.asc $(srcdir)/secring.asc $(GPG) $(GPG_FLAGS) --import < $(srcdir)/pubring.asc $(GPG) $(GPG_FLAGS) --allow-secret-key-import --import < $(srcdir)/secring.asc diff --git a/tests/etc/mailstats.rcin b/tests/etc/mailstats.rcin index 995cd65..ebe364c 100644 --- a/tests/etc/mailstats.rcin +++ b/tests/etc/mailstats.rcin @@ -17,13 +17,13 @@ module-prepend-load-path "@WY_MODDIR@"; module mailutils mod_mailutils.la; module-init mailutils { admin-address "root@localhost"; from-address "wydawca-noreply@localhost"; - mailer "| @WY_CONFSRC@/nullmail @WY_DST@/mail.out -F ${sender} ${rcpt}"; + mailer "| @WY_TESTDIR@/nullmail -o @WY_DST@/mail.out -F ${sender} ${rcpt}"; mail-statistics { statistics all; message <<EOT Subject: Wydawca stats diff --git a/tests/etc/notify.rcin b/tests/etc/notify.rcin index 3ae3783..b6630b8 100644 --- a/tests/etc/notify.rcin +++ b/tests/etc/notify.rcin @@ -17,13 +17,13 @@ module-prepend-load-path "@WY_MODDIR@"; module mailutils mod_mailutils.la; module-init mailutils { admin-address "root@localhost"; from-address "wydawca-noreply@localhost"; - mailer "| @WY_CONFSRC@/nullmail @WY_DST@/mail.out -F ${sender} ${rcpt}"; + mailer "| @WY_TESTDIR@/nullmail -o @WY_DST@/mail.out -F ${sender} ${rcpt}"; } # Notify the user about successful uploads notify-event { event success; module mailutils; diff --git a/tests/etc/nullmail b/tests/etc/nullmail deleted file mode 100755 index 55220a6..0000000 --- a/tests/etc/nullmail +++ /dev/null @@ -1,11 +0,0 @@ -#! /bin/sh - -out=${1:-/dev/null} -shift - -echo $* >> $out -echo "=========" >> $out -cat - >> $out -echo "=========" -echo "" -exit 0
\ No newline at end of file diff --git a/tests/mailstats.at b/tests/mailstats.at index 32fcb0f..c24cb0e 100644 --- a/tests/mailstats.at +++ b/tests/mailstats.at @@ -35,18 +35,16 @@ wydawca: [[INFO]] symlinks created: 0 wydawca: [[INFO]] symlinks removed: 0 wydawca: [[INFO]] check failures: 0 wydawca: [[NOTICE]] AT_PACKAGE_TARNAME (AT_PACKAGE_NAME AT_PACKAGE_VERSION) finished ]) AT_DATA([expout], -[-F wydawca-noreply@localhost root@localhost -========= +[From wydawca-noreply@localhost From: wydawca-noreply@localhost To: root@localhost Subject: Wydawca stats -X-Mailer: AT_PACKAGE_TARNAME (AT_PACKAGE_NAME AT_PACKAGE_VERSION) This is to notify you that the recent run of wydawca caused the following results: errors ............................. 0 warning ............................ 0 diff --git a/tests/notify-upl.at b/tests/notify-upl.at index 3ace508..7af08e0 100644 --- a/tests/notify-upl.at +++ b/tests/notify-upl.at @@ -36,34 +36,30 @@ wydawca: [[INFO]] symlinks created: 0 wydawca: [[INFO]] symlinks removed: 0 wydawca: [[INFO]] check failures: 0 wydawca: [[NOTICE]] AT_PACKAGE_TARNAME (AT_PACKAGE_NAME AT_PACKAGE_VERSION) finished ]) AT_DATA([outtmpl], -[-F wydawca-noreply@localhost proj-owner@localhost -========= +[From wydawca-noreply@localhost From: wydawca-noreply@localhost To: "Project Admin" <proj-owner@localhost> Subject: Upload of proj successful -X-Mailer: AT_PACKAGE_TARNAME (AT_PACKAGE_NAME AT_PACKAGE_VERSION) Wydawca Test User (@USER@@localhost) successfully uploaded files for proj to ftp://wydawca.test/proj. Files uploaded: listing of file listing of file.sig Regards, Wydawca The Project Submission Robot --F wydawca-noreply@localhost @USER@@localhost -========= +From wydawca-noreply@localhost From: wydawca-noreply@localhost To: "Wydawca Test User" <@USER@@localhost> Subject: Upload of proj successful -X-Mailer: AT_PACKAGE_TARNAME (AT_PACKAGE_NAME AT_PACKAGE_VERSION) Upload of proj to ftp://wydawca.test/proj finished successfully. Files uploaded: listing of file listing of file.sig diff --git a/tests/nullmail.c b/tests/nullmail.c new file mode 100644 index 0000000..4c5bb9d --- /dev/null +++ b/tests/nullmail.c @@ -0,0 +1,84 @@ +#include <mailutils/mailutils.h> + +char const *headers[] = { + MU_HEADER_FROM, + MU_HEADER_TO, + MU_HEADER_SUBJECT, + NULL +}; + +char *output_name; +char *sender_email; + +static struct mu_option nullmail_options[] = { + { "output", 'o', "FILE", MU_OPTION_DEFAULT, + "dump mail to file", + mu_c_string, &output_name }, + { "from", 'F', "EMAIL", MU_OPTION_DEFAULT, + "sender email address", + mu_c_string, &sender_email }, + MU_OPTION_END +}, *options[] = { nullmail_options, NULL }; + +struct mu_cli_setup cli = { + options, + NULL, + "null mailer", + NULL +}; + +char *capa[] = { + "debug", + NULL +}; + +int +main (int argc, char **argv) +{ + int i, rc; + mu_message_t msg; + mu_stream_t input, output, str; + mu_header_t hdr; + mu_body_t body; + + mu_cli (argc, argv, &cli, capa, NULL, &argc, &argv); + /* FIXME: non-option arguments are silently ignored */ + if (output_name) + MU_ASSERT (mu_file_stream_create (&output, output_name, + MU_STREAM_CREAT|MU_STREAM_APPEND)); + else + { + output = mu_strout; + mu_stream_ref (output); + } + + if (sender_email) + mu_stream_printf (output, "From %s\n", sender_email); + + MU_ASSERT (mu_temp_file_stream_create (&input, NULL, 0)); + MU_ASSERT (mu_stream_copy (input, mu_strin, 0, NULL)); + MU_ASSERT (mu_stream_to_message (input, &msg)); + MU_ASSERT (mu_message_get_header (msg, &hdr)); + for (i = 0; headers[i]; i++) + { + char *val; + rc = mu_header_aget_value_unfold (hdr, headers[i], &val); + if (rc == 0) + { + mu_stream_printf (output, "%s: %s\n", headers[i], val); + free (val); + } + else if (rc != MU_ERR_NOENT) + mu_diag_funcall (MU_DIAG_ERROR, "mu_header_get_value_unfold", + headers[i], rc); + } + mu_stream_printf (output, "\n"); + MU_ASSERT (mu_message_get_body (msg, &body)); + MU_ASSERT (mu_body_get_streamref (body, &str)); + MU_ASSERT (mu_stream_copy (output, str, 0, NULL)); + + mu_stream_close (output); + + return 0; +} + |