[129347] trunk/dports/mail/sympa

devans at macports.org devans at macports.org
Wed Dec 10 13:22:06 PST 2014


Revision: 129347
          https://trac.macports.org/changeset/129347
Author:   devans at macports.org
Date:     2014-12-10 13:22:06 -0800 (Wed, 10 Dec 2014)
Log Message:
-----------
sympa: address various configuration and dependency issues (#46134, #46135):
    * add variants +sqlite, +postgresql to load dependencies for these databases if desired
    * otherwise load dependencies for MySQL
    * drop the direct dependency on mysql5 and rely on p5-dbd-mysql variant to select the specific version
    * actual database selection and configuration is handled in sympa.conf
    * update configuration options and dependencies
    * correct destroot processing
    * correct startup item specification
    * install apache2 configuration file conf/extra/html-sympa.conf to aid setup
    * defer creation of default configuration files to post-activate
    * only create default configuration files in post-activate if none already exists
    * amplify setup procedure in notes

Modified Paths:
--------------
    trunk/dports/mail/sympa/Portfile

Added Paths:
-----------
    trunk/dports/mail/sympa/files/
    trunk/dports/mail/sympa/files/httpd-sympa.conf
    trunk/dports/mail/sympa/files/patch-src-etc-script-sympa.in.diff
    trunk/dports/mail/sympa/files/patch-src-lib-confdef.pm.diff

Modified: trunk/dports/mail/sympa/Portfile
===================================================================
--- trunk/dports/mail/sympa/Portfile	2014-12-10 20:50:46 UTC (rev 129346)
+++ trunk/dports/mail/sympa/Portfile	2014-12-10 21:22:06 UTC (rev 129347)
@@ -5,6 +5,7 @@
 
 name                sympa
 version             6.1.23
+revision            1
 set branch          [join [lrange [split ${version} .] 0 1] .]
 categories          mail
 license             GPL-2
@@ -25,8 +26,7 @@
 checksums           rmd160  0c65549bc01e154081554a7d9ff8bb11db1d0ccc \
                     sha256  3d15aa8816dafcc4017cc06e52def44d5461498a05e9ef7634498b0993234ae4
 
-depends_lib         path:bin/mysql_config5:mysql5 \
-                    port:apache2 \
+depends_lib         port:apache2 \
                     port:mod_fcgid \
                     port:openssl \
                     port:postfix \
@@ -37,9 +37,9 @@
                     port:p5.16-crypt-ciphersaber \
                     port:p5.16-crypt-openssl-x509 \
                     port:p5.16-data-password \
-                    port:p5.16-dbd-mysql \
                     port:p5.16-dbi \
                     port:p5.16-digest-md5 \
+                    port:p5.16-fcgi \
                     port:p5.16-file-copy-recursive \
                     port:p5.16-html-format \
                     port:p5.16-html-stripscripts-parser \
@@ -66,38 +66,122 @@
                     port:p5.16-unicode-linebreak \
                     port:p5.16-xml-libxml
 
+pre-patch {
+    copy ${filespath}/httpd-sympa.conf ${worksrcpath}
+}
+
+patchfiles          patch-src-etc-script-sympa.in.diff \
+                    patch-src-lib-confdef.pm.diff
+
+post-patch {
+    reinplace "s|__MP_PREFIX__|${prefix}|" \
+                    ${worksrcpath}/httpd-sympa.conf \
+                    ${worksrcpath}/src/lib/confdef.pm
+}
+
 configure.args      --with-perl=${prefix}/bin/perl5.16 \
                     --with-user=www \
                     --with-group=www \
                     --enable-fhs \
-                    --with-aliases_file=${prefix}/etc/${name}/sympa_aliases \
-                    --with-newaliases=${prefix}/bin/newaliases \
-                    --with-postmap=${prefix}/sbin/postmap
+                    --sysconfdir=${prefix}/etc/${name} \
+                    --with-cgidir=${prefix}/www/${name}/cgi \
+                    --with-staticdir=${prefix}/www/${name}/static_content \
+                    --with-aliases_file=${prefix}/etc/${name}/sympa_aliases
 
-# Create a startupitem to start/stop the server
-startupitem.create    yes
-startupitem.start    "${prefix}/share/${name}/sympa"
-startupitem.stop     "${prefix}/share/${name}/sympa"
+# Create a startupitem to start/stop/restart the server processes
 
+startupitem.create  yes
+startupitem.start   "${prefix}/etc/sympa/rc.d/init.d/sympa start"
+startupitem.stop    "${prefix}/etc/sympa/rc.d/init.d/sympa stop"
+startupitem.restart "${prefix}/etc/sympa/rc.d/init.d/sympa restart"
+startupitem.pidfile auto ${prefix}/var/run/${name}/${name}.pid
+
+# Apache2 conf/extra directory violates mtree
+
+destroot.violate_mtree yes
+
+# Keep these empty directories
+
+destroot.keepdirs   ${destroot}${prefix}/var/lib/${name}/arc \
+                    ${destroot}${prefix}/var/lib/${name}/bounce \
+                    ${destroot}${prefix}/var/lib/${name}/list_data \
+                    ${destroot}${prefix}/var/lock/subsys \
+                    ${destroot}${prefix}/var/log/${name} \
+                    ${destroot}${prefix}/var/run/${name} \
+                    ${destroot}${prefix}/var/spool/${name}
+
 post-destroot {
     xinstall -m 644 ${worksrcpath}/INSTALL ${destroot}${prefix}/share/doc/${name}
+    xinstall -d ${destroot}${prefix}/apache2/conf/extra
+    xinstall -m 644 ${worksrcpath}/httpd-sympa.conf ${destroot}${prefix}/apache2/conf/extra
+    delete  ${destroot}${prefix}/etc/sympa/sympa.conf ${destroot}${prefix}/etc/sympa/wwsympa.conf
 }
 
+variant postgresql description {Install optional dependencies for PostgreSQL database support} {
+    depends_lib-append \
+                    port:p5.16-dbd-pg
+}
+
+variant sqlite description {Install optional dependencies for SQLite version 3 database support} {
+    depends_lib-append \
+                    port:p5.16-dbd-sqlite
+}
+
+# if neither postgresql nor sqlite selected default to mysql
+
+if {![variant_isset postgresql] && ![variant_isset sqlite]} {
+    depends_lib-append \
+                    port:p5.16-dbd-mysql
+}
+
+post-activate {
+
+#   create default configuration files if they don't already exist
+
+    foreach cfile "sympa.conf wwsympa.conf" {
+        if {![file exists ${prefix}/etc/sympa/${cfile}]} {
+            system "${prefix}/sbin/sympa_wizard.pl --create ${cfile}"
+        }
+    }
+}
+
 notes "
-You can find documentation at:
+You can find the reference documentation at:
     http://www.sympa.org/manual_${branch}/index
 
 Check that you have all the required perl modules:
-    ${prefix}/sbin/sympa_wizard.pl --check
+    $ ${prefix}/sbin/sympa_wizard.pl --check
 
 First installation:
     Check the INSTALL file:
         ${prefix}/share/doc/sympa/INSTALL
-    Run the wizard to define some required parameters that can't be guessed:
-        ${prefix}/sbin/sympa_wizard.pl
+    Run the wizard to customize the default configuration files
+        $ sudo ${prefix}/sbin/sympa_wizard.pl
+    Create the sympa database and tables using the script for your database at
+        ${prefix}/share/sympa/bin/create_db.*
+    For example, if using MySQL, the appropriate command is
+        $ mysql -u root -p  < ${prefix}/share/sympa/bin/create_db.mysql
+    Create a database user with access to the sympa database. This should
+    match to the parameters db_name, db_host, db_user and db_passwd
+    in ${prefix}/etc/sympa/sympa.conf.
+        $ mysql -u root -p
+        mysql> CREATE USER 'sympa'@'localhost' IDENTIFIED BY 'my_password';
+        mysql> GRANT ALL ON sympa.* TO 'sympa'@'localhost';
+        mysql> FLUSH PRIVILEGES;
+        mysql> quit
+    Add these lines to the end of ${prefix}/apache2/conf/httpd.conf
+        # Include module mod_fcgid
+        Include conf/extra/httpd-fcgid.conf
+        # Include sympa configuration file
+        Include conf/extra/httpd-sympa.conf
+    You should then restart apache2 to enable mod_fcgid and the sympa web interface
+        $ sudo port unload apache2
+        $ sudo port load apache2
+    Start the sympa daemons now and at startup
+        $ sudo port load sympa
 
-Upgrading:
-    Run this script to upgrade your data structures:
+Upgrading to a new version:
+    Run this script to upgrade your existing data structures:
         ${prefix}/sbin/sympa.pl --upgrade
 "
 

Added: trunk/dports/mail/sympa/files/httpd-sympa.conf
===================================================================
--- trunk/dports/mail/sympa/files/httpd-sympa.conf	                        (rev 0)
+++ trunk/dports/mail/sympa/files/httpd-sympa.conf	2014-12-10 21:22:06 UTC (rev 129347)
@@ -0,0 +1,13 @@
+Alias /static-sympa __MP_PREFIX__/www/sympa/static_content
+ScriptAlias /sympa __MP_PREFIX__/www/sympa/cgi/wwsympa-wrapper.fcgi
+
+<Directory "__MP_PREFIX__/www/sympa/">
+    AllowOverride None
+    Options None
+    Order allow,deny
+    Allow from all
+</Directory>
+
+<IfModule mod_fcgid.c>
+    AddHandler fcgid-script .fcgi
+</IfModule>

Added: trunk/dports/mail/sympa/files/patch-src-etc-script-sympa.in.diff
===================================================================
--- trunk/dports/mail/sympa/files/patch-src-etc-script-sympa.in.diff	                        (rev 0)
+++ trunk/dports/mail/sympa/files/patch-src-etc-script-sympa.in.diff	2014-12-10 21:22:06 UTC (rev 129347)
@@ -0,0 +1,66 @@
+--- src/etc/script/sympa.in.orig	2010-11-16 23:25:42.000000000 -0800
++++ src/etc/script/sympa.in	2014-12-09 00:04:38.000000000 -0800
+@@ -33,10 +33,14 @@
+ fi
+ 
+ # OSTYPE *is* defined on Solaris 10! (bug #3149)
++# OSTYPE has many variants on darwin platforms
+ case "$OSTYPE" in
+         *solaris*)
+         OSTYPE=SunOS
+         ;;
++        *darwin*)
++	OSTYPE=darwin
++        ;;
+ esac
+ 
+ if [ -f /etc/SuSE-release ] ; then
+@@ -59,8 +63,8 @@
+ sympaconf="--CONFIG--"
+ wwsympaconf="--WWSCONFIG--"
+ 
+-##'echo -n' not supported with SH on Solaris
+-if [ ${OSTYPE} = "SunOS" ]; then
++##'echo -n' not supported with SH on Solaris or darwin
++if [ "${OSTYPE}" = "SunOS" -o "${OSTYPE}" = "darwin"  ]; then
+   echo_opt=""
+ else
+   echo_opt="-n"
+@@ -159,7 +163,7 @@
+ 	if [ "$pids" != "" ]; then
+ 	    for pid in $pids; do
+ 		killcount=0
+-		running=`ps -A | grep "$pid ..* $1\\.pl"`
++		running=`ps -A | grep "$pid.*$1\\.pl"`
+ 		while [ "$running" != "" ]; do
+ 		    if [ $killcount -gt 10 ]; then
+ 			if [ ${use_functions} ]; then
+@@ -171,13 +175,13 @@
+ 		    fi
+ 
+ 		    kill -TERM $pid >/dev/null 2>&1
+-		    running=`ps -A | grep "$pid ..* $1\\.pl"`
++		    running=`ps -A | grep "$pid.*$1\\.pl"`
+ 		    if [ "$running" = "" ]; then
+ 			runcount=`expr $runcount + 1`
+ 			break
+ 		    fi
+ 		    sleep 2
+-		    running=`ps -A | grep "$pid ..* $1\\.pl"`
++		    running=`ps -A | grep "$pid.*$1\\.pl"`
+ 		    if [ "$running" = "" ]; then
+ 			runcount=`expr $runcount + 1`
+ 			break
+@@ -204,8 +208,10 @@
+ 
+ 
+ # Check that networking is up.
+-if [ ${OSTYPE} != "Slack" -a ${OSTYPE} != "FreeBSD" -a ${OSTYPE} != "SunOS" -a ${OSTYPE} != "darwin7.0" -a ${OSTYPE} != "Debian" -a ${OSTYPE} != "Suse" ]; then
+-    if [ ${NETWORKING} = "no" ]
++# NETWORKING is not defined on any darwin platforms
++# Just in case fix 'expected unary operator' error if $NETWORKING is null
++if [ ${OSTYPE} != "Slack" -a ${OSTYPE} != "FreeBSD" -a ${OSTYPE} != "SunOS" -a ${OSTYPE} != "darwin" -a ${OSTYPE} != "Debian" -a ${OSTYPE} != "Suse" ]; then
++    if [ "${NETWORKING}" = "no" ]
+     then
+ 	    exit 0
+     fi

