[evolvis-commits] r6673: merge bm:taramir/patches/mailman-urls

Thorsten Glaser t.glaser at tarent.de
Wed Jun 2 16:42:28 CEST 2010


Author: Thorsten Glaser <t.glaser at tarent.de>
Date: 2010-06-02 16:42:27 +0200 (Wed, 02 Jun 2010)
New Revision: 6673

Added:
   trunk/gforge_base/evolvisforge/gforge/deb-specific/fix_url2.py
   trunk/gforge_base/evolvisforge/gforge/debian/gforge-lists-mailman.postrm
Modified:
   trunk/gforge_base/evolvisforge/gforge/deb-specific/create-mailing-lists.pl
   trunk/gforge_base/evolvisforge/gforge/deb-specific/fix-mailing-lists.pl
   trunk/gforge_base/evolvisforge/gforge/debian/changelog
   trunk/gforge_base/evolvisforge/gforge/debian/gforge-lists-mailman.postinst
   trunk/gforge_base/evolvisforge/gforge/etc/templates/local.pl
   trunk/gforge_base/evolvisforge/gforge/install/lists-mailman
Log:
merge bm:taramir/patches/mailman-urls

Modified: trunk/gforge_base/evolvisforge/gforge/deb-specific/create-mailing-lists.pl
===================================================================
--- trunk/gforge_base/evolvisforge/gforge/deb-specific/create-mailing-lists.pl	2010-06-02 14:42:23 UTC (rev 6672)
+++ trunk/gforge_base/evolvisforge/gforge/deb-specific/create-mailing-lists.pl	2010-06-02 14:42:27 UTC (rev 6673)
@@ -19,6 +19,13 @@
 require ("/usr/share/gforge/lib/include.pl") ; # Include all the predefined functions 
 require ("/etc/gforge/local.pl") ;
 
+my $urlpattern;
+if ($sys_use_ssl eq 'true') {
+	$urlpattern = 'https://%s/cgi-bin/mailman/';
+} else {
+	$urlpattern = 'http://%s/cgi-bin/mailman/';
+}
+
 &db_connect ;
 
 $dbh->{AutoCommit} = 0;
@@ -86,7 +93,7 @@
 	system ($cmd) ;
 	unlink $tmp ;
 
-	$cmd= "/usr/lib/mailman/bin/withlist -l -r fix_url $listname -u $sys_lists_host" ;
+	$cmd= "/usr/lib/mailman/bin/withlist -l -r fix_url2 $listname -u $sys_lists_host -p '$urlpattern'" ;
 	#print "cmd = <$cmd>\n" ;
 	system ($cmd) ;
 

Modified: trunk/gforge_base/evolvisforge/gforge/deb-specific/fix-mailing-lists.pl
===================================================================
--- trunk/gforge_base/evolvisforge/gforge/deb-specific/fix-mailing-lists.pl	2010-06-02 14:42:23 UTC (rev 6672)
+++ trunk/gforge_base/evolvisforge/gforge/deb-specific/fix-mailing-lists.pl	2010-06-02 14:42:27 UTC (rev 6673)
@@ -17,6 +17,13 @@
 require ("/etc/gforge/local.pl") ;
 require("/usr/share/gforge/lib/include.pl");  # Include all the predefined functions
 
+my $urlpattern;
+if ($sys_use_ssl eq 'true') {
+	$urlpattern = 'https://%s/cgi-bin/mailman/';
+} else {
+	$urlpattern = 'http://%s/cgi-bin/mailman/';
+}
+
 &db_connect ;
 
 $dbh->{AutoCommit} = 0;
@@ -60,7 +67,7 @@
 	system ($cmd) ;
 	unlink $tmp ;
 
-	$cmd= "/usr/lib/mailman/bin/withlist -l -r fix_url $listname -u $sys_lists_host" ;
+	$cmd= "/usr/lib/mailman/bin/withlist -l -r fix_url2 $listname -u $sys_lists_host -p '$urlpattern'" ;
 	#print "cmd = <$cmd>\n" ;
 	system ($cmd) ;
 

