-------- Original-Nachricht --------
> Datum: Sun, 08 Nov 2009 00:00:22 +0100
> Von: Tom Hendrikx <[email protected]>
> An: [email protected]
> Betreff: Re: [Dspam-user] DSPAM 3.9.0 BETA 4

Hallo Tom,


> On 02/11/09 00:04, Stevan Bajić wrote:
> > The DSPAM team is happy to announce another beta release! DSPAM 3.9.0
> BETA 4.
> > 
> > We would appreciate if packagers/ports maintainers could package this
> release ...
> >
> > The DSPAM Team
> > 
> 
> I have updated the ebuild in my gentoo overlay to BETA 4. Also the git
> (live) ebuild has been updated to work again. I've been doing some
> testing on amd64 (compile only) and x86 (compile and run). Any feedback
> is welcome of course.
> 
> The ebuilds are available at:
> https://svn.whyscream.net/whyscream-overlay/testing/mail-filter/dspam/
> 
I did a quick diff against my 3.9.0 Ebuild and this is the result (keep in mind 
that my Ebuild is downloading from GIT):
----------------
theia ~ # diff -Naur dspam-3.9.0_beta4.ebuild 
/mnt/gentoo.overlay/mail-filter/dspam/dspam-3.9.0.ebuild
--- dspam-3.9.0_beta4.ebuild    2009-11-07 16:28:20.000000000 +0100
+++ /mnt/gentoo.overlay/mail-filter/dspam/dspam-3.9.0.ebuild    2009-11-02 
22:28:21.756567529 +0100
@@ -3,27 +3,25 @@
 # $Header: Exp $

 EAPI="2"
+EGIT_PROJECT="dspam"
+EGIT_REPO_URI="git://dspam.git.sourceforge.net/gitroot/dspam/dspam"
+EGIT_BRANCH="master"
 WANT_AUTOCONF="latest"
 WANT_AUTOMAKE="latest"

-inherit eutils autotools multilib flag-o-matic versionator
-
-MY_PV="`echo $(replace_version_separator 3 '-')| tr [:lower:] [:upper:]`"
-MY_P="${PN}-${MY_PV}"
-SRC_URI="mirror://sourceforge/dspam/${MY_P}.tar.gz"
-S="${WORKDIR}/${MY_P}"
+inherit eutils autotools multilib flag-o-matic git

 DESCRIPTION="A statistical-algorithmic hybrid anti-spam filter"
 HOMEPAGE="http://dspam.nuclearelephant.com/";
 LICENSE="GPL-2"
 SLOT="0"
 KEYWORDS="~alpha amd64 ~ppc sparc x86"
-IUSE="clamav daemon ldap mysql postgres sqlite syslog \
+IUSE="clamav daemon external-lookup ldap mysql postgres sqlite syslog \
        large-domain virtual-users user-homedirs \
        debug debug-bnr debug-verbose"

-COMMON_DEPEND="clamav?         ( app-antivirus/clamav )
-       ldap?           ( net-nds/openldap )
+COMMON_DEPEND="clamav? ( >=app-antivirus/clamav-0.90.2 )
+       ldap?           ( >=net-nds/openldap-2.2 )
        mysql?          ( virtual/mysql )
        sqlite?         ( =dev-db/sqlite-3* )"
 DEPEND="${COMMON_DEPEND}
