commit:     0fde279c363ed228d5a1eae8716a5c236c48e084
Author:     Michael Orlitzky <mjo <AT> gentoo <DOT> org>
AuthorDate: Thu Aug 24 13:21:28 2017 +0000
Commit:     Michael Orlitzky <mjo <AT> gentoo <DOT> org>
CommitDate: Thu Aug 24 13:21:41 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0fde279c

net-mail/postfix-logwatch: new revision with some bugfix patches.

Upstream development has stalled for this package, so we now include a
few patches needed to support modern versions of perl.

Package-Manager: Portage-2.3.6, Repoman-2.3.1

 .../files/redundant-argument-to-sprintf.patch      | 48 ++++++++++++++++++++++
 .../files/unescaped-left-brace.patch               | 37 +++++++++++++++++
 .../postfix-logwatch-1.40.03-r1.ebuild             | 42 +++++++++++++++++++
 3 files changed, 127 insertions(+)

diff --git 
a/net-mail/postfix-logwatch/files/redundant-argument-to-sprintf.patch 
b/net-mail/postfix-logwatch/files/redundant-argument-to-sprintf.patch
new file mode 100644
index 00000000000..ee0e79bd41d
--- /dev/null
+++ b/net-mail/postfix-logwatch/files/redundant-argument-to-sprintf.patch
@@ -0,0 +1,48 @@
+From 6afb8e258a5a2a0e7c72c4c25927dde9d1e2ad89 Mon Sep 17 00:00:00 2001
+From: Michael Orlitzky <mich...@orlitzky.com>
+Date: Thu, 24 Aug 2017 07:34:36 -0400
+Subject: [PATCH 2/2] Fix redundant argument to sprintf warning.
+
+Perl 5.22 now warns about redundant (i.e. extra) arguments to the
+sprintf function. If your format string only has two place-holders but
+you pass three place-fillers, you get warned:
+
+  Redundant argument in sprintf at ./postfix-logwatch line 1382...
+
+The issue there was that the format string passed to sprintf was
+constructed dynamically; sometimes it would contain two place-holders,
+and sometimes three. Three place-fillers were always passed, so when
+only two place-holders were used, the warning would be thrown. This was
+fixed by testing whether or not there are two or three place-holders,
+and passing the appropriate number of place-fillers.
+---
+ postfix-logwatch | 13 +++++++++++--
+ 1 file changed, 11 insertions(+), 2 deletions(-)
+
+diff --git a/postfix-logwatch b/postfix-logwatch
+index 1e58a95..92ed621 100644
+--- a/postfix-logwatch
++++ b/postfix-logwatch
+@@ -1378,8 +1378,17 @@ sub print_summary_report (\@) {
+                      $$divisor == $Totals{$keyname} ? 100.00 : 
$Totals{$keyname} * 100 / $$divisor;
+             }
+             else {
+-               push @{$lines[$cur_level]}, 
+-                  sprintf "$fmt  %-23s $extra\n", $total, $desc, commify 
($Totals{$keyname});
++              my $new_line;
++              if ($extra eq '') {
++                  $new_line = sprintf("$fmt  %-23s \n", $total, $desc);
++              }
++              else {
++                  $new_line = sprintf("$fmt  %-23s $extra\n",
++                                      $total,
++                                      $desc,
++                                      commify ($Totals{$keyname}));
++              }
++              push @{$lines[$cur_level]}, $new_line
+             }
+          }
+       }
+-- 
+2.13.0
+

diff --git a/net-mail/postfix-logwatch/files/unescaped-left-brace.patch 
b/net-mail/postfix-logwatch/files/unescaped-left-brace.patch
new file mode 100644
index 00000000000..65139a3aff1
--- /dev/null
+++ b/net-mail/postfix-logwatch/files/unescaped-left-brace.patch
@@ -0,0 +1,37 @@
+From 84f9fb47783e63757f27e5990ee606ff01e079a9 Mon Sep 17 00:00:00 2001
+From: Michael Orlitzky <mich...@orlitzky.com>
+Date: Thu, 24 Aug 2017 07:09:28 -0400
+Subject: [PATCH 1/2] Fix unescaped left brace warning for "Config: {".
+
+New versions of Perl are starting to complain about unescaped braces
+in regular expressions, and supposedly the warning will become a fatal
+error in Perl 5.30. This particular warning is,
+
+  Unescaped left brace in regex is deprecated, passed through in regex;
+  marked by <-- HERE in m/^Config: { <-- HERE / at ./postfix-logwatch
+  line 1850.
+
+and it was fixed by going to line 1850 and putting a backslash before
+the left brace.
+
+Bug: https://sourceforge.net/p/logreporters/bugs/4/
+---
+ postfix-logwatch | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/postfix-logwatch b/postfix-logwatch
+index 3e4a673..1e58a95 100644
+--- a/postfix-logwatch
++++ b/postfix-logwatch
+@@ -1847,7 +1847,7 @@ sub postfix_policy_spf($) {
+         # KeyboardInterrupt 
+         $line =~ /^Read line: "/ or
+         $line =~ /^Found the end of entry$/ or
+-        $line =~ /^Config: {/ or
++        $line =~ /^Config: \{/ or
+         $line =~ /^spfcheck: pyspf result/ or
+         $line =~ /^Starting$/ or
+         $line =~ /^Normal exit$/ or
+-- 
+2.13.0
+

diff --git a/net-mail/postfix-logwatch/postfix-logwatch-1.40.03-r1.ebuild 
b/net-mail/postfix-logwatch/postfix-logwatch-1.40.03-r1.ebuild
new file mode 100644
index 00000000000..17046988053
--- /dev/null
+++ b/net-mail/postfix-logwatch/postfix-logwatch-1.40.03-r1.ebuild
@@ -0,0 +1,42 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+DESCRIPTION="A log analyzer for postfix"
+HOMEPAGE="http://logreporters.sourceforge.net/";
+SRC_URI="mirror://sourceforge/logreporters/${P}.tgz"
+
+LICENSE="MIT"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+
+RDEPEND="dev-lang/perl"
+
+PATCHES=(
+       "${FILESDIR}/unescaped-left-brace.patch"
+       "${FILESDIR}/redundant-argument-to-sprintf.patch"
+)
+
+src_prepare() {
+       default
+       # Replace the default config file location with ours.
+       local cfg_default='/usr/local/etc/${progname_prefix}-logwatch.conf'
+       local cfg_gentoo='/etc/${progname_prefix}-logwatch.conf';
+       sed -i "s~${cfg_default}~${cfg_gentoo}~" ${PN} \
+               || die 'failed to update the default config location'
+}
+
+src_compile() {
+       # The default make target just outputs instructions. We don't want
+       # the user to see these, so we avoid the default emake.
+       :
+}
+
+src_install() {
+       dodoc Bugs Changes README ${PN}.conf-topn
+       doman ${PN}.1
+       dobin ${PN}
+       insinto /etc
+       doins ${PN}.conf
+}

Reply via email to