Le mercredi 18 novembre 2009 à 19:12 +0100, Julien Valroff a écrit :
> 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.

Here is a cleaner patch from a remote GIT branch.

Cheers,
Julien
diff --git a/debian/README.Debian b/debian/README.Debian
index 47e103f..e69de29 100644
--- a/debian/README.Debian
+++ b/debian/README.Debian
@@ -1,6 +0,0 @@
-dovecot-antispam
-================
-
-Read dovecot-antispam(7).
-
- -- Jonny Lamb <jo...@debian.org>  Wed, 18 Feb 2009 15:02:42 +0000
diff --git a/debian/changelog b/debian/changelog
index da20a4b..4522386 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -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 <jul...@kirya.net>  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 --git a/debian/compat b/debian/compat
index 7ed6ff8..7f8f011 100644
--- a/debian/compat
+++ b/debian/compat
@@ -1 +1 @@
-5
+7
diff --git a/debian/control b/debian/control
index bf49940..fd27ef8 100644
--- a/debian/control
+++ b/debian/control
@@ -2,16 +2,38 @@ Source: dovecot-antispam
 Section: mail
 Priority: optional
 Maintainer: Ron Lee <r...@debian.org>
-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 @@ Description: a Dovecot plugin that helps train spam filters
  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 --git a/debian/dovecot-antispam-backend-crm114.dirs b/debian/dovecot-antispam-backend-crm114.dirs
new file mode 100644
index 0000000..e5a37d1
--- /dev/null
+++ b/debian/dovecot-antispam-backend-crm114.dirs
@@ -0,0 +1 @@
+usr/lib/dovecot/modules/imap
diff --git a/debian/dovecot-antispam-backend-crm114.install b/debian/dovecot-antispam-backend-crm114.install
new file mode 100644
index 0000000..b43a40e
--- /dev/null
+++ b/debian/dovecot-antispam-backend-crm114.install
@@ -0,0 +1 @@
+lib90_crm114_plugin.so usr/lib/dovecot/modules/imap
diff --git a/debian/dovecot-antispam-backend-dspam.dirs b/debian/dovecot-antispam-backend-dspam.dirs
new file mode 100644
index 0000000..e5a37d1
--- /dev/null
+++ b/debian/dovecot-antispam-backend-dspam.dirs
@@ -0,0 +1 @@
+usr/lib/dovecot/modules/imap
diff --git a/debian/dovecot-antispam-backend-dspam.install b/debian/dovecot-antispam-backend-dspam.install
new file mode 100644
index 0000000..e96e4b7
--- /dev/null
+++ b/debian/dovecot-antispam-backend-dspam.install
@@ -0,0 +1 @@
+lib90_dspam_plugin.so usr/lib/dovecot/modules/imap
diff --git a/debian/dovecot-antispam-backend-mailtrain.dirs b/debian/dovecot-antispam-backend-mailtrain.dirs
new file mode 100644
index 0000000..e5a37d1
--- /dev/null
+++ b/debian/dovecot-antispam-backend-mailtrain.dirs
@@ -0,0 +1 @@
+usr/lib/dovecot/modules/imap
diff --git a/debian/dovecot-antispam-backend-mailtrain.install b/debian/dovecot-antispam-backend-mailtrain.install
new file mode 100644
index 0000000..862d275
--- /dev/null
+++ b/debian/dovecot-antispam-backend-mailtrain.install
@@ -0,0 +1 @@
+lib90_antispam_plugin.so usr/lib/dovecot/modules/imap
diff --git a/debian/dovecot-antispam-backend-spool2dir.dirs b/debian/dovecot-antispam-backend-spool2dir.dirs
new file mode 100644
index 0000000..e5a37d1
--- /dev/null
+++ b/debian/dovecot-antispam-backend-spool2dir.dirs
@@ -0,0 +1 @@
+usr/lib/dovecot/modules/imap
diff --git a/debian/dovecot-antispam-backend-spool2dir.install b/debian/dovecot-antispam-backend-spool2dir.install
new file mode 100644
index 0000000..a3af840
--- /dev/null
+++ b/debian/dovecot-antispam-backend-spool2dir.install
@@ -0,0 +1 @@
+lib90_spool2dir_plugin.so usr/lib/dovecot/modules/imap
diff --git a/debian/dovecot-antispam-config b/debian/dovecot-antispam-config
index d094d11..e69de29 100644
--- a/debian/dovecot-antispam-config
+++ b/debian/dovecot-antispam-config
@@ -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 --git a/debian/rules b/debian/rules
index 0ac5356..b85cbe2 100755
--- a/debian/rules
+++ b/debian/rules
@@ -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 --git a/debian/watch b/debian/watch
new file mode 100644
index 0000000..42262f5
--- /dev/null
+++ b/debian/watch
@@ -0,0 +1,2 @@
+version=3
+http://johannes.sipsolutions.net/download/dovecot-antispam/dovecot-antispam-(.*)\.tar.bz2

Reply via email to