@@ -40,19 +38,41 @@
 DSPAM_MODE=2511

 pkg_setup() {
+       # Delete these lines some time after -r6 removal
+       if has_version "<=mail-filter/dspam-3.8.0-r6" &&
+               built_with_use "<=mail-filter/dspam-3.8.0-r6" sqlite &&
+               grep -q "^StorageDriver.*libsqlite_drv.so" 
"${ROOT}${DSPAM_CONFDIR}"/dspam.conf; then
+                       eerror "Sqlite2 support has been removed. Please 
upgrade your database to sqlite3"
+                       eerror "and select libsqlite3_drv.so in dspam.conf 
before proceeding with update."
+                       die "sqlite-2 no longer supported"
+       fi
+
        local egid euid
        # Need a UID and GID >= 1000, for being able to use suexec in apache
        for euid in $(seq 1000 5000 ) ; do
-               [[ -z $(egetent passwd ${euid}) ]] && break
+               [ -z "$(egetent passwd ${euid})" ] && break
        done
        for egid in $(seq 1000 5000 ) ; do
-               [[ -z $(egetent group ${egid}) ]] && break
+               [ -z "$(egetent group ${egid})" ] && break
        done

        enewgroup dspam ${egid}
        enewuser dspam ${euid} -1 "${DSPAM_HOMEDIR}" dspam,mail
 }

+src_prepare() {
+       AT_M4DIR="${S}/m4"
+       eautoreconf
+
+       # Fix SQLite3 driver
+       # epatch "${FILESDIR}"/${P}-sqlite3_driver_fixes.patch
+}
+
+src_unpack() {
+       git_src_unpack
+       cd "${S}"
+}
+
 src_configure() {
        local myconf=""

@@ -75,6 +95,7 @@
        fi

        local STORAGE="hash_drv"
+
        # select storage driver
        if use sqlite ; then
                STORAGE="${STORAGE},sqlite3_drv"
@@ -89,6 +110,17 @@
                myconf="${myconf} --with-pgsql-includes=/usr/include/postgresql"
                myconf="${myconf} --with-pgsql-libraries=/usr/$(get_libdir)"
        fi
+       if [ "${STORAGE:0:1}" == "," ] ; then
+               STORAGE="${STORAGE:1}"
+       fi
+
+       if use debug ; then
+               append-flags -g2 -ggdb
+               filter-flags -fomit-frame-pointer
+       fi
+
+       # due to parallel build failures
+       filter-flags -j[0-9]*

        export CC="$(tc-getCC)" CXX="$(tc-getCXX)" LD="$(tc-getLD)"

@@ -96,7 +128,7 @@
                --with-dspam-home="${DSPAM_HOMEDIR}" \
                --sysconfdir="${DSPAM_CONFDIR}" \
                $(use_enable daemon) \
-               $(use_enable ldap external-lookup) \
+               $(use_enable external-lookup) \
                $(use_enable clamav) \
                $(use_enable large-domain large-scale) \
                $(use_enable !large-domain domain-scale) \
@@ -112,6 +144,10 @@
                ${myconf} || die "econf failed"
 }

