[packages/dovecot-antispam] - fixed building with dovecot 2.2.14+ - rel 21
baggins
baggins at pld-linux.org
Sun Nov 9 22:33:01 CET 2014
commit 8563cd9482c02ed164208cc7ce466ca5740749e8
Author: Jan Rękorajski <baggins at pld-linux.org>
Date: Sun Nov 9 22:32:39 2014 +0100
- fixed building with dovecot 2.2.14+
- rel 21
dovecot-2.2.14.patch | 225 ++++++++++++++++++++++++++++++++++++++++++++++++++
dovecot-antispam.spec | 4 +-
2 files changed, 228 insertions(+), 1 deletion(-)
---
diff --git a/dovecot-antispam.spec b/dovecot-antispam.spec
index 2df1e3e..de39a04 100644
--- a/dovecot-antispam.spec
+++ b/dovecot-antispam.spec
@@ -2,13 +2,14 @@ Summary: The dovecot antispam plugin
Summary(pl.UTF-8): Wtyczka antyspamowa dla dovecota
Name: dovecot-antispam
Version: 2.0
-Release: 20
+Release: 21
License: GPL v2
Group: Daemons
Source0: http://johannes.sipsolutions.net/download/dovecot-antispam/%{name}-%{version}.tar.bz2
# Source0-md5: 14547898759fbd93f2b98304520decc6
Patch0: %{name}-git.patch
Patch1: dovecot-2.2.patch
+Patch2: dovecot-2.2.14.patch
URL: http://johannes.sipsolutions.net/Projects/dovecot-antispam
BuildRequires: dovecot-devel >= 1:2.0
%requires_eq_to dovecot dovecot-devel
@@ -24,6 +25,7 @@ way it was moved).
%setup -q
%patch0 -p1
%patch1 -p1
+%patch2 -p1
%build
unset GIT_DIR
diff --git a/dovecot-2.2.14.patch b/dovecot-2.2.14.patch
new file mode 100644
index 0000000..7e48f07
--- /dev/null
+++ b/dovecot-2.2.14.patch
@@ -0,0 +1,225 @@
+From d17c6a9c34aa407d2ced8488389520903f16971f Mon Sep 17 00:00:00 2001
+From: Ron <ron at debian.org>
+Date: Sat, 25 Oct 2014 00:36:12 +1030
+Subject: Include the patch level in the dovecot version checks
+
+Dovecot broke the t_push() API for 2.2.14 so just checking the major/minor
+versions is no longer enough. Bonus points for it not actually exporting
+that version anywhere itself, so we still need to parse the full string to
+get it.
+
+There's a chance this might break some things for dovecot < 2.0 or so
+(based mostly on the theory that the patch=255 fallback coded into the
+dovecot-version.c parsing was put there for a reason), but we might be
+well past the stage of needing to worry about that now. If someone
+tests it with an earlier version and it breaks there, we'll worry about
+that when they report how and where it breaks.
+
+diff --git a/antispam-plugin.c b/antispam-plugin.c
+index 103b5fb..6ea49cf 100644
+--- a/antispam-plugin.c
++++ b/antispam-plugin.c
+@@ -70,7 +70,7 @@ static void lowercase_string(const char *in, char *out)
+ }
+
+ static bool mailbox_patternmatch(struct mailbox *box,
+-#if DOVECOT_IS_GE(2,0)
++#if DOVECOT_IS_GE(2,0,0)
+ const struct mail_namespace *ns,
+ #else
+ struct mail_storage *storage,
+@@ -82,7 +82,7 @@ static bool mailbox_patternmatch(struct mailbox *box,
+ int len;
+ int rc;
+
+-#if DOVECOT_IS_GE(2,0)
++#if DOVECOT_IS_GE(2,0,0)
+ if (ns && mailbox_get_namespace(box) != ns)
+ return FALSE;
+ #else
+@@ -116,7 +116,7 @@ static bool mailbox_patternmatch(struct mailbox *box,
+ }
+
+ static bool mailbox_patternmatch_case(struct mailbox *box,
+-#if DOVECOT_IS_GE(2,0)
++#if DOVECOT_IS_GE(2,0,0)
+ const struct mail_namespace *ns,
+ #else
+ struct mail_storage *ns,
+@@ -127,7 +127,7 @@ static bool mailbox_patternmatch_case(struct mailbox *box,
+ }
+
+ static bool mailbox_patternmatch_icase(struct mailbox *box,
+-#if DOVECOT_IS_GE(2,0)
++#if DOVECOT_IS_GE(2,0,0)
+ const struct mail_namespace *ns,
+ #else
+ struct mail_storage *ns,
+@@ -138,7 +138,7 @@ static bool mailbox_patternmatch_icase(struct mailbox *box,
+ }
+
+ static bool _mailbox_equals(struct mailbox *box,
+-#if DOVECOT_IS_GE(2,0)
++#if DOVECOT_IS_GE(2,0,0)
+ const struct mail_namespace *ns,
+ #else
+ struct mail_storage *ns,
+@@ -149,7 +149,7 @@ static bool _mailbox_equals(struct mailbox *box,
+ }
+
+ typedef bool (*match_fn_t)(struct mailbox *,
+-#if DOVECOT_IS_GE(2,0)
++#if DOVECOT_IS_GE(2,0,0)
+ const struct mail_namespace *,
+ #else
+ struct mail_storage *,
+@@ -187,7 +187,7 @@ static bool mailbox_in_list(struct mailbox *box, char ** const * patterns)
+
+ while (*list) {
+ if (match_info[i].fn(box,
+-#if DOVECOT_IS_GE(2,0)
++#if DOVECOT_IS_GE(2,0,0)
+ mailbox_get_namespace(box),
+ #else
+ mailbox_get_storage(box),
+@@ -374,7 +374,7 @@ void antispam_free_config(struct antispam_config *cfg)
+ i_free(cfg);
+ }
+
+-#if DOVECOT_IS_GE(2,0)
++#if DOVECOT_IS_GE(2,0,0)
+ void PLUGIN_FUNCTION(init)(struct module *module)
+ {
+ antispam_storage_init(module);
+@@ -392,7 +392,7 @@ void PLUGIN_FUNCTION(deinit)(void)
+ }
+
+ /* put dovecot version we built against into plugin for checking */
+-#ifdef DOVECOT_ABI_VERSION
++#if DOVECOT_IS_GE(2,2,0)
+ const char *PLUGIN_FUNCTION(version) = DOVECOT_ABI_VERSION;
+ #else
+ const char *PLUGIN_FUNCTION(version) = PACKAGE_VERSION;
+diff --git a/antispam-plugin.h b/antispam-plugin.h
+index a06f7be..724ab5e 100644
+--- a/antispam-plugin.h
++++ b/antispam-plugin.h
+@@ -4,7 +4,7 @@
+ #include "lib.h"
+ #include "str.h"
+ #include "dovecot-version.h"
+-#if DOVECOT_IS_GE(2, 0)
++#if DOVECOT_IS_GE(2,0,0)
+ #include "imap-client.h"
+ #else
+ #include "client.h"
+@@ -186,7 +186,7 @@ void antispam_free_config(struct antispam_config *cfg);
+ /*
+ * Dovecot version compat code
+ */
+-#if DOVECOT_IS_EQ(1, 0)
++#if DOVECOT_IS_GE(1,0,0) && DOVECOT_IS_LT(1,1,0)
+ #define module_arg void
+ #define ATTR_UNUSED __attr_unused__
+ #define mempool_unref(x) pool_unref(*(x))
+@@ -217,7 +217,7 @@ static inline int _mail_get_stream(struct mail *mail,
+ return 0;
+ }
+ #define mail_get_stream _mail_get_stream
+-#elif DOVECOT_IS_EQ(1, 1)
++#elif DOVECOT_IS_GE(1,1,0) && DOVECOT_IS_LT(1,2,0)
+ #define mempool_unref pool_unref
+ #define module_arg void
+ #define ME(err) MAIL_ERROR_ ##err,
+@@ -236,7 +236,7 @@ o_stream_create_from_fd(int fd, pool_t pool ATTR_UNUSED)
+ {
+ return o_stream_create_fd(fd, 0, TRUE);
+ }
+-#elif DOVECOT_IS_EQ(1, 2)
++#elif DOVECOT_IS_GE(1,2,0) && DOVECOT_IS_LT(2,0,0)
+ #define mempool_unref pool_unref
+ #define module_arg void
+ #define ME(err) MAIL_ERROR_ ##err,
+@@ -255,7 +255,7 @@ o_stream_create_from_fd(int fd, pool_t pool ATTR_UNUSED)
+ {
+ return o_stream_create_fd(fd, 0, TRUE);
+ }
+-#elif DOVECOT_IS_EQ(2, 0) || DOVECOT_IS_EQ(2, 1)
++#elif DOVECOT_IS_GE(2,0,0) && DOVECOT_IS_LT(2,2,0)
+ #define mempool_unref pool_unref
+ #define module_arg struct module *
+ #define ME(err) MAIL_ERROR_ ##err,
+@@ -277,7 +277,7 @@ o_stream_create_from_fd(int fd, pool_t pool ATTR_UNUSED)
+ {
+ return dict_init(uri, DICT_DATA_TYPE_STRING, username, NULL);
+ }
+-#elif DOVECOT_IS_EQ(2, 2)
++#elif DOVECOT_IS_GE(2,2,0)
+ #define mempool_unref pool_unref
+ #define module_arg struct module *
+ #define ME(err) MAIL_ERROR_ ##err,
+diff --git a/dovecot-version.c b/dovecot-version.c
+index e7e7cf2..a9f980a 100644
+--- a/dovecot-version.c
++++ b/dovecot-version.c
+@@ -40,19 +40,19 @@ int main(int argc, char **argv)
+ printf("/* Auto-generated file, do not edit */\n\n");
+ printf("#define DOVECOT_VERSION_CODE(maj, min, patch) "
+ "((maj)<<16 | ((min)<<8) | (patch))\n\n");
+-
++
+ printf("#define DOVECOT_VCODE "
+- "0x%.2x%.2x%.2x\n", maj, min, 0);
+- printf("#define DOVECOT_IS_EQ(maj, min) "
+- "DOVECOT_VCODE == DOVECOT_VERSION_CODE(maj, min, 0)\n");
+- printf("#define DOVECOT_IS_GT(maj, min) "
+- "DOVECOT_VCODE > DOVECOT_VERSION_CODE(maj, min, 0)\n");
+- printf("#define DOVECOT_IS_GE(maj, min) "
+- "DOVECOT_VCODE >= DOVECOT_VERSION_CODE(maj, min, 0)\n");
+- printf("#define DOVECOT_IS_LT(maj, min) "
+- "DOVECOT_VCODE < DOVECOT_VERSION_CODE(maj, min, 0)\n");
+- printf("#define DOVECOT_IS_LE(maj, min) "
+- "DOVECOT_VCODE <= DOVECOT_VERSION_CODE(maj, min, 0)\n");
++ "0x%.2x%.2x%.2x\n", maj, min, patch);
++ printf("#define DOVECOT_IS_EQ(maj, min, patch) "
++ "DOVECOT_VCODE == DOVECOT_VERSION_CODE(maj, min, patch)\n");
++ printf("#define DOVECOT_IS_GT(maj, min, patch) "
++ "DOVECOT_VCODE > DOVECOT_VERSION_CODE(maj, min, patch)\n");
++ printf("#define DOVECOT_IS_GE(maj, min, patch) "
++ "DOVECOT_VCODE >= DOVECOT_VERSION_CODE(maj, min, patch)\n");
++ printf("#define DOVECOT_IS_LT(maj, min, patch) "
++ "DOVECOT_VCODE < DOVECOT_VERSION_CODE(maj, min, patch)\n");
++ printf("#define DOVECOT_IS_LE(maj, min, patch) "
++ "DOVECOT_VCODE <= DOVECOT_VERSION_CODE(maj, min, patch)\n");
+
+ /* Use the antispam-storage-2.0.c for dovecot 2.1 and 2.2 as well */
+ if (maj == 2 && min < 3)
+--
+cgit v0.10.2
+
+From 2aa93d15409f5a47589d264991fd3e8261d34b1b Mon Sep 17 00:00:00 2001
+From: Ron <ron at debian.org>
+Date: Sat, 25 Oct 2014 00:47:21 +1030
+Subject: Add a compatibility macro for t_push()
+
+This should fix things for the API change in dovecot 2.2.14 reported in:
+https://bugs.debian.org/765943
+
+diff --git a/antispam-plugin.h b/antispam-plugin.h
+index 724ab5e..939e27e 100644
+--- a/antispam-plugin.h
++++ b/antispam-plugin.h
+@@ -299,6 +299,10 @@ o_stream_create_from_fd(int fd, pool_t pool ATTR_UNUSED)
+ #define module_arg struct module *
+ #define ME(err) MAIL_ERROR_ ##err,
+
++#if DOVECOT_IS_GE(2,2,14)
++#define t_push() t_push(__func__)
++#endif
++
+ static inline const char *const *
+ get_mail_headers(struct mail *mail, const char *hdr)
+ {
+--
+cgit v0.10.2
+
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/dovecot-antispam.git/commitdiff/8563cd9482c02ed164208cc7ce466ca5740749e8
More information about the pld-cvs-commit
mailing list