Added: trunk/dports/mail/sympa/files/patch-src-lib-confdef.pm.diff
===================================================================
--- trunk/dports/mail/sympa/files/patch-src-lib-confdef.pm.diff	                        (rev 0)
+++ trunk/dports/mail/sympa/files/patch-src-lib-confdef.pm.diff	2014-12-10 21:22:06 UTC (rev 129347)
@@ -0,0 +1,38 @@
+--- src/lib/confdef.pm.orig	2014-09-10 07:08:55.000000000 -0700
++++ src/lib/confdef.pm	2014-12-10 11:43:03.000000000 -0800
+@@ -459,7 +459,7 @@
+ 
+     {
+         'name'    => 'sendmail',
+-        'default' => '/usr/sbin/sendmail',
++        'default' => '__MP_PREFIX__/sbin/sendmail',
+         'query'   => 'Path to the MTA (sendmail, postfix, exim or qmail)',
+         'file'    => 'sympa.conf',
+         'edit'    => '1',
+@@ -1203,7 +1203,7 @@
+ 
+     {
+         'name'   => 'openssl',
+-        'sample' => '/usr/bin/ssl',
++        'sample' => '__MP_PREFIX__/bin/openssl',
+         'query'  => 'Path to OpenSSL',
+         'file'   => 'sympa.conf',
+         'edit'   => '1',
+@@ -1221,7 +1221,7 @@
+     },
+     {
+         'name'   => 'cafile',
+-        'sample' => '/usr/local/apache/conf/ssl.crt/ca-bundle.crt',
++        'sample' => '/__MP_PREFIX__/apache2/conf/ssl.crt/ca-bundle.crt',
+         'query'  => 'File containing bundled trusted CA certificates',
+         'file'   => 'sympa.conf',
+         'edit'   => '1',
+@@ -1481,7 +1481,7 @@
+     },
+     {
+         'name'    => 'mhonarc',
+-        'default' => '/usr/bin/mhonarc',
++        'default' => '__MP_PREFIX__/bin/mhonarc',
+         'query'   => 'Path to MHonArc mail2html plugin',
+         'file'    => 'wwsympa.conf',
+         'edit'    => '1',
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/macports-changes/attachments/20141210/553ee814/attachment.html>


More information about the macports-changes mailing list