Added: trunk/gforge_base/evolvisforge/gforge/deb-specific/fix_url2.py
===================================================================
--- trunk/gforge_base/evolvisforge/gforge/deb-specific/fix_url2.py	                        (rev 0)
+++ trunk/gforge_base/evolvisforge/gforge/deb-specific/fix_url2.py	2010-06-02 14:42:27 UTC (rev 6673)
@@ -0,0 +1,101 @@
+#! /usr/bin/python
+#
+# Copyright (C) 2001,2002 by the Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software 
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+"""Reset a list's web_page_url attribute to the default setting.
+
+This script is intended to be run as a bin/withlist script, i.e.
+
+% bin/withlist -l -r fix_url2 listname [options]
+
+Options:
+    -p pattern
+    --pattern=pattern
+        Set the URL pattern to be used instead of DEFAULT_URL_PATTERN
+
+    -u urlhost
+    --urlhost=urlhost
+        Look up urlhost in the virtual host table and set the web_page_url and
+        host_name attributes of the list to the values found.  This
+        essentially moves the list from one virtual domain to another.
+
+        Without this option, the default web_page_url and host_name values are
+        used.
+
+    -v / --verbose
+        Print what the script is doing.
+
+If run standalone, it prints this help text and exits.
+"""
+
+import sys
+import getopt
+
+import paths
+from Mailman import mm_cfg
+from Mailman.i18n import _
+
+
+
+def usage(code, msg=''):
+    print _(__doc__.replace('%', '%%'))
+    if msg:
+        print msg
+    sys.exit(code)
+
+
+
+def fix_url2(mlist, *args):
+    try:
+        opts, args = getopt.getopt(args, 'p:u:v', ['pattern=', 'urlhost=', 'verbose'])
+    except getopt.error, msg:
+        usage(1, msg)
+
+    verbose = 0
+    urlhost = mailhost = urlpattern = None
+    for opt, arg in opts:
+        if opt in ('-u', '--urlhost'):
+            urlhost = arg
+        elif opt in ('-p', '--pattern'):
+            urlpattern = arg
+        elif opt in ('-v', '--verbose'):
+            verbose = 1
+
+    if not urlpattern:
+        urlpattern = mm_cfg.DEFAULT_URL_PATTERN
+
+    if urlhost:
+        web_page_url = urlpattern % urlhost
+        mailhost = mm_cfg.VIRTUAL_HOSTS.get(urlhost.lower(), urlhost)
+    else:
+        web_page_url = urlpattern % mm_cfg.DEFAULT_URL_HOST
+        mailhost = mm_cfg.DEFAULT_EMAIL_HOST
+
+    if verbose:
+        print _('Setting web_page_url to: %(web_page_url)s')
+    mlist.web_page_url = web_page_url
+    if verbose:
+        print _('Setting host_name to: %(mailhost)s')
+    mlist.host_name = mailhost
+    print _('Saving list')
+    mlist.Save()
+    mlist.Unlock()
+
+
+
+if __name__ == '__main__':
+    usage(0)


Property changes on: trunk/gforge_base/evolvisforge/gforge/deb-specific/fix_url2.py
___________________________________________________________________
Added: svn:executable
   + *

Modified: trunk/gforge_base/evolvisforge/gforge/debian/changelog
===================================================================
--- trunk/gforge_base/evolvisforge/gforge/debian/changelog	2010-06-02 14:42:23 UTC (rev 6672)
+++ trunk/gforge_base/evolvisforge/gforge/debian/changelog	2010-06-02 14:42:27 UTC (rev 6673)
@@ -10,8 +10,10 @@
     permit easier overrides (especially to add HTTP Basic Auth)
   * Display the forge flavour and version on the website
   * Display estimated maximum file size for HTTP uploads in QRS
+  * Set Mailman URIs for pipermail and in-situ to use https if
+    sys_use_ssl, keep them at http otherwise
 
- -- Thorsten Glaser <t.glaser at tarent.de>  Wed, 02 Jun 2010 12:30:01 +0200
+ -- Thorsten Glaser <t.glaser at tarent.de>  Wed, 02 Jun 2010 12:31:22 +0200
 
 gforge (4.8.3+evolvis16) unstable; urgency=low
 

Modified: trunk/gforge_base/evolvisforge/gforge/debian/gforge-lists-mailman.postinst
===================================================================
--- trunk/gforge_base/evolvisforge/gforge/debian/gforge-lists-mailman.postinst	2010-06-02 14:42:23 UTC (rev 6672)
+++ trunk/gforge_base/evolvisforge/gforge/debian/gforge-lists-mailman.postinst	2010-06-02 14:42:27 UTC (rev 6673)
@@ -29,8 +29,24 @@
     configure)
 	gforge-config
 	