+src_compile() {
+       emake -j1 CC="$(tc-getCC)" || die "emake failed"
+}
+
 src_install () {
        diropts -m0770 -o dspam -g dspam
        dodir "${DSPAM_CONFDIR}"
@@ -211,6 +247,7 @@

                insinto "${DSPAM_CONFDIR}"
                newins src/tools.pgsql_drv/pgsql_objects.sql pgsql_objects.sql 
&&
+                       newins src/tools.pgsql_drv/purge-pe.sql 
pgsql_pe-purge.sql &&
                        newins src/tools.pgsql_drv/purge.sql pgsql_purge.sql ||
                        die "failed to install pgsql*.sql scripts"
                if use virtual-users ; then
@@ -232,7 +269,7 @@
        elif use postgres ; then
                DEFAULT_STORAGE=pgsql
        fi
-       if [[ -z "${DEFAULT_STORAGE}" ]]; then
+       if [ -z "${DEFAULT_STORAGE}" ]; then
                # When only one storage driver is compiled, it is linked 
statically with dspam
                # thus you should not set the StorageDriver at all
                # Also, hash_drv requires certain tokenizer and PValue (see bug 
#185718)
@@ -250,21 +287,21 @@
                        -i "${D}/${DSPAM_CONFDIR}"/dspam.conf
        fi

-       # installs the notification messages
-       # -> The documentation is wrong! The files need to be in ./txt
-       echo "Scanned and tagged as SPAM with DSPAM ${PV} by Your 
ISP.com">"${T}"/msgtag.spam
-       echo "Scanned and tagged as non-SPAM with DSPAM ${PV} by Your 
ISP.com">"${T}"/msgtag.nonspam
-       insinto "${DSPAM_CONFDIR}"/txt
-       doins "${S}"/txt/*.txt
-       doins "${T}"/msgtag.*
-
        # Create the opt-in / opt-out directories
        diropts -m0770 -o dspam -g dspam
        dodir "${DSPAM_HOMEDIR}"
        keepdir "${DSPAM_HOMEDIR}"/opt-in
        keepdir "${DSPAM_HOMEDIR}"/opt-out
+       keepdir "${DSPAM_HOMEDIR}"/txt
        diropts -m0755

+       # installs the notification messages
+       echo "Scanned and tagged as SPAM with DSPAM ${PV} by Your 
ISP.com">"${T}"/msgtag.spam
+       echo "Scanned and tagged as non-SPAM with DSPAM ${PV} by Your 
ISP.com">"${T}"/msgtag.nonspam
+       insinto "${DSPAM_HOMEDIR}"/txt
+       doins "${S}"/txt/*.txt
+       doins "${T}"/msgtag.*
+
        # dspam cron job
        exeinto /etc/cron.daily
        newexe "${FILESDIR}/dspam.cron-r4" dspam.cron || die "failed to install 
cron script"
@@ -278,6 +315,22 @@
        doman man/dspam*
 }

+pkg_preinst() {
+       # Delete these lines some time after -r6 removal
+       if has_version "<=mail-filter/dspam-3.8.0-r6" ; then
+               # Remove obsolete *.data files
+               local f
+               for f in "${ROOT}${DSPAM_CONFDIR}"/{mysql,pgsql}.data ; do
+                       f=${f/\/\//\/}
+                       if [ -f "${f}" ]; then
+                               rm "${f}" &&
+                                       elog "Obsolete ${f} has been removed" ||
+                                       eerror "Failed to remove ${f}"
+                       fi
+               done
+       fi
+}
+
 pkg_postinst() {
        ewarn "The hash_drv storage backend has the following requirements:"
        ewarn "  - PValue must be set to 'markov'; Do not use this pvalue with 
any other storage backend!"
@@ -310,20 +363,20 @@
        local PARAMETER OLD_VALUE VALUE
        for PARAMETER in $@ ; do
                OLD_VALUE=$(awk "BEGIN { IGNORECASE=1; } \$1==\"${PARAMETER}\" 
{ print \$2; exit; }" "${ROOT}${DSPAM_CONFDIR}/dspam.conf")
-               [[ $? == 0 ]] || return 1
-               if [[ "${PARAMETER}" == *"Pass" ]]; then
+               [ $? == 0 ] || return 1
+               if [ "${PARAMETER}" == *"Pass" ]; then
                        read -r -p "${PARAMETER} (default ${OLD_VALUE:-none}; 
enter random for generating a new random password): " VALUE
-                       [[ "${VALUE}" == "random" ]] && 
VALUE="${RANDOM}${RANDOM}${RANDOM}${RANDOM}"
+                       [ "${VALUE}" == "random" ] && 
VALUE="${RANDOM}${RANDOM}${RANDOM}${RANDOM}"
                else
                        read -r -p "${PARAMETER} (default ${OLD_VALUE:-none}): 
" VALUE
                fi

-               if [[ -z "${VALUE}" ]] ; then
+               if [ -z "${VALUE}" ] ; then
                        VALUE=${OLD_VALUE}
                else
                        sed -e "s:^#*${PARAMETER}\([\t ].*\)\?\$:${PARAMETER} 
${VALUE}:gI" \
                                -i "${ROOT}${DSPAM_CONFDIR}/dspam.conf"
-                       [[ $? == 0 ]] || return 2
+                       [ ${?} == 0 ] || return 2
                fi
                eval $PARAMETER=\"${VALUE}\"
        done
@@ -344,12 +397,18 @@
        use mysql && AVAIL_BACKENDS=( ${AVAIL_BACKENDS[*]} mysql )
        use postgres && AVAIL_BACKENDS=( ${AVAIL_BACKENDS[*]} postgres )
        local USE_BACKEND
-       read -p "Which backend do you want to configure? (available backends 
are ${AVAIL_BACKENDS[*]}): " USE_BACKEND
-       if [[ " ${AVAIL_BACKENDS[*]} " != *" ${USE_BACKEND} "* ]]; then
-               eerror "The '${USE_BACKEND}' backend is not available."
-               return 1
-       fi
-
+       einfo "  Please select what backend you like to use:"
+       for back in $(seq 0 1 $((${#avail_backen...@]} - 1))); do
+               einfo "    [${back}] ${AVAIL_BACKENDS[${back}]}"
+       done
+       einfo
+       while read -n 1 -s -p "  Which backend do you want to configure? " 
USE_BACKEND; do
+               if [ "${USE_BACKEND}" -ge "0" -a "${USE_BACKEND}" -lt 
"${#avail_backen...@]}" ] ; then
+                       USE_BACKEND="${AVAIL_BACKENDS[${USE_BACKEND}]}"
+                       echo
+                       break
+               fi
+       done
        case "${USE_BACKEND}" in

                hash)
@@ -365,7 +424,7 @@
                mysql)
                        local MySQLServer MySQLPort MySQLUser MySQLPass MySQLDb 
MySQLCompress
                        edit_dspam_params MySQLServer MySQLPort MySQLUser 
MySQLPass MySQLDb MySQLCompress || return $?
-                       if [[ -z "${MySQLServer}" || -z "${MySQLUser}" || -z 
"${MySQLPass}" || -z "${MySQLDb}" ]]; then
+                       if [ -z "${MySQLServer}" -o -z "${MySQLUser}" -o -z 
"${MySQLPass}" -o -z "${MySQLDb}" ]; then
                                eerror "Following parameters are required: 
MySQLServer MySQLUser MySQLPass MySQLDb"
                                return 1
                        fi
@@ -378,12 +437,12 @@
                        einfo "    [3] Speed optimized database on a mysql-4.0 
server or below"
                        einfo
                        while read -n 1 -s -p "  Press 0, 1, 2 or 3 on the 
keyboard to select database " MySQL_DB_Type; do
-                               if [[ "${MySQL_DB_Type}" == "0" ]] ; then
+                               if [ "${MySQL_DB_Type}" == "0" ] ; then
                                        echo
                                        set_storage_driver mysql
                                        return 0
                                fi
-                               [[ "${MySQL_DB_Type}" == "1" || 
"${MySQL_DB_Type}" == "2" || "${MySQL_DB_Type}" == "3" ]] && echo && break
+                               [ "${MySQL_DB_Type}" == "1" -o 
"${MySQL_DB_Type}" == "2" -o "${MySQL_DB_Type}" == "3" ] && echo && break
                        done
                        if use virtual-users ; then
                                einfo "  Please select what kind of 
virtual_uids table you like to use:"
@@ -391,20 +450,20 @@
                                einfo "    [2] Virtual users added manually 
(use it if this server is a secondary MX)"
                                einfo
                                while read -n 1 -s -p "  Press 1 or 2 on the 
keyboard to select table type " MySQL_Virtuser_Type; do
-                                       [[ "${MySQL_Virtuser_Type}" == "1" || 
"${MySQL_Virtuser_Type}" == "2" ]] && echo && break
+                                       [ "${MySQL_Virtuser_Type}" == "1" -o 
"${MySQL_Virtuser_Type}" == "2" ] && echo && break
                                done
                        fi

                        local MYSQL_ROOT_USER
                        read -r -p "Your administrative MySQL account (default 
root): " MYSQL_ROOT_USER
-                       if [[ -z "${MYSQL_ROOT_USER}" ]]; then
+                       if [ -z "${MYSQL_ROOT_USER}" ]; then
                                MYSQL_ROOT_USER="root"
                        fi
                        einfo "When prompted for a password, please enter your 
MySQL ${MYSQL_ROOT_USER} password"

                        local MYSQL_CMD_LINE="/usr/bin/mysql -u 
${MYSQL_ROOT_USER} -p"
-                       [[ "${MySQLServer}" != "/"* ]] && 
MYSQL_CMD_LINE="${MYSQL_CMD_LINE} -h ${MySQLServer}"
-                       [[ -n "${MySQLPort}" ]] && 
MYSQL_CMD_LINE="${MYSQL_CMD_LINE} -P ${MySQLPort}"
+                       [ "${MySQLServer:0:1}" != "/" ] && 
MYSQL_CMD_LINE="${MYSQL_CMD_LINE} -h ${MySQLServer}"
+                       [ -n "${MySQLPort}" ] && 
MYSQL_CMD_LINE="${MYSQL_CMD_LINE} -P ${MySQLPort}"
                        {
                                echo "CREATE DATABASE ${MySQLDb};"
                                echo "USE ${MySQLDb};"
@@ -422,7 +481,7 @@
                                echo "GRANT SELECT,INSERT,UPDATE,DELETE ON 
${MySQLDb}.* TO '${MySQLUser}'@'%' IDENTIFIED BY '${MySQLPass}';"
                                echo "FLUSH PRIVILEGES;"
                        } | ${MYSQL_CMD_LINE}
-                       [[ ${PIPESTATUS[1]} == 0 ]] || return ${PIPESTATUS[1]}
+                       [ ${PIPESTATUS[1]} == 0 ] || return ${PIPESTATUS[1]}

                        einfo "MySQL database created successfully"
                        set_storage_driver mysql
@@ -431,7 +490,7 @@
                postgres)
                        local PgSQLServer PgSQLPort PgSQLUser PgSQLPass PgSQLDb
                        edit_dspam_params PgSQLServer PgSQLPort PgSQLUser 
PgSQLPass PgSQLDb || return $?
-                       if [[ -z "${PgSQLServer}" || -z "${PgSQLUser}" || -z 
"${PgSQLPass}" || -z "${PgSQLDb}" ]]; then
+                       if [ -z "${PgSQLServer}" -o -z "${PgSQLUser}" -o -z 
"${PgSQLPass}" -o -z "${PgSQLDb}" ]; then
                                eerror "Following parameters are required: 
PgSQLServer PgSQLUser PgSQLPass PgSQLDb"
                                return 1
                        fi
@@ -439,26 +498,25 @@
                        local PgSQL_DB_Create
                        einfo "  Do you want PgSQL database be automatically 
created for you?"
                        while read -n 1 -s -p "  Press y or n " 
PgSQL_DB_Create; do
-                               if [[ "${PgSQL_DB_Create}" == "n" || 
"${PgSQL_DB_Create}" == "N" ]] ; then
+                               if [ "${PgSQL_DB_Create}" == "n" -o 
"${PgSQL_DB_Create}" == "N" ] ; then
                                        echo
                                        set_storage_driver pgsql
                                        return 0
                                fi
-                               [[ "${PgSQL_DB_Create}" == "y" || 
"${PgSQL_DB_Create}" == "Y" ]] && echo && break
+                               [ "${PgSQL_DB_Create}" == "y" -o 
"${PgSQL_DB_Create}" == "Y" ] && echo && break
                        done

                        local PGSQL_ROOT_USER
                        read -r -p "Your administrative PgSQL account (default 
postgres): " PGSQL_ROOT_USER
-                       if [[ -z "${PGSQL_ROOT_USER}" ]]; then
+                       if [ -z "${PGSQL_ROOT_USER}" ]; then
                                PGSQL_ROOT_USER="postgres"
                        fi
                        einfo "When prompted for a password, please enter your 
PgSQL ${PGSQL_ROOT_USER} password"

-                       if [[ -x /usr/bin/psql ]]; then
+                       if [ -x /usr/bin/psql ]; then
                                # Create database using psql
                                local PGSQL_CMD_LINE="/usr/bin/psql -h 
${PgSQLServer}"
-                               [[ -n "${PgSQLPort}" ]] && 
PGSQL_CMD_LINE="${PGSQL_CMD_LINE} -p ${PgSQLPort}"
-
+                               [ -n "${PgSQLPort}" ] && 
PGSQL_CMD_LINE="${PGSQL_CMD_LINE} -p ${PgSQLPort}"
                                {
                                        echo "\\set ON_ERROR_STOP = on;"
                                        echo "CREATE USER ${PgSQLUser} WITH 
PASSWORD '${PgSQLPass}' NOCREATEDB NOCREATEUSER;"
@@ -471,14 +529,14 @@
                                        echo "CREATE FUNCTION 
plpgsql_validator(oid) RETURNS void AS '\$libdir/plpgsql', 'plpgsql_validator' 
LANGUAGE c;"
                                        echo "CREATE TRUSTED PROCEDURAL 
LANGUAGE plpgsql HANDLER plpgsql_call_handler VALIDATOR plpgsql_validator;"
                                } | ${PGSQL_CMD_LINE} -d template1 -U 
${PGSQL_ROOT_USER}
-                               [[ ${PIPESTATUS[1]} == 0 ]] || return 
${PIPESTATUS[1]}
+                               [ ${PIPESTATUS[1]} == 0 ] || return 
${PIPESTATUS[1]}

                                {
                                        echo "\\set ON_ERROR_STOP = on;"
                                        cat 
"${ROOT}${DSPAM_CONFDIR}"/pgsql_objects.sql
                                        use virtual-users && cat 
"${ROOT}${DSPAM_CONFDIR}"/pgsql_virtual_users.sql
                                } | PGUSER="${PgSQLUser}" 
PGPASSWORD="${PgSQLPass}" ${PGSQL_CMD_LINE} -d "${PgSQLDb}" -U ${PgSQLUser}
-                               [[ ${PIPESTATUS[1]} == 0 ]] || return 
${PIPESTATUS[1]}
+                               [ ${PIPESTATUS[1]} == 0 ] || return 
${PIPESTATUS[1]}
                        else
                                # Create database using psycopg script
                                if use virtual-users ; then
@@ -488,7 +546,7 @@
                                        DSPAM_PgSQLPass="${PgSQLPass}" 
"${ROOT}${DSPAM_CONFDIR}"/pgsql_createdb.py "${PgSQLServer}" "${PgSQLPort}" 
"${PGSQL_ROOT_USER}" \
                                                "${PgSQLUser}" "${PgSQLDb}" 
"${ROOT}${DSPAM_CONFDIR}"/pgsql_objects.sql
                                fi
-                               [[ $? == 0 ]] || return $?
+                               [ ${?} == 0 ] || return $?
                        fi

                        einfo "PgSQL database created successfully"
theia ~ #
----------------


The whole configure part needs to be changed (from my view point). When I did 
the configure part for the stock Gentoo Ebuild (yes. I have written it) then I 
used "[[" for most if statements. That is fine but breaks on ulibc and should 
not be used. It's not needed.

The second issue is the external lookup. While you are right that LDAP queries 
could be substituted with external lookup, it is wrong to have a dependency to 
OpenLDAP for external lookup. The external lookup module could be used WITHOUT 
openldap. In fact I have changed the make file to search for OpenLDAP and 
activate LDAP functionality in external lookup if it finds OpenLDAP.




> --
> Regards,
>       Tom
> 
Steve
-- 
Jetzt kostenlos herunterladen: Internet Explorer 8 und Mozilla Firefox 3.5 -
sicherer, schneller und einfacher! http://portal.gmx.net/de/go/chbrowser

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Dspam-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/dspam-user

Reply via email to