- update contrib/ to match upstream

- fix up bash-isms from contrib/randomtrain (patch), that should be the last
  bash-ism in contrib/ (also fixed in upcoming upstream 0.96.4 release)
- Remove bash dependency

PR:		ports/88121
Submitted by:	maintainer
This commit is contained in:
Renato Botelho 2005-10-28 11:17:04 +00:00
parent 2cd83fa9c5
commit df106be6f3
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=146571
3 changed files with 101 additions and 30 deletions

View file

@ -7,7 +7,7 @@
PORTNAME= bogofilter
PORTVERSION= 0.96.3
PORTREVISION?= 1
PORTREVISION?= 2
CATEGORIES?= mail
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE}
MASTER_SITE_SUBDIR= ${PORTNAME}
@ -15,8 +15,7 @@ MASTER_SITE_SUBDIR= ${PORTNAME}
MAINTAINER?= matthias.andree@gmx.de
COMMENT= Fast, teachable, learning spam detector
OPTIONS= BASH "Install scripts that depend on the bash(1) shell" on
OPTIONS+= GSL "Link with system-wide GSL dynamically (recommended)" on
OPTIONS= GSL "Link with system-wide GSL dynamically (recommended)" on
OPTIONS+= UNICODE "Normalize tokens to Unicode (UTF-8)" on
LIB_DEPENDS?= db-4.3:${PORTSDIR}/databases/db43
@ -31,10 +30,6 @@ PATCH_STRIP= -p1
.include <bsd.port.pre.mk>
.if !defined(WITHOUT_BASH)
RUN_DEPENDS+= bash:${PORTSDIR}/shells/bash
.endif
BF_LIBS?= -ldb-4.3
BF_CPPFLAGS?= -I${LOCALBASE}/include/db43 -I${LOCALBASE}/include
CONFIGURE_ARGS+= --sysconfdir=${PREFIX}/etc
@ -57,10 +52,6 @@ MAN1= bogofilter.1 bogoutil.1 bogoupgrade.1 bogolexer.1 bogotune.1 \
bf_copy.1 bf_compact.1 bf_tar.1
post-patch:
${REINPLACE_CMD} -e "s|/bin/bash|${LOCALBASE}/bin/bash|" \
${WRKSRC}/contrib/randomtrain \
${WRKSRC}/contrib/scramble \
${WRKSRC}/contrib/trainbogo.sh
${REINPLACE_CMD} -e 's|^#!.*perl|#! ${PERL}|' \
${WRKSRC}/src/tests/unsort.pl \
${WRKSRC}/contrib/bfproxy \
@ -98,27 +89,25 @@ post-install::
doc/bogofilter-faq.html doc/bogofilter-faq-fr.html
${INSTALL_DATA} ${WRKSRC}/${i} ${DOCSDIR}
.endfor
${INSTALL_DATA} ${WRKSRC}/trio/AUTHORS ${DOCSDIR}/AUTHORS.trio
.for i in contrib/dot-qmail-bogofilter-default
${INSTALL_DATA} ${WRKSRC}/${i} ${DOCSDIR}/${i}
.for i in README.randomtrain README.contrib
${INSTALL_DATA} ${WRKSRC}/contrib/${i} ${DOCSDIR}/contrib/${i}
.endfor
${INSTALL_DATA} ${WRKSRC}/trio/AUTHORS ${DOCSDIR}/AUTHORS.trio
${INSTALL_DATA} ${WRKSRC}/doc/*.html ${DOCSDIR}/html
${INSTALL_DATA} ${WRKSRC}/doc/*.xml ${DOCSDIR}/xml
${INSTALL_DATA} ${WRKSRC}/doc/programmer/README.freebsd ${DOCSDIR}/programmer
.endif
${INSTALL_PROGRAM} ${WRKSRC}/contrib/bogogrep ${DOCSDIR}/contrib/
.for i in contrib/bogo.R contrib/bogofilter-qfe \
contrib/mime.get.rfc822 contrib/printmaildir.pl \
contrib/bogominitrain.pl contrib/README.contrib \
contrib/bfproxy contrib/spamitarium contrib/stripsearch
${INSTALL_SCRIPT} ${WRKSRC}/${i} ${DOCSDIR}/${i}
${INSTALL_PROGRAM} ${WRKSRC}/contrib/bogogrep ${PREFIX}/bin/
.for i in bfproxy bogofilter-milter.pl bogo.R bogofilter-qfe \
mime.get.rfc822 parmtest.sh printmaildir.pl \
bogominitrain.pl \
randomtrain scramble spamitarium stripsearch trainbogo.sh
${INSTALL_SCRIPT} ${WRKSRC}/contrib/${i} ${DOCSDIR}/contrib/${i}
.endfor
.if !defined(WITHOUT_BASH)
.for i in randomtrain scramble trainbogo.sh
${INSTALL_SCRIPT} ${WRKSRC}/contrib/${i} ${DOCSDIR}/contrib/
.for i in dot-qmail-bogofilter-default \
mailfilter.example procmailrc.example
${INSTALL_DATA} ${WRKSRC}/contrib/${i} ${DOCSDIR}/contrib/${i}
.endfor
${INSTALL_DATA} ${WRKSRC}/contrib/README.randomtrain ${DOCSDIR}/contrib/
.endif
${SETENV} PKG_PREFIX="${PREFIX}" ${SH} ${PKGINSTALL} ${PKGNAME} POST-INSTALL
.include <bsd.port.post.mk>

View file

@ -0,0 +1,79 @@
--- ./contrib/randomtrain~ 2005/10/26 22:05:55 1.1
+++ ./contrib/randomtrain 2005/10/27 07:54:15 1.2
@@ -4,15 +4,17 @@
#
# randomtrain -- bogofilter messages from files in random order
# and train if the result is wrong or uncertain
-# needs: bash basename rm grep awk wc perl dd bogofilter
+# needs: POSIX compliant sh, basename rm grep awk wc perl dd bogofilter
# usage: see function usage() of this file
#
# original author: Greg Louis <glouis@dynamicro.on.ca>
# modified by: David Relson <relson@osagesoftware.com>
+# Note: on Solaris, use /usr/xpg4/bin/sh -- /bin/sh will not work.
+
BOGOFILTER="bogofilter"
-function usage() {
+usage() {
name=$(basename $0)
echo "Usage: $name [-d bogodir] [-p pid] [-c cfg] [-]n|s filename [-]n|s filename [...]"
echo " Messages contained in the files are fed to bogofilter"
@@ -34,7 +36,7 @@
exit 1
}
-function train_mbox() {
+train_mbox() {
# go through the list, extract the messages, eval with bogofilter
# and train if bogofilter is wrong or uncertain
cnt=0; nspam=0; ngood=0; rspam=0; rgood=0;
@@ -63,7 +65,7 @@
printf "\r%5d%5d %5d%5d\n" $nspam $rspam $ngood $rgood
}
-function train_maildir() {
+train_maildir() {
# go through the list, extract the messages, eval with bogofilter
# and train if bogofilter is wrong or uncertain
cnt=0; nspam=0; ngood=0; rspam=0; rgood=0;
@@ -103,9 +105,9 @@
mdir=2 # maildir mode
while [ ${#*} -gt 1 ]; do
- indic=${1:0-1:1} ; shift
+ indic=$1 ; shift
case "$indic" in
- s | n )
+ s|-s|n|-n)
path=$1 ; shift
cmd="$cmd -c $indic $path"
if [ ! -r $path ]; then echo "file '$path' not found"; usage; fi
@@ -118,22 +120,22 @@
fi
fi
;;
- c )
+ c|-c)
file=$1 ; shift
cfg="-c $file"
if [ ! -r $file ]; then echo "file '$file' not found"; usage; fi
;;
- p )
+ p|-p)
pid=$1; shift;
;;
- d )
+ d|-d)
[ -n "$bogodir" ] && usage
bogodir=$1 ; shift
if [ ! -d $bogodir ]; then echo "directory '$bogodir' not found"; usage; fi
[ ! -f $bogodir/spamlist.db ] && $BOGOFILTER -d $bogodir -s -C < /dev/null
[ ! -f $bogodir/goodlist.db ] && $BOGOFILTER -d $bogodir -n -C < /dev/null
;;
- * )
+ *)
usage
esac
done

View file

@ -2,6 +2,7 @@ bin/bf_compact
bin/bf_copy
bin/bf_tar
bin/bogofilter
bin/bogogrep
bin/bogolexer
bin/bogotune
bin/bogoutil
@ -9,17 +10,19 @@ bin/bogoupgrade
etc/bogofilter.cf.example
%%CONTRIB%%%%DOCSDIR%%/contrib/bfproxy
%%CONTRIB%%%%DOCSDIR%%/contrib/bogo.R
%%CONTRIB%%%%DOCSDIR%%/contrib/bogofilter-milter.pl
%%CONTRIB%%%%DOCSDIR%%/contrib/bogofilter-qfe
%%CONTRIB%%%%DOCSDIR%%/contrib/mime.get.rfc822
%%CONTRIB%%%%DOCSDIR%%/contrib/printmaildir.pl
%%CONTRIB%%%%DOCSDIR%%/contrib/bogominitrain.pl
%%CONTRIB%%%%DOCSDIR%%/contrib/README.contrib
%%CONTRIB%%%%DOCSDIR%%/contrib/bogogrep
%%CONTRIB%%%%DOCSDIR%%/contrib/dot-qmail-bogofilter-default
%%CONTRIB%%%%DOCSDIR%%/contrib/mailfilter.example
%%CONTRIB%%%%DOCSDIR%%/contrib/mime.get.rfc822
%%CONTRIB%%%%DOCSDIR%%/contrib/parmtest.sh
%%CONTRIB%%%%DOCSDIR%%/contrib/printmaildir.pl
%%CONTRIB%%%%DOCSDIR%%/contrib/procmailrc.example
%%CONTRIB%%%%DOCSDIR%%/contrib/randomtrain
%%CONTRIB%%%%DOCSDIR%%/contrib/scramble
%%CONTRIB%%%%DOCSDIR%%/contrib/spamitarium
%%CONTRIB%%%%DOCSDIR%%/contrib/stripsearch
%%CONTRIB%%%%DOCSDIR%%/contrib/trainbogo.sh
%%CONTRIB%%%%DOCSDIR%%/contrib/README.randomtrain
%%CONTRIB%%@dirrm %%DOCSDIR%%/contrib
%%CONTRIB%%@dirrm %%DOCSDIR%%