Rev bump. Add some patches for MySQL, see ebuild for further details.
authorChristian Ruppert <idl0r@gentoo.org>
Sun, 27 Nov 2011 19:44:24 +0000 (19:44 +0000)
committerChristian Ruppert <idl0r@gentoo.org>
Sun, 27 Nov 2011 19:44:24 +0000 (19:44 +0000)
Package-Manager: portage-2.1.10.11/cvs/Linux i686

mail-filter/spamassassin/ChangeLog
mail-filter/spamassassin/Manifest
mail-filter/spamassassin/files/spamassassin-3.3.2-binary_token.patch [new file with mode: 0644]
mail-filter/spamassassin/files/spamassassin-3.3.2-innodb.patch [new file with mode: 0644]
mail-filter/spamassassin/files/spamassassin-3.3.2-mysql_count_rows.patch [new file with mode: 0644]
mail-filter/spamassassin/spamassassin-3.3.2-r1.ebuild [moved from mail-filter/spamassassin/spamassassin-3.3.2.ebuild with 89% similarity]

index b649054b9855087db19b4a3ae2799f9fd43d7c8b..3936443664c422fd4685a4a038a9ab361b3fcb38 100644 (file)
@@ -1,6 +1,14 @@
 # ChangeLog for mail-filter/spamassassin
 # Copyright 1999-2011 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/mail-filter/spamassassin/ChangeLog,v 1.202 2011/09/14 23:00:38 polynomial-c Exp $
+# $Header: /var/cvsroot/gentoo-x86/mail-filter/spamassassin/ChangeLog,v 1.203 2011/11/27 19:44:24 idl0r Exp $
+
+*spamassassin-3.3.2-r1 (27 Nov 2011)
+
+  27 Nov 2011; Christian Ruppert <idl0r@gentoo.org> -spamassassin-3.3.2.ebuild,
+  +spamassassin-3.3.2-r1.ebuild, +files/spamassassin-3.3.2-binary_token.patch,
+  +files/spamassassin-3.3.2-innodb.patch,
+  +files/spamassassin-3.3.2-mysql_count_rows.patch:
+  Rev bump. Add some patches for MySQL, see ebuild for further details.
 
   14 Sep 2011; Lars Wendler <polynomial-c@gentoo.org> files/3.3.1-spamd.init:
   non-maintainer commit: Moved reload option from extra_commands to
index 69fa9a4fcee8ceb423f1d25e12c9b3f15c2c8da8..1a73ba6afcd36f07f1ee2f30a7f076d052adf624 100644 (file)
@@ -1,31 +1,14 @@
------BEGIN PGP SIGNED MESSAGE-----
-Hash: SHA512
-
 AUX 3.0.0-spamd.conf 1527 RMD160 8075268aecdf6f41f5cdacb683fe92567d860dae SHA1 01623333cecb1ef38b25a130d3b5afe016e70f1c SHA256 ea61041e8b6b1616ec096cc42245ab8442b962f72c318695f5acff1fd794ee34
 AUX 3.3.1-spamd.init 1052 RMD160 c5166155fc6b7be234aa06802e7aff05d5539ca3 SHA1 2de84b9ca084029b1206585df9c6e22aaf6663a0 SHA256 05c61f546c6dd701e53689163e282125c2f3a916b0bada4bad5686fc8ddb1a3c
 AUX secrets.cf 664 RMD160 afb1212a464bd7053c1301c1a1e670b73216528a SHA1 a742beddf850e55bc4454a7548dc43c36f8e9760 SHA256 9f134c7b857b21689f612fc6d131f719e5a65e2ba341b282e7aa57402c854139
 AUX spamassassin-3.3.1-PERL-5-12.patch 8952 RMD160 f748f6568adeedd9db7b6302cd9f484cc9882599 SHA1 fd2b8f081d26c062a1e21f4ccf90b2b4079f89e1 SHA256 6054e7ac297e22c0f24ca524169140526e4d036dc0c11bedf4e64e30c6cbb593
 AUX spamassassin-3.3.1-uninitialized_value.patch 754 RMD160 0dea62c4b2a716557d4dd485336d60a885a0108e SHA1 6fb6781deb9f8e3344930e755baaeb3c387c7a52 SHA256 b393684a626240bf75e2c6fe7fe56bedc4b64c59220d7129ee0b1d99381493be
