package dovecot-antispam
retitle 540283 Please provide different packages for the various supported 
backends
tags 540283 + patch
thanks

Hi,

You will find attached a patch against current version in unstable,
which implements different flavours of the dovecot-antispam package for
the various available backends.

There are still some things to be done:

- Long descriptions should be improved

- I have opted for different plugin names so that all the packages can
be installed together. However, this would mean that the options should
be renamed from the default antispam_* to <pluginname>_* in the manpage.
I am not sure if it is really needed to get packages installed on the
same system, hence might be easier to just stick with the default
antispam name so that the documentation remains applicable. In that
case, I am not sure how to do once one plugin is built (should be moved
to another location before the following plugin is built as the first
file would be overwritten).
If the plugins have the same name, the packages should obviously
conflict with each other.

I have noticed that 2 files were changed in the current diff (antispam.c
and antispam.h), a patch would be better I think?

Note that I have also removed the current README.Debian which I find
useless (maybe the upstream README should be changed if you want the
default man to be called dovecot-antispam.7), however, it might be great
to write a README.source to explain the build process.

I hope this helps... 

Cheers,
Julien
diff -ruN /tmp/dovecot-antispam-1.2+20090702/debian/changelog debian/changelog
--- /tmp/dovecot-antispam-1.2+20090702/debian/changelog	2009-11-18 18:45:51.000000000 +0100
+++ debian/changelog	2009-11-18 14:17:53.153441812 +0100
@@ -1,3 +1,15 @@
+dovecot-antispam (1.2+20090702-1.1) unstable; urgency=low
+
+  * Non-maintainer upload.
+  * Builds multiple binary packages for each available backend
+    (Closes: #540283)
+  * Remove useless README.Debian
+  * Bump Standards version to 3.8.3
+  * Bump DH compat to 7
+  * Add watchfile to track new upstream releases
+
+ -- Julien Valroff <[email protected]>  Wed, 18 Nov 2009 14:17:48 +0100
+
 dovecot-antispam (1.2+20090702-1) unstable; urgency=low
 
   * Adopt this one officially now with the maintainer's blessing. Thanks Jonny!
diff -ruN /tmp/dovecot-antispam-1.2+20090702/debian/compat debian/compat
--- /tmp/dovecot-antispam-1.2+20090702/debian/compat	2009-11-18 18:45:51.000000000 +0100
+++ debian/compat	2009-11-15 18:10:10.565430804 +0100
@@ -1 +1 @@
-5
+7
diff -ruN /tmp/dovecot-antispam-1.2+20090702/debian/control debian/control
--- /tmp/dovecot-antispam-1.2+20090702/debian/control	2009-11-18 18:45:51.000000000 +0100
+++ debian/control	2009-11-18 14:22:08.117440244 +0100
@@ -2,16 +2,38 @@
 Section: mail
 Priority: optional
 Maintainer: Ron Lee <[email protected]>
-Build-Depends: debhelper (>= 5), dovecot-dev
-Standards-Version: 3.8.2.0
+Build-Depends: debhelper (>= 7), dovecot-dev
+Standards-Version: 3.8.3
 Homepage: http://johannes.sipsolutions.net/Projects/dovecot-antispam
 Vcs-Git: git://git.debian.org/users/ron/dovecot-antispam.git
 Vcs-Browser: http://git.debian.org/?p=users/ron/dovecot-antispam.git;a=summary
 
 Package: dovecot-antispam
+Architecture: all
+Depends: ${shlibs:Depends}, ${misc:Depends}, dovecot-antispam-mailtrain
+Description: a Dovecot plugin that helps train spam filters - transitional package
+ dovecot-antispam provides a plugin for the Dovecot IMAP server that
+ helps train spam filters. It watches designated spam folders and
+ trains mail as spam or non-spam when it moves in or out of those
+ folders respectively.  This avoids the problem of needing additional
+ folders to track correctly and incorrectly classified spam and non-spam.
+ .
+ dovecot-antispam supports dspam, crm114, and generic training by
+ mailing spam and non-spam to training addresses.  For crm114, it
+ supports folders for the additional "unsure" classification, and
+ trains when moving from there to spam or normal folders.
+ .
+ Note that dovecot-antispam needs the type of spam filter configured at
+ compile time.  It supports building with a custom name, specifically
+ to allow installing multiple variations simultaneously.
+ .
+ This package is a transitional package to dovecot-antispam-mailtrain
+ and can be removed safely.
+
+Package: dovecot-antispam-backend-mailtrain
 Architecture: any
 Depends: ${shlibs:Depends}, ${misc:Depends}, dovecot-imapd
-Description: a Dovecot plugin that helps train spam filters
+Description: a Dovecot plugin that helps train spam filters - mailtrain backend
  dovecot-antispam provides a plugin for the Dovecot IMAP server that
  helps train spam filters. It watches designated spam folders and
  trains mail as spam or non-spam when it moves in or out of those
@@ -27,3 +49,66 @@
  compile time.  It supports building with a custom name, specifically
  to allow installing multiple variations simultaneously.  This package
  is built to use the mailtrain backend.
+
+Package: dovecot-antispam-backend-dspam
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}, dovecot-imapd
+Recommends: dspam
+Description: a Dovecot plugin that helps train spam filters - dspam backend
+ dovecot-antispam provides a plugin for the Dovecot IMAP server that
+ helps train spam filters. It watches designated spam folders and
+ trains mail as spam or non-spam when it moves in or out of those
+ folders respectively.  This avoids the problem of needing additional
+ folders to track correctly and incorrectly classified spam and non-spam.
+ .
+ dovecot-antispam supports dspam, crm114, and generic training by
+ mailing spam and non-spam to training addresses.  For crm114, it
+ supports folders for the additional "unsure" classification, and
+ trains when moving from there to spam or normal folders.
+ .
+ Note that dovecot-antispam needs the type of spam filter configured at
+ compile time.  It supports building with a custom name, specifically
+ to allow installing multiple variations simultaneously.  This package
+ is built to use the dspam backend.
+
+Package: dovecot-antispam-backend-crm114
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}, dovecot-imapd
+Recommends: crm114
+Description: a Dovecot plugin that helps train spam filters - crm114 backend
+ dovecot-antispam provides a plugin for the Dovecot IMAP server that
+ helps train spam filters. It watches designated spam folders and
+ trains mail as spam or non-spam when it moves in or out of those
+ folders respectively.  This avoids the problem of needing additional
+ folders to track correctly and incorrectly classified spam and non-spam.
+ .
+ dovecot-antispam supports dspam, crm114, and generic training by
+ mailing spam and non-spam to training addresses.  For crm114, it
+ supports folders for the additional "unsure" classification, and
+ trains when moving from there to spam or normal folders.
+ .
+ Note that dovecot-antispam needs the type of spam filter configured at
+ compile time.  It supports building with a custom name, specifically
+ to allow installing multiple variations simultaneously.  This package
+ is built to use the crm114 backend.
+
+Package: dovecot-antispam-backend-spool2dir
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}, dovecot-imapd
+Description: a Dovecot plugin that helps train spam filters - spool2dir backend
+ dovecot-antispam provides a plugin for the Dovecot IMAP server that
+ helps train spam filters. It watches designated spam folders and
+ trains mail as spam or non-spam when it moves in or out of those
+ folders respectively.  This avoids the problem of needing additional
+ folders to track correctly and incorrectly classified spam and non-spam.
+ .
+ dovecot-antispam supports dspam, crm114, and generic training by
+ mailing spam and non-spam to training addresses.  For crm114, it
+ supports folders for the additional "unsure" classification, and
+ trains when moving from there to spam or normal folders.
+ .
+ Note that dovecot-antispam needs the type of spam filter configured at
+ compile time.  It supports building with a custom name, specifically
+ to allow installing multiple variations simultaneously.  This package
+ is built to use the spool2dir backend.
+
diff -ruN /tmp/dovecot-antispam-1.2+20090702/debian/dovecot-antispam-backend-crm114.dirs debian/dovecot-antispam-backend-crm114.dirs
--- /tmp/dovecot-antispam-1.2+20090702/debian/dovecot-antispam-backend-crm114.dirs	1970-01-01 01:00:00.000000000 +0100
+++ debian/dovecot-antispam-backend-crm114.dirs	2009-11-15 17:57:23.657430778 +0100
@@ -0,0 +1 @@
+usr/lib/dovecot/modules/imap
diff -ruN /tmp/dovecot-antispam-1.2+20090702/debian/dovecot-antispam-backend-crm114.install debian/dovecot-antispam-backend-crm114.install
--- /tmp/dovecot-antispam-1.2+20090702/debian/dovecot-antispam-backend-crm114.install	1970-01-01 01:00:00.000000000 +0100
+++ debian/dovecot-antispam-backend-crm114.install	2009-11-15 17:58:18.269430719 +0100
@@ -0,0 +1 @@
+lib90_crm114_plugin.so usr/lib/dovecot/modules/imap
diff -ruN /tmp/dovecot-antispam-1.2+20090702/debian/dovecot-antispam-backend-dspam.dirs debian/dovecot-antispam-backend-dspam.dirs
--- /tmp/dovecot-antispam-1.2+20090702/debian/dovecot-antispam-backend-dspam.dirs	1970-01-01 01:00:00.000000000 +0100
+++ debian/dovecot-antispam-backend-dspam.dirs	2009-11-15 17:57:19.009430703 +0100
@@ -0,0 +1 @@
+usr/lib/dovecot/modules/imap
diff -ruN /tmp/dovecot-antispam-1.2+20090702/debian/dovecot-antispam-backend-dspam.install debian/dovecot-antispam-backend-dspam.install
--- /tmp/dovecot-antispam-1.2+20090702/debian/dovecot-antispam-backend-dspam.install	1970-01-01 01:00:00.000000000 +0100
+++ debian/dovecot-antispam-backend-dspam.install	2009-11-15 17:58:07.613431095 +0100
@@ -0,0 +1 @@
+lib90_dspam_plugin.so usr/lib/dovecot/modules/imap
diff -ruN /tmp/dovecot-antispam-1.2+20090702/debian/dovecot-antispam-backend-mailtrain.dirs debian/dovecot-antispam-backend-mailtrain.dirs
--- /tmp/dovecot-antispam-1.2+20090702/debian/dovecot-antispam-backend-mailtrain.dirs	1970-01-01 01:00:00.000000000 +0100
+++ debian/dovecot-antispam-backend-mailtrain.dirs	2009-11-15 17:52:44.825430299 +0100
@@ -0,0 +1 @@
+usr/lib/dovecot/modules/imap
diff -ruN /tmp/dovecot-antispam-1.2+20090702/debian/dovecot-antispam-backend-mailtrain.install debian/dovecot-antispam-backend-mailtrain.install
--- /tmp/dovecot-antispam-1.2+20090702/debian/dovecot-antispam-backend-mailtrain.install	1970-01-01 01:00:00.000000000 +0100
+++ debian/dovecot-antispam-backend-mailtrain.install	2009-11-15 17:46:10.161430874 +0100
@@ -0,0 +1 @@
+lib90_antispam_plugin.so usr/lib/dovecot/modules/imap
diff -ruN /tmp/dovecot-antispam-1.2+20090702/debian/dovecot-antispam-backend-spool2dir.dirs debian/dovecot-antispam-backend-spool2dir.dirs
--- /tmp/dovecot-antispam-1.2+20090702/debian/dovecot-antispam-backend-spool2dir.dirs	1970-01-01 01:00:00.000000000 +0100
+++ debian/dovecot-antispam-backend-spool2dir.dirs	2009-11-15 18:24:26.565430843 +0100
@@ -0,0 +1 @@
+usr/lib/dovecot/modules/imap
diff -ruN /tmp/dovecot-antispam-1.2+20090702/debian/dovecot-antispam-backend-spool2dir.install debian/dovecot-antispam-backend-spool2dir.install
--- /tmp/dovecot-antispam-1.2+20090702/debian/dovecot-antispam-backend-spool2dir.install	1970-01-01 01:00:00.000000000 +0100
+++ debian/dovecot-antispam-backend-spool2dir.install	2009-11-15 18:25:20.061430599 +0100
@@ -0,0 +1 @@
+lib90_spool2dir_plugin.so usr/lib/dovecot/modules/imap
diff -ruN /tmp/dovecot-antispam-1.2+20090702/debian/dovecot-antispam-config debian/dovecot-antispam-config
--- /tmp/dovecot-antispam-1.2+20090702/debian/dovecot-antispam-config	2009-11-18 18:45:51.000000000 +0100
+++ debian/dovecot-antispam-config	1970-01-01 01:00:00.000000000 +0100
@@ -1,50 +0,0 @@
-# Example plugin build time configuration
-#
-# This file lists the configuration options that are used when building the
-# antispam plugin. All lines starting with # are ignored. Configuration option
-# lines must be commented out completely, if they are not to be included,
-# i.e. just setting VARIABLE=n is not disabling that variable.
-#
-# This file is included in Makefile, so variables like CFLAGS and LIBS can also
-# be modified from here. In most cases, these lines should use += in order not
-# to override previous values of the variables.
-
-# backend (select exactly one)
-#  dspam-exec		- direct dspam training by calling dspam executable
-#  signature-log	- signature logging using dovecot's dict API
-#  mailtrain		- send mail to special addresses for training
-#  crm114-exec		- direct crm114 training by calling mailreaver.crm
-#BACKEND=dspam-exec
-#BACKEND=signature-log
-BACKEND=mailtrain
-#BACKEND=crm114-exec
-
-# Dovecot build/header directory
-# Building the plugin requires configured dovecot sources or having
-# configured it with --enable-header-install in which case you can
-# point DOVECOT= to the installed headers too.
-#DOVECOT=../dovecot-1.0.5
-#DOVECOT=../dovecot-1.1
-DOVECOT=/usr/include/dovecot
-
-# install directory for 'make install'
-# NB no need for a final '/'
-INSTALLDIR=/usr/lib/dovecot/modules/imap
-# The user and group for the installed plugin
-USER=root
-GROUP=root
-
-# enable debugging to syslog or stderr
-#DEBUG=stderr
-#DEBUG=syslog
-
-# verbose debugging (lots of output!)
-#DEBUG_VERBOSE=1
-
-# plugin name, change only if you need to rename the plugin
-# (because, for example, you need two instances for different
-# spam filters installed)
-PLUGINNAME=antispam
-
-# extra CFLAGS
-# CFLAGS += -g3
diff -ruN /tmp/dovecot-antispam-1.2+20090702/debian/README.Debian debian/README.Debian
--- /tmp/dovecot-antispam-1.2+20090702/debian/README.Debian	2009-11-18 18:45:51.000000000 +0100
+++ debian/README.Debian	1970-01-01 01:00:00.000000000 +0100
@@ -1,6 +0,0 @@
-dovecot-antispam
-================
-
-Read dovecot-antispam(7).
-
- -- Jonny Lamb <[email protected]>  Wed, 18 Feb 2009 15:02:42 +0000
diff -ruN /tmp/dovecot-antispam-1.2+20090702/debian/rules debian/rules
--- /tmp/dovecot-antispam-1.2+20090702/debian/rules	2009-11-18 18:45:51.000000000 +0100
+++ debian/rules	2009-11-18 18:38:51.937440928 +0100
@@ -1,35 +1,74 @@
 #!/usr/bin/make -f
 
