diff options
author | Christian Ruppert <idl0r@gentoo.org> | 2011-11-27 19:44:24 +0000 |
---|---|---|
committer | Christian Ruppert <idl0r@gentoo.org> | 2011-11-27 19:44:24 +0000 |
commit | 0f147ae4fdd36b4c5a45babb5f4193293ecc0828 (patch) | |
tree | 1bab5d62ca78b566d5c335b1f55b3cebd8c8980b /mail-filter | |
parent | Use ssl USE-flag instead of gnutls (diff) | |
download | gentoo-2-0f147ae4fdd36b4c5a45babb5f4193293ecc0828.tar.gz gentoo-2-0f147ae4fdd36b4c5a45babb5f4193293ecc0828.tar.bz2 gentoo-2-0f147ae4fdd36b4c5a45babb5f4193293ecc0828.zip |
Rev bump. Add some patches for MySQL, see ebuild for further details.
(Portage version: 2.1.10.11/cvs/Linux i686)
Diffstat (limited to 'mail-filter')
-rw-r--r-- | mail-filter/spamassassin/ChangeLog | 10 | ||||
-rw-r--r-- | mail-filter/spamassassin/files/spamassassin-3.3.2-binary_token.patch | 13 | ||||
-rw-r--r-- | mail-filter/spamassassin/files/spamassassin-3.3.2-innodb.patch | 114 | ||||
-rw-r--r-- | mail-filter/spamassassin/files/spamassassin-3.3.2-mysql_count_rows.patch | 88 | ||||
-rw-r--r-- | mail-filter/spamassassin/spamassassin-3.3.2-r1.ebuild (renamed from mail-filter/spamassassin/spamassassin-3.3.2.ebuild) | 33 |
5 files changed, 251 insertions, 7 deletions
diff --git a/mail-filter/spamassassin/ChangeLog b/mail-filter/spamassassin/ChangeLog index b649054b9855..3936443664c4 100644 --- a/mail-filter/spamassassin/ChangeLog +++ b/mail-filter/spamassassin/ChangeLog @@ -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 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 index 000000000000..5ce5c0d90827 --- /dev/null +++ b/mail-filter/spamassassin/files/spamassassin-3.3.2-binary_token.patch @@ -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 index 000000000000..8bf13720c6e1 --- /dev/null +++ b/mail-filter/spamassassin/files/spamassassin-3.3.2-innodb.patch @@ -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 index 000000000000..54ee5573dadc --- /dev/null +++ b/mail-filter/spamassassin/files/spamassassin-3.3.2-mysql_count_rows.patch @@ -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; + } + } + diff --git a/mail-filter/spamassassin/spamassassin-3.3.2.ebuild b/mail-filter/spamassassin/spamassassin-3.3.2-r1.ebuild index 193626d25f0c..20eefe2b1483 100644 --- a/mail-filter/spamassassin/spamassassin-3.3.2.ebuild +++ b/mail-filter/spamassassin/spamassassin-3.3.2-r1.ebuild @@ -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 \ |