+AUX spamassassin-3.3.2-binary_token.patch 465 RMD160 1b354b899047ca5d13abb50deebee424b50fbe6c SHA1 f2c6fd3cafa53e8d8754791940416475e28ca7fa SHA256 170ffed8831f7e45d7e50fda774dccd2482f4652c733e419c664d04b3208f37f
+AUX spamassassin-3.3.2-innodb.patch 4749 RMD160 df293f19f3269875d07ddb3b6ed1cc9a609cb7e8 SHA1 f6310cbbf9bd0ef57445d4aa03b00dedd57ec462 SHA256 d40a72692f9b7161f2a332189e68cfd5486b69a4d2e9fdea9d23d6ae7bd7fd10
+AUX spamassassin-3.3.2-mysql_count_rows.patch 3319 RMD160 45eb621e2934dc19344310b39aee1f0ca198fc18 SHA1 ed5d37df3355f1992402a00f1185a7ae9a4f5095 SHA256 a97f6b9b67e721a95885b978c2def9a1065577855ab4377f80fb142fdf6cbba1
 DIST Mail-SpamAssassin-3.3.1.tar.bz2 1015008 RMD160 b681fc60292cd30efd405585aad70f39c9633260 SHA1 f5748043eb286b1acb456093039a55db00c6f25e SHA256 4c348cd951fc2c5688e9713fcbc6ba453df51d32a1ab332a63800d20ff18bdb4
 DIST Mail-SpamAssassin-3.3.2.tar.bz2 1006577 RMD160 ae164d1b1772590ca261492c5cde37485d64ed9c SHA1 f38480352935fe3bb849a27a52615e400dee7d66 SHA256 c7239b4b4ef04ba5e2d5aedb9156850146ed3fa47c88f0a0757f08e22f93a205
 EBUILD spamassassin-3.3.1-r4.ebuild 6816 RMD160 03d777cd71fa3a6c916e7bbc7676c445ae53dc1d SHA1 7caaa7821b86cd440f71dfd6e32186ad1e0a7b10 SHA256 7b0712918bc314c45a3a04fe4ff25af8b08a183d8e963729d5dbc9de056180bf
-EBUILD spamassassin-3.3.2.ebuild 6383 RMD160 fd689e199bee017f6172e0d9ece05e4ea37bdbc7 SHA1 683534bcc7e5d5e9c03f1940f6684dc8a8743e03 SHA256 1fd8a6cf140e002d51e5e66f5b15c76706c973aeb2e0b20091293aadad89ae91
-MISC ChangeLog 40767 RMD160 f4f6af4b277be064eb450fee882239615d72b70e SHA1 ca88d78680965456c34f8a487bb7f533f8773015 SHA256 2bd0a6e42153a4ae488668723c621c511bf074fd516214fbe4bca34a1fe04bea
+EBUILD spamassassin-3.3.2-r1.ebuild 6892 RMD160 7752cf80e47a5b0b9221784e6ff7ddb9fbb5a43e SHA1 0fb99826ee818606e559300cd8d620f13d52285a SHA256 f73f9d5d65030392e2970009188f7cf046742fe0bddb9c46c3975c0944fe1974
+MISC ChangeLog 41124 RMD160 8672c5c7d759aa6afd6b4b444f34b918b65e6e5f SHA1 f05bbf94632c2a65e2a0637af84b94654d76b34e SHA256 42712b667fbfc66e95976256f0aa2f9ee52f722d4ea042a18ff6486f888f78ba
 MISC metadata.xml 339 RMD160 d26879faaf735d1ca3001a1c61ab472b14789420 SHA1 8b21003a4404ada77b2a9bf2a3fa1733e46fe352 SHA256 140cb2839ea50486116c578fe574b9090de04c483c2c7bce792dfa7e21138aa5