+BACKENDS+=mailtrain
+BACKENDS+=dspam
+BACKENDS+=crm114
+BACKENDS+=spool2dir
+
 build: build-stamp
 
-build-stamp:
-	dh_testdir
-	cp debian/dovecot-antispam-config .config
+build-mailtrain: clean-int
+	cp -f defconfig .config
+	echo "BACKEND=mailtrain" >> .config
+	$(MAKE)
+
+build-dspam: clean-int
+	cp -f defconfig .config
+	echo "BACKEND=dspam-exec" >> .config
+	sed -i 's/^PLUGINNAME=antispam/PLUGINNAME=dspam/' .config
+	$(MAKE)
+
+build-crm114: clean-int
+	cp -f defconfig .config
+	echo "BACKEND=crm114-exec" >> .config
+	sed -i 's/^PLUGINNAME=antispam/PLUGINNAME=crm114/' .config
+	$(MAKE)
+
+build-spool2dir: clean-int
+	cp -f defconfig .config
+	echo "BACKEND=spool2dir" >> .config
+	sed -i 's/^PLUGINNAME=antispam/PLUGINNAME=spool2dir/' .config
 	$(MAKE)
-	touch $@
+
+build-stamp: $(foreach v,$(BACKENDS),build-$(v))
+	dh_testdir
+	touch build-stamp
+
+clean-int:
+	$(MAKE) clean
+	$(RM) .config
+	dh_clean
 
 clean:
 	dh_testdir
 	dh_testroot
 	rm -f build-stamp
 	$(MAKE) clean	