-	echo "Fixing past damage in mailing-lists..."
+	# Adjust pipermail links to use https if sys_use_ssl,
+	# http (default) otherwise
+	proto=$(php -r 'require "/etc/gforge/local.inc"; echo $sys_use_ssl ? "https" : "http";')
+	pau=$proto'://%(hostname)s/pipermail/%(listname)s/'
+	sed -e '/BEGIN FUSIONFORGE BLOCK/,/END FUSIONFORGE BLOCK/d' \
+	    </etc/mailman/mm_cfg.py >/var/lib/gforge/tmp/mm_cfg.py
+	if grep '^PUBLIC_ARCHIVE_URL' /var/lib/gforge/tmp/mm_cfg.py >/dev/null 2>&1; then
+		echo "Please fix PUBLIC_ARCHIVE_URL in /etc/mailman/mm_cfg.py yourself!"
+	else
+		echo '### BEGIN FUSIONFORGE BLOCK' >>/var/lib/gforge/tmp/mm_cfg.py
+		echo "PUBLIC_ARCHIVE_URL = '$pau'" >>/var/lib/gforge/tmp/mm_cfg.py
+		echo '### END FUSIONFORGE BLOCK' >>/var/lib/gforge/tmp/mm_cfg.py
+		cat /var/lib/gforge/tmp/mm_cfg.py >/etc/mailman/mm_cfg.py
+	fi
+	rm -f /var/lib/gforge/tmp/mm_cfg.py
+
 	if [ -z "$2" ] || dpkg --compare-versions $2 le 3rc2-4 ; then
+	    echo "Fixing past damage in mailing-lists..."
 	    su -s /bin/sh gforge -c /usr/share/gforge/bin/fix-mailing-lists.pl
 	fi
     ;;

Added: trunk/gforge_base/evolvisforge/gforge/debian/gforge-lists-mailman.postrm
===================================================================
--- trunk/gforge_base/evolvisforge/gforge/debian/gforge-lists-mailman.postrm	                        (rev 0)
+++ trunk/gforge_base/evolvisforge/gforge/debian/gforge-lists-mailman.postrm	2010-06-02 14:42:27 UTC (rev 6673)
@@ -0,0 +1,15 @@
+#! /bin/sh
+# postrm script for gforge
+#
+# see: dh_installdeb(1)
+
+set -e
+
+rm -f /usr/lib/mailman/bin/fix_url2.pyc
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+exit 0

Modified: trunk/gforge_base/evolvisforge/gforge/etc/templates/local.pl
===================================================================
--- trunk/gforge_base/evolvisforge/gforge/etc/templates/local.pl	2010-06-02 14:42:23 UTC (rev 6672)
+++ trunk/gforge_base/evolvisforge/gforge/etc/templates/local.pl	2010-06-02 14:42:27 UTC (rev 6673)
@@ -7,6 +7,7 @@
 $sys_users_host = '{users_host}' ;
 $sys_docs_host = '{domain_name}' ;
 $sys_lists_host = '{lists_host}' ;
+$sys_use_ssl = '{sys_use_ssl}' ;
 $sys_dns1_host = 'ns1.{domain_name}' ;
 $sys_dns2_host = 'ns2.{domain_name}' ;
 $FTPINCOMING_DIR = '/usr/share/gforge/ftp/incoming' ;

Modified: trunk/gforge_base/evolvisforge/gforge/install/lists-mailman
===================================================================
--- trunk/gforge_base/evolvisforge/gforge/install/lists-mailman	2010-06-02 14:42:23 UTC (rev 6672)
+++ trunk/gforge_base/evolvisforge/gforge/install/lists-mailman	2010-06-02 14:42:27 UTC (rev 6673)
@@ -1,2 +1,3 @@
 deb-specific/create-mailing-lists.pl usr/share/gforge/bin/
 deb-specific/fix-mailing-lists.pl    usr/share/gforge/bin/
+deb-specific/fix_url2.py             usr/lib/mailman/bin/




More information about the evolvis-commits mailing list