------BEGIN PGP SIGNATURE-----
-Version: GnuPG v2.0.18 (GNU/Linux)
-
-iQIcBAEBCgAGBQJOcTIbAAoJEPiazRVxLXTFtYcP/jTZNzQlx2rCfRDOUddTcZ6+
-+wshUO2QECj0Yev3/ZldTGOJucX/h44M+Rbr202pjGBNXfAzYBXox3KSLYP9RptM
-djhApyhB/R02m+d2QXQX+20Ak0WsYepPhEO8RSxpbJiaJ0/liknaBWFj4DUzoG7j
-0m/eorBImAP23LWyebZGS+I80F2d/h5yAkGeS9HLVa3gdJvy/H/QvK0+gRchF+EJ
-vzdVUAVprMk74uYRn0G8NPMDM2nk+ewtOV9tUKdCm8HOQmrcM13X/XK4AVyIhf4o
-PxXxvl/6mEB1e3qLrwziSuGrYnOktROwhTssuceneVSODuQI1pcw1NGpEezhEtfx
-6Bm+dzb7bSMFHgghB0NSprUrb7P396Sr0ygyZf5NLRKwAC4YPQmpL8dfNNku4ID0
-F8Ihqe/gvCdBCG7UurTKHpHU7gtjJj0y4xLWIVWK0SoFiR+VqMIzcIN+miDgyWy0
-SdYUbmaA8xz6r2Tgj2irE7nKy90dLEI+TjGVENNqFZ1Gze/NuDPzszmiCqX4yLia
-uH+XUGH9YorvV4RmDYQuNQ6tITthv0UTnWuAIcXRi5t3l1XTdhMy6rlXvXhg/9FW
-bhJjSVkzc2d8ofz89q9DY8X01/o/sVjqLAb3UmobIaZ/WccQVaueD3U9GVN5nv39
-Niml+P3YikDjPT16rF6x
-=5Qmf
------END PGP SIGNATURE-----
diff --git a/mail-filter/spamassassin/files/spamassassin-3.3.2-binary_token.patch b/mail-filter/spamassassin/files/spamassassin-3.3.2-binary_token.patch
new file mode 100644 (file)
index 0000000..5ce5c0d
--- /dev/null
@@ -0,0 +1,13 @@
+Index: sql/bayes_mysql.sql
+===================================================================
+--- sql/bayes_mysql.sql        (revision 1139005)
++++ sql/bayes_mysql.sql        (working copy)
+@@ -22,7 +22,7 @@
+ 
+ CREATE TABLE bayes_token (
+   id int(11) NOT NULL default '0',
+-  token char(5) NOT NULL default '',
++  token binary(5) NOT NULL default '',
+   spam_count int(11) NOT NULL default '0',
+   ham_count int(11) NOT NULL default '0',
+   atime int(11) NOT NULL default '0',
diff --git a/mail-filter/spamassassin/files/spamassassin-3.3.2-innodb.patch b/mail-filter/spamassassin/files/spamassassin-3.3.2-innodb.patch
new file mode 100644 (file)
index 0000000..8bf1372
--- /dev/null
@@ -0,0 +1,114 @@
+Index: sql/README.bayes
+===================================================================
+--- sql/README.bayes   (revision 1139008)
++++ sql/README.bayes   (working copy)
+@@ -17,27 +17,37 @@
+ bayes_store_module               Mail::SpamAssassin::BayesStore::SQL
+ 
+ This directive is used by the Bayes module to determine which storage
+-module should be used.  If not set it will default to:
++module should be used. If not set it will default to:
+ Mail::SpamAssassin::BayesStore::DBM
+ 
++The storage module Mail::SpamAssassin::BayesStore::SQL is an older generic
++SQL module which can be also be used with versions of MySQL which did not
++have support for an InnoDB engine and transactions. If choosing this module
++consider replacing the InnoDB engine with MyISAM (explicitly or defaulted)
++in the schema (files bayes_mysql.sql and awl_mysql.sql). Note that old
++versions of MySQL expect syntax TYPE=MyISAM instead of ENGINE=MyISAM,
++while newer versions throw a syntax error on TYPE and only allow ENGINE.
++In short: replace ENGINE=InnoDB with TYPE=MyISAM (or just leave it out)
++in the bayes_mysql.sql and awl_mysql.sql schemas if ENGINE=InnoDB is not
++accepted.
++
++There is also a MySQL specific storage driver available to provides a
++small boost in performance.  It requires version 4.1 or above of the
++MySQL database software to work properly.  In addition, it provides
++rollback on error functionality if you create your bayes database table
++using the InnoDB storage engine. WARNING: Using this module with a version
++of MySQL < 4.1 could have unexpected results.  To use the MySQL 4.1+
++specific module set your bayes_store_module directive accordingly:
++  bayes_store_module               Mail::SpamAssassin::BayesStore::MySQL
++
+ PostgreSQL users will want to use the PostgreSQL specific storage
+ module:
+-bayes_store_module               Mail::SpamAssassin::BayesStore::PgSQL
++  bayes_store_module               Mail::SpamAssassin::BayesStore::PgSQL
+ This module provides a slightly different interface to makes better
+ use of the resources that PostgreSQL offers.  In addition, please make
+ sure that you follow the instructions below for loading the proper
+ procedural language and installing the tables and stored procedure.
+ 
+-There is also a MySQL specific storage driver available to provides a
+-small boost in performance.  It requires version 4.1 or above of the
+-MySQL database software to work properly.  In addition, it provides
+-rollback on error functionality if you create your bayes database
+-table using the InnoDB storage engine (ie s/MyISAM/InnoDB/ on the
+-bayes_mysql.sql file).  WARNING: Using this module with a version of
+-MySQL < 4.1 could have unexpected results.  To use the MySQL 4.1+
+-specific module set your bayes_store_module directive accordingly:
+-bayes_store_module               Mail::SpamAssassin::BayesStore::MySQL
+-
+ Additional configuration directives provided by BayesSQL:
+ 
+ bayes_sql_dsn                    DBI:driver:database:hostname[:port]
+Index: sql/awl_mysql.sql
+===================================================================
+--- sql/awl_mysql.sql  (revision 1139008)
++++ sql/awl_mysql.sql  (working copy)
+@@ -1,9 +1,9 @@
+ CREATE TABLE awl (
+   username varchar(100) NOT NULL default '',
+-  email varchar(255) NOT NULL default '',
++  email varbinary(255) NOT NULL default '',
+   ip varchar(40) NOT NULL default '',
+   count int(11) NOT NULL default '0',
+   totscore float NOT NULL default '0',
+   signedby varchar(255) NOT NULL default '',
+   PRIMARY KEY (username,email,signedby,ip)
+-) TYPE=MyISAM;
++) ENGINE=InnoDB;
+Index: sql/bayes_mysql.sql
+===================================================================
+--- sql/bayes_mysql.sql        (revision 1139008)
++++ sql/bayes_mysql.sql        (working copy)
+@@ -3,13 +3,13 @@
+   id int(11) NOT NULL default '0',
+   runtime int(11) NOT NULL default '0',
+   KEY bayes_expire_idx1 (id)
+-) TYPE=MyISAM;
++) ENGINE=InnoDB;
+ 
+ CREATE TABLE bayes_global_vars (
+   variable varchar(30) NOT NULL default '',
+   value varchar(200) NOT NULL default '',
+   PRIMARY KEY  (variable)
+-) TYPE=MyISAM;
++) ENGINE=InnoDB;
+ 
+ INSERT INTO bayes_global_vars VALUES ('VERSION','3');
+ 
+@@ -18,7 +18,7 @@
+   msgid varchar(200) binary NOT NULL default '',
+   flag char(1) NOT NULL default '',
+   PRIMARY KEY  (id,msgid)
+-) TYPE=MyISAM;
++) ENGINE=InnoDB;
+ 
+ CREATE TABLE bayes_token (
+   id int(11) NOT NULL default '0',
+@@ -28,7 +28,7 @@
+   atime int(11) NOT NULL default '0',
+   PRIMARY KEY  (id, token),
+   INDEX bayes_token_idx1 (id, atime)
+-) TYPE=MyISAM;
++) ENGINE=InnoDB;
+ 
+ CREATE TABLE bayes_vars (
+   id int(11) NOT NULL AUTO_INCREMENT,
+@@ -43,4 +43,4 @@
+   newest_token_age int(11) NOT NULL default '0',
+   PRIMARY KEY  (id),
+   UNIQUE bayes_vars_idx1 (username)
+-) TYPE=MyISAM;
++) ENGINE=InnoDB;
diff --git a/mail-filter/spamassassin/files/spamassassin-3.3.2-mysql_count_rows.patch b/mail-filter/spamassassin/files/spamassassin-3.3.2-mysql_count_rows.patch
new file mode 100644 (file)
index 0000000..54ee557
--- /dev/null
@@ -0,0 +1,88 @@
+--- lib/Mail/SpamAssassin/BayesStore/MySQL.pm  (revision 1138970)
++++ lib/Mail/SpamAssassin/BayesStore/MySQL.pm  (working copy)
+@@ -840,14 +840,28 @@
+       return 0;
+     }
+ 
++    # With ON DUPLICATE KEY UPDATE, the affected-rows value per row is 1 if
++    # the row is inserted as a new row and 2 if an existing row is updated.
++    #
++    # Due to a MySQL server bug a value of 3 can be seen.
++    # See: http://bugs.mysql.com/bug.php?id=46675
++    #   When executing the INSERT ... ON DUPLICATE KEY UPDATE statement
++    #   and checking the rows return count:
++    #   mysql_client_found_rows = 0: The second INSERT returns a row count
++    #                                of 2 in all MySQL versions.
++    #   mysql_client_found_rows = 1: The second INSERT returns this row count:
++    #     Before MySQL 5.1.20: 2
++    #     MySQL 5.1.20: undef on Mac OS X, 139775481 on Linux (garbage?)
++    #     MySQL 5.1.21 and up: 3
++    #
+     my $num_rows = $rc;
+ 
+     $sth->finish();
+ 
+-    if ($num_rows == 1 || $num_rows == 2) {
++    if ($num_rows == 1 || $num_rows == 2 || $num_rows == 3) {
+       my $token_count_update = '';
+       
+-      $token_count_update = "token_count = token_count + 1," if ($num_rows == 1);
++      $token_count_update = "token_count = token_count + 1," if $num_rows == 1;
+       $sql = "UPDATE bayes_vars SET
+                      $token_count_update
+                      newest_token_age = GREATEST(newest_token_age, ?),
+@@ -872,7 +886,11 @@
+     }
+     else {
+       # $num_rows was not what we expected
+-      dbg("bayes: _put_token: Updated an unexpected number of rows.");
++      my $token_displ = $token;
++      $token_displ =~ s/(.)/sprintf('%02x',ord($1))/egs;
++      dbg("bayes: _put_token: Updated an unexpected number of rows: %s, ".
++          "id: %s, token (hex): %s",
++          $num_rows, $self->{_userid}, $token_displ);
+       $self->{_dbh}->rollback();
+       return 0;
+     }
+@@ -987,8 +1005,24 @@
+       else {
+       my $num_rows = $rc;
+ 
+-      $need_atime_update_p = 1 if ($num_rows == 1 || $num_rows == 2);
+-      $new_tokens++ if ($num_rows == 1);
++        # With ON DUPLICATE KEY UPDATE, the affected-rows value per row is 1 if
++        # the row is inserted as a new row and 2 if an existing row is updated.
++        # But see MySQL bug (as above): http://bugs.mysql.com/bug.php?id=46675
++
++        if ($num_rows == 1) {
++          $new_tokens++;
++          $need_atime_update_p = 1;
++        } elsif ($num_rows == 2 || $num_rows == 3) {
++          $need_atime_update_p = 1;
++        } else {
++          # $num_rows was not what we expected
++          my $token_displ = $token;
++          $token_displ =~ s/(.)/sprintf('%02x',ord($1))/egs;
++          dbg("bayes: _put_tokens: Updated an unexpected number of rows: %s, ".
++              "id: %s, token (hex): %s",
++              $num_rows, $self->{_userid}, $token_displ);
++          $error_p = 1;
++        }
+       }
+     }
+ 
+@@ -1026,10 +1060,10 @@
+       }
+     }
+     else {
+-      # $num_rows was not what we expected
+-      dbg("bayes: _put_tokens: Updated an unexpected number of rows.");
+-      $self->{_dbh}->rollback();
+-      return 0;
++      info("bayes: _put_tokens: no atime updates needed?  Num of tokens: %d",
++           scalar keys %{$tokens});
++#     $self->{_dbh}->rollback();
++#     return 0;
+     }
+   }
+ 
similarity index 89%
rename from mail-filter/spamassassin/spamassassin-3.3.2.ebuild
rename to mail-filter/spamassassin/spamassassin-3.3.2-r1.ebuild
index 193626d25f0cad4aa7b017e5ccccba2da3a95af2..20eefe2b14834614693a148b04a44ed40537d6b1 100644 (file)
@@ -1,6 +1,6 @@
 # Copyright 1999-2011 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/mail-filter/spamassassin/spamassassin-3.3.2.ebuild,v 1.1 2011/06/25 13:30:11 tove Exp $