-	$(RM) .config dovecot-antispam.7
+	$(RM) .config
 	dh_clean
 
-install: build
+install: build $(foreach v,$(BACKENDS),build-$(v))
 	dh_testdir
 	dh_testroot
 	dh_clean -k
-	dh_install lib90_antispam_plugin.so usr/lib/dovecot/modules/imap
-	ln -sf antispam.7 dovecot-antispam.7
-	dh_installman dovecot-antispam.7
 
 binary-indep: build install
+	dh_testdir
+	dh_testroot
+	dh_installdocs -A NOTES README
+	dh_compress
+	dh_fixperms
+	dh_installdeb
+	dh_gencontrol
+	dh_md5sums
+	dh_builddeb
 
 binary-arch: build install
 	dh_testdir
 	dh_testroot
-	dh_installdocs
+	dh_install
+	dh_installman -A -Ndovecot-antispam antispam.7
+	dh_installdocs -A NOTES README
 	dh_installchangelogs
 	dh_strip
 	dh_compress
diff -ruN /tmp/dovecot-antispam-1.2+20090702/debian/watch debian/watch
--- /tmp/dovecot-antispam-1.2+20090702/debian/watch	1970-01-01 01:00:00.000000000 +0100
+++ debian/watch	2009-11-18 14:18:47.553441976 +0100
@@ -0,0 +1,2 @@
+version=3
+http://johannes.sipsolutions.net/download/dovecot-antispam/dovecot-antispam-(.*)\.tar.bz2

Reply via email to