# HG changeset patch # User Michael Schloh von Bennewitz # Date 1344465674 -7200 # Node ID 01294b31a79e326873ae04e8f90e01a9197450fa # Parent fd1de0c7bc201f3482a91dc5cdeab25dc21faee4 Introduce a lot of changes to correct source and build logic including: Correct URLs, reorder existing patch hunks, update vendor version and patch accordingly, integrate optional SQLite storage, modernize package (remove boilerplate RPM logic), correct preprocessor definitions as NIS+was removed from Solaris 11, use parallel make, improve configuration spacing and whitespace, and remove now uneeded postfix-script(1) and post-install(1) relocation. diff -r fd1de0c7bc20 -r 01294b31a79e postfix/postfix.patch --- a/postfix/postfix.patch Wed Aug 08 20:36:32 2012 +0200 +++ b/postfix/postfix.patch Thu Aug 09 00:41:14 2012 +0200 @@ -1,20 +1,18 @@ Index: makedefs ---- makedefs.orig 2008-01-15 21:20:24 +0100 -+++ makedefs 2008-01-24 12:31:48 +0100 -@@ -132,6 +132,10 @@ +--- makedefs.orig 2011-01-16 22:02:31.000000000 +0100 ++++ makedefs 2011-01-21 09:43:55.000000000 +0100 +@@ -153,6 +153,8 @@ ;; - FreeBSD.7*) SYSTYPE=FREEBSD7 + FreeBSD.8*) SYSTYPE=FREEBSD8 ;; -+ FreeBSD.7*) SYSTYPE=FREEBSD7 -+ ;; -+ FreeBSD.8*) SYSTYPE=FREEBSD8 ++ FreeBSD.9*) SYSTYPE=FREEBSD9 + ;; OpenBSD.2*) SYSTYPE=OPENBSD2 ;; OpenBSD.3*) SYSTYPE=OPENBSD3 Index: src/util/file_limit.c ---- src/util/file_limit.c.orig 2003-10-22 20:48:36 +0200 -+++ src/util/file_limit.c 2008-01-24 12:31:48 +0100 +--- src/util/file_limit.c.orig 2003-10-22 20:48:36.000000000 +0200 ++++ src/util/file_limit.c 2011-01-21 09:43:55.000000000 +0100 @@ -80,12 +80,21 @@ void set_file_limit(off_t limit) { @@ -38,8 +36,8 @@ msg_fatal("setrlimit: %m"); #ifdef SIGXFSZ Index: src/util/msg_syslog.c ---- src/util/msg_syslog.c.orig 2006-06-15 20:07:16 +0200 -+++ src/util/msg_syslog.c 2008-01-24 12:31:48 +0100 +--- src/util/msg_syslog.c.orig 2006-06-15 20:07:16.000000000 +0200 ++++ src/util/msg_syslog.c 2011-01-21 09:43:55.000000000 +0100 @@ -50,6 +50,11 @@ #include #include @@ -89,27 +87,25 @@ /* msg_syslog_init - initialize */ Index: src/util/sys_defs.h ---- src/util/sys_defs.h.orig 2008-01-15 01:51:44 +0100 -+++ src/util/sys_defs.h 2008-01-24 12:32:41 +0100 -@@ -24,7 +24,7 @@ - * 4.4BSD and close derivatives. +--- src/util/sys_defs.h.orig 2011-01-17 15:44:25.000000000 +0100 ++++ src/util/sys_defs.h 2011-01-21 09:43:55.000000000 +0100 +@@ -25,7 +25,7 @@ */ #if defined(FREEBSD2) || defined(FREEBSD3) || defined(FREEBSD4) \ -- || defined(FREEBSD5) || defined(FREEBSD6) || defined(FREEBSD7) \ -+ || defined(FREEBSD5) || defined(FREEBSD6) || defined(FREEBSD7) || defined(FREEBSD8) \ + || defined(FREEBSD5) || defined(FREEBSD6) || defined(FREEBSD7) \ +- || defined(FREEBSD8) \ ++ || defined(FREEBSD8) || defined(FREEBSD9) \ || defined(BSDI2) || defined(BSDI3) || defined(BSDI4) \ || defined(OPENBSD2) || defined(OPENBSD3) || defined(OPENBSD4) \ - || defined(NETBSD1) || defined(NETBSD2) || defined(NETBSD3) \ -Index: src/smtp/smtp_reuse.c ---- src/smtp/smtp_reuse.c.orig 2008-12-04 01:06:42.000000000 +0100 -+++ src/smtp/smtp_reuse.c 2009-04-06 20:38:18.974597344 +0200 -@@ -216,7 +216,9 @@ - /* - * Avoid poor performance when TCP MSS > VSTREAM_BUFSIZE. - */ -+#if 0 - vstream_tweak_sock(session->stream); + || defined(OPENBSD5) \ +@@ -117,6 +117,10 @@ + #define HAS_CLOSEFROM + #endif + ++#if (__FreeBSD_version < 800000 && __FreeBSD_version >= 702104) || (__FreeBSD_version >= 800100) ++#define HAS_CLOSEFROM +#endif ++ + /* OpenBSD version is year+month */ - /* - * Update the list of used cached addresses. + #if OpenBSD >= 199805 /* XXX */ diff -r fd1de0c7bc20 -r 01294b31a79e postfix/postfix.patch.pfls --- a/postfix/postfix.patch.pfls Wed Aug 08 20:36:32 2012 +0200 +++ b/postfix/postfix.patch.pfls Thu Aug 09 00:41:14 2012 +0200 @@ -1,32 +1,28 @@ -This patch makes Pflogsumm working with the particular format -of the OSSP fsl based Postfix logfile and additionally allows -one to specify a more flexible data format. - Index: pflogsumm.1 ---- pflogsumm.1.orig 2007-04-06 16:11:28 +0200 -+++ pflogsumm.1 2007-04-06 17:35:12 +0200 -@@ -172,6 +172,8 @@ - .Vb 2 - \& -d today generate report for just today - \& -d yesterday generate report for just "yesterday" -+\& -d YYYY-MM-DD generate report for just "YYYY-MM-DD" -+\& (Really takes string Date::Parse will handle) - .Ve - .PP - .Vb 1 +--- pflogsumm.1.orig 2012-02-05 23:34:29.000000000 +0100 ++++ pflogsumm.1 2012-02-06 08:49:47.000000000 +0100 +@@ -171,6 +171,8 @@ + \& + \& \-d today generate report for just today + \& \-d yesterday generate report for just "yesterday" ++\& \-d YYYY-MM-DD generate report for just "YYYY-MM-DD" ++\& (Really takes string Date::Parse will handle) + \& + \& \-\-deferral\-detail + \& Index: pflogsumm.pl ---- pflogsumm.pl.orig 2008-06-29 15:46:01 +0200 -+++ pflogsumm.pl 2008-06-29 19:39:07 +0200 +--- pflogsumm.pl.orig 2012-02-05 23:25:25.000000000 +0100 ++++ pflogsumm.pl 2012-02-06 20:53:39.000000000 +0100 @@ -10,7 +10,7 @@ =head1 SYNOPSIS -- pflogsumm.pl -[eq] [-d ] [-h ] [-u ] -+ pflogsumm.pl -[eq] [-d ] [-h ] [-u ] - [--verp_mung[=]] [--verbose_msg_detail] [--iso_date_time] - [-m|--uucp_mung] [-i|--ignore_case] [--smtpd_stats] [--mailq] - [--problems_first] [--rej_add_from] [--no_bounce_detail] -@@ -37,6 +37,9 @@ +- pflogsumm.pl -[eq] [-d ] [--detail ] ++ pflogsumm.pl -[eq] [-d ] [--detail ] + [--bounce-detail ] [--deferral-detail ] + [-h ] [-i|--ignore-case] [--iso-date-time] [--mailq] + [-m|--uucp-mung] [--no-no-msg-size] [--problems-first] +@@ -43,6 +43,9 @@ -d today generate report for just today -d yesterday generate report for just "yesterday" @@ -34,9 +30,9 @@ + (Actually this will take any date string + parsable by the perl Date::Parse module) - -e extended (extreme? excessive?) detail + --deferral-detail -@@ -359,6 +362,7 @@ +@@ -398,6 +401,7 @@ use strict; use locale; use Getopt::Long; @@ -44,28 +40,28 @@ eval { require Date::Calc }; my $hasDateCalc = $@ ? 0 : 1; -@@ -542,8 +546,8 @@ - my $logRmdr; - next unless((($msgMonStr, $msgDay, $msgHr, $msgMin, $msgSec, $logRmdr) = - /^(...) +(\d+) (..):(..):(..) \S+ (.+)$/o) == 6); -- unless((($cmd, $qid) = $logRmdr =~ m#^(?:postfix|$syslogName)/([^\[:]*).*?: ([^:\s]+)#o) == 2 || +@@ -639,8 +643,8 @@ + --$msgMon; + } + +- unless((($cmd, $qid) = $logRmdr =~ m#^(?:postfix|$syslogName)(?:/(?:smtps|submission))?/([^\[:]*).*?: ([^:\s]+)#o) == 2 || - (($cmd, $qid) = $logRmdr =~ m#^((?:postfix)(?:-script)?)(?:\[\d+\])?: ([^:\s]+)#o) == 2) -+ unless((($cmd, $qid) = $logRmdr =~ m#^<[a-z]+>\s+(?:postfix|$syslogName)/([^\[:]*).*?: ([^:\s]+)#o) == 2 || ++ unless((($cmd, $qid) = $logRmdr =~ m#^<[a-z]+>\s+(?:postfix|$syslogName)(?:/(?:smtps|submission))?/([^\[:]*).*?: ([^:\s]+)#o) == 2 || + (($cmd, $qid) = $logRmdr =~ m#^<[a-z]+>\s+((?:postfix)(?:-script)?)(?:\[\d+\])?: ([^:\s]+)#o) == 2) { #print UNPROCD "$_"; next; -@@ -1406,11 +1410,11 @@ +@@ -1514,11 +1518,11 @@ # Back up to yesterday $time -= ((localtime($time))[2] + 2) * 3600; } elsif($dateOpt ne "today") { - die "$usageMsg\n"; + $time = str2time($dateOpt); } - my ($t_mday, $t_mon) = (localtime($time))[3,4]; + my ($t_mday, $t_mon, $t_year) = (localtime($time))[3,4,5]; -- return sprintf("%s %2d", $monthNames[$t_mon], $t_mday); -+ return sprintf("%s %02d", $monthNames[$t_mon], $t_mday); +- return sprintf("%s %2d", $monthNames[$t_mon], $t_mday), sprintf("%04d-%02d-%02d", $t_year+1900, $t_mon+1, $t_mday); ++ return sprintf("%s %02d", $monthNames[$t_mon], $t_mday), sprintf("%04d-%02d-%02d", $t_year+1900, $t_mon+1, $t_mday); } # if there's a real domain: uses that. Otherwise uses the IP addr. diff -r fd1de0c7bc20 -r 01294b31a79e postfix/postfix.spec --- a/postfix/postfix.spec Wed Aug 08 20:36:32 2012 +0200 +++ b/postfix/postfix.spec Thu Aug 09 00:41:14 2012 +0200 @@ -22,8 +22,8 @@ ## # package versions -%define V_postfix 2.5.6 -%define V_pflogsumm 1.1.2 +%define V_postfix 2.9.4 +%define V_pflogsumm 1.1.5 %define V_whoson 2.4.0 # package information @@ -37,12 +37,13 @@ Group: Mail License: IPL Version: %{V_postfix} -Release: 20090418 +Release: 20120800 # package options %option with_fsl yes %option with_ssl no %option with_sasl no +%option with_sqlite no %option with_mysql no %option with_pgsql no %option with_ldap no @@ -57,13 +58,11 @@ Source4: rc.postfix Patch0: postfix.patch Patch1: postfix.patch.pfls -Patch2: ftp://ftp.openpkg.org/sources/CPY/postfix/postfix-%{V_whoson}-whoson.patch +Patch2: http://download.openpkg.org/components/versioned/postfix/postfix-%{V_whoson}-whoson.patch # build information -Prefix: %{l_prefix} -BuildRoot: %{l_buildroot} -BuildPreReq: OpenPKG, openpkg >= 20060823, perl, gcc -PreReq: OpenPKG, openpkg >= 20060823, perl, procmail, perl-time +BuildPreReq: OpenPKG, openpkg >= 20120101, perl, gcc +PreReq: OpenPKG, openpkg >= 20120101, perl, procmail, perl-time BuildPreReq: make, pcre, db PreReq: make, pcre, db %if "%{with_fsl}" == "yes" @@ -78,6 +77,10 @@ BuildPreReq: sasl PreReq: sasl %endif +%if "%{with_sqlite}" == "yes" +BuildPreReq: sqlite +PreReq: sqlite +%endif %if "%{with_mysql}" == "yes" BuildPreReq: mysql PreReq: mysql @@ -94,8 +97,6 @@ BuildPreReq: whoson PreReq: whoson %endif -AutoReq: no -AutoReqProv: no Provides: MTA Conflicts: exim, sendmail, ssmtp @@ -111,6 +112,7 @@ o PCRE matching support o Optional STARTTLS encryption support (see package options) o Optional SASL2 authentication support (see package options) + o Optional SQLite dictionary support (see package options) o Optional MySQL dictionary support (see package options) o Optional PostgreSQL dictionary support (see package options) o Optional OpenLDAP dictionary support (see package options) @@ -129,7 +131,7 @@ } prog postfix:whoson = { version = %{V_whoson} - url = ftp://ftp.openpkg.org/sources/CPY/postfix/ + url = http://download.openpkg.org/components/versioned/postfix/ regex = postfix-(__VER__)-whoson.patch } @@ -142,15 +144,24 @@ %patch -p0 ( cd pflogsumm-%{V_pflogsumm} && %{l_patch} -p0 -b <%{PATCH1} ) || exit $? + # apply vendor WHOSON patch +%if "%{with_whoson}" == "yes" + %patch -p0 -P 2 +%endif + # remove OpenPKG privelege model incompatible exit conditions %{l_shtool} subst \ -e 's;msg_fatal\(.*attribute specifies mail system\);msg_info\1;g' \ src/pipe/pipe.c - # apply vendor WHOSON patch -%if "%{with_whoson}" == "yes" - %patch -p0 -P 2 -%endif + # platform specific corrections + case "%{l_platform -t}" in + *-sunos5.11 ) + %{l_shtool} subst \ + -e 's;#define HAS_NISPLUS;#undef HAS_NISPLUS;' \ + src/util/sys_defs.h + ;; + esac %build # configure Postfix (hard-core part I) @@ -182,6 +193,10 @@ AUXLIBS="$AUXLIBS -ldb" CCARGS="$CCARGS -DHAS_PCRE" AUXLIBS="$AUXLIBS -lpcre" +%if "%{with_sqlite}" == "yes" + CCARGS="$CCARGS -DHAS_SQLITE" + AUXLIBS="$AUXLIBS -lsqlite3" +%endif %if "%{with_mysql}" == "yes" CCARGS="$CCARGS -DHAS_MYSQL %{l_cppflags mysql .}" AUXLIBS="$AUXLIBS %{l_ldflags mysql .} -lmysqlclient -lz -lm" @@ -232,10 +247,9 @@ src/util/sys_defs.h # build Postfix - %{l_make} %{l_mflags} + %{l_make} %{l_mflags -O} %install - rm -rf $RPM_BUILD_ROOT # perform standard installation procedure %{l_shtool} subst -e "s;chown;true;" postfix-install @@ -270,11 +284,6 @@ main.cf master.cf main.cf.default; do rm -f $RPM_BUILD_ROOT%{l_prefix}/etc/postfix/$cfg done - mv $RPM_BUILD_ROOT%{l_prefix}/etc/postfix/postfix-script \ - $RPM_BUILD_ROOT%{l_prefix}/sbin/postfix-script - rm -f $RPM_BUILD_ROOT%{l_prefix}/etc/postfix/postfix-script* - mv $RPM_BUILD_ROOT%{l_prefix}/etc/postfix/post-install \ - $RPM_BUILD_ROOT%{l_prefix}/sbin/postfix-install # install default configuration for name in `grep "^/dev/null 2>&1 || true # remove generated configuration files ( cd $RPM_INSTALL_PREFIX/etc/postfix && %{l_make} clean >/dev/null 2>&1; true ) || true - # remove generated run-time files and directories - rm -rf $RPM_INSTALL_PREFIX/etc/postfix/data/* + # remove generated runtime files and directories + rm -rf $RPM_INSTALL_PREFIX/var/postfix/data/* rm -rf $RPM_INSTALL_PREFIX/var/postfix/pid/* rm -rf $RPM_INSTALL_PREFIX/var/postfix/private/* rm -rf $RPM_INSTALL_PREFIX/var/postfix/public/* diff -r fd1de0c7bc20 -r 01294b31a79e postfix/postfix.txt --- a/postfix/postfix.txt Wed Aug 08 20:36:32 2012 +0200 +++ b/postfix/postfix.txt Thu Aug 09 00:41:14 2012 +0200 @@ -103,7 +103,11 @@ # (yes) (yes) (yes) (never) (100) # ========================================================================== smtp inet n - n - - smtpd -#smtp inet n - n - - smtpd -o content_filter=spamass +#smtp inet n - n - - smtpd -o content_filter=spamass +#smtp inet n - n - 1 postscreen +#smtpd pass - - n - - smtpd +#dnsblog unix - - n - 0 dnsblog +#tlsproxy unix - - n - 0 tlsproxy #628 inet n - n - - qmqpd pickup fifo n - n 60 1 pickup cleanup unix n - n - 0 cleanup @@ -129,8 +133,8 @@ scache unix - - n - 1 scache #maildrop unix - n n - - pipe flags=DRhu user=@l_nusr@ argv=@l_prefix@/bin/maildrop -d ${recipient} #cyrus unix - n n - - pipe user=@l_nusr@ argv=@l_prefix@/bin/cyrdeliver -e -r ${sender} -m ${extension} ${user} -#dovecot unix - n n - - pipe flags=DR user=@l_rusr@ argv=@l_prefix@/libexec/dovecot/deliver -f ${sender} -d ${user} -n -m ${extension} -#spamass unix - n n - - pipe flags=R user=@l_rusr@ argv=@l_prefix@/bin/spamc -f -u ${user} -e @l_prefix@/sbin/sendmail -oi -f ${sender} ${recipient} +#dovecot unix - n n - - pipe flags=DR user=@l_rusr@ argv=@l_prefix@/libexec/dovecot/deliver -f ${sender} -d ${user} -n -m ${extension} +#spamass unix - n n - - pipe flags=R user=@l_rusr@ argv=@l_prefix@/bin/spamc -f -u ${user} -e @l_prefix@/sbin/sendmail -oi -f ${sender} ${recipient} #uucp unix - n n - - pipe flags=Fqhu user=@l_nusr@ argv=@l_prefix@/bin/uux -r -n -z -a$sender - $nexthop!rmail ($recipient) #ifmail unix - n n - - pipe flags=F user=@l_nusr@ argv=@l_prefix@/bin/ifmail -r $nexthop ($recipient) #bsmtp unix - n n - - pipe flags=Fq. user=@l_nusr@ argv=@l_prefix@/bin/bsmtp -f $sender $nexthop $recipient