+# $Header: /var/cvsroot/gentoo-x86/mail-filter/spamassassin/spamassassin-3.3.2-r1.ebuild,v 1.1 2011/11/27 19:44:24 idl0r Exp $
 
 EAPI=4
 
@@ -8,7 +8,7 @@ inherit perl-module toolchain-funcs eutils
 
 MY_P=Mail-SpamAssassin-${PV//_/-}
 S=${WORKDIR}/${MY_P}
-DESCRIPTION="SpamAssassin is an extensible email filter which is used to identify spam."
+DESCRIPTION="SpamAssassin is an extensible email filter which is used to identify spam"
 HOMEPAGE="http://spamassassin.apache.org/"
 SRC_URI="mirror://apache/spamassassin/source/${MY_P}.tar.bz2"
 
@@ -61,6 +61,19 @@ RDEPEND="${DEPEND}"
 
 SRC_TEST="do"
 
+src_prepare() {
+       # http://old.nabble.com/Migrating-bayes-to-mysql-fails-with-parsing-errors-td31889789i20.html
+
+       # https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6624
+       epatch "${FILESDIR}/${P}-mysql_count_rows.patch"
+
+       #https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6625
+       epatch "${FILESDIR}/${P}-binary_token.patch"
+
+       # https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6626
+       epatch "${FILESDIR}/${P}-innodb.patch"
+}
+
 src_configure() {
        # - Set SYSCONFDIR explicitly so we can't get bitten by bug 48205 again
        #       (just to be sure, nobody knows how it could happen in the first place).
@@ -129,13 +142,21 @@ src_install () {
        newinitd "${FILESDIR}"/3.3.1-spamd.init spamd
        newconfd "${FILESDIR}"/3.0.0-spamd.conf spamd
 
-       use postgres && \
-               sed -i -e 's:@USEPOSTGRES@::' "${D}/etc/init.d/spamd" || \
+       if use postgres; then
+               sed -i -e 's:@USEPOSTGRES@::' "${D}/etc/init.d/spamd"
+
+               dodoc sql/*_pg.sql
+       else
                sed -i -e '/@USEPOSTGRES@/d' "${D}/etc/init.d/spamd"
+       fi
+
+       if use mysql; then
+               sed -i -e 's:@USEMYSQL@::' "${D}/etc/init.d/spamd"
 
-       use mysql && \
-               sed -i -e 's:@USEMYSQL@::' "${D}/etc/init.d/spamd" || \
+               dodoc sql/*_mysql.sql
+       else
                sed -i -e '/@USEMYSQL@/d' "${D}/etc/init.d/spamd"
+       fi
 
        dodoc NOTICE TRADEMARK CREDITS INSTALL.VMS UPGRADE USAGE \
                sql/README.bayes sql/README.awl procmailrc.example sample-nonspam.txt \