[Pkg-mailman-hackers] Pkg-mailman commit - rev 105 - in branches/pkg-split/core/debian: . Debian

Bernd S. Brentrup bsb@haydn.debian.org
Mon, 03 May 2004 02:03:03 -0600


Author: bsb
Date: 2004-05-03 02:02:55 -0600 (Mon, 03 May 2004)
New Revision: 105

Added:
   branches/pkg-split/core/debian/Debian/templates.py
Removed:
   branches/pkg-split/core/debian/mm_cfg.py
Modified:
   branches/pkg-split/core/debian/Debian/__init__.py
   branches/pkg-split/core/debian/config
   branches/pkg-split/core/debian/links
   branches/pkg-split/core/debian/postinst
Log:
Generate mm_cfg.py from strings in Mailman.Debian.
TBD: update existing mm_cfg.py on upgrade.

Modified: branches/pkg-split/core/debian/Debian/__init__.py
===================================================================
--- branches/pkg-split/core/debian/Debian/__init__.py	2004-05-02 14:58:34 UTC (rev 104)
+++ branches/pkg-split/core/debian/Debian/__init__.py	2004-05-03 08:02:55 UTC (rev 105)
@@ -2,6 +2,7 @@
 # $Id$
 
 from helpers import *
+from templates import mm_cfg_defaults, mm_cfg_fillin
 
 __all__ = [ 'SimpleLogger',
             'DebuggingLogger',

Added: branches/pkg-split/core/debian/Debian/templates.py
===================================================================
--- branches/pkg-split/core/debian/Debian/templates.py	2004-05-02 14:58:34 UTC (rev 104)
+++ branches/pkg-split/core/debian/Debian/templates.py	2004-05-03 08:02:55 UTC (rev 105)
@@ -0,0 +1,115 @@
+# -*- python -*-
+# $URL$
+# $Id$
+mm_cfg_defaults = '''\
+#
+# Copyright (C) 1998,1999,2000 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+
+"""This is the module which takes your site-specific settings.
+
+From a raw distribution it should be copied to mm_cfg.py.  If you
+already have an mm_cfg.py, be careful to add in only the new settings
+you want.  The complete set of distributed defaults, with annotation,
+are in /var/lib/mailman/Mailman/Defaults.py.  In mm_cfg, override only
+those you want to change, after the
+
+  from Defaults import *
+
+line (see below).
+
+Note that these are just default settings - many can be overridden via the
+admin and user interfaces on a per-list or per-user basis.
+
+Note also that some of the settings are resolved against the active list
+setting by using the value as a format string against the
+list-instance-object's dictionary - see the distributed value of
+DEFAULT_MSG_FOOTER for an example."""
+
+
+#######################################################
+#    Here's where we get the distributed defaults.    #
+
+from Defaults import *
+
+'''
+
+mm_cfg_fillin = '''\
+##############################################################
+# Put YOUR site-specific configuration below, in mm_cfg.py . #
+# See Defaults.py for explanations of the values.            #
+
+#-------------------------------------------------------------
+# The name of the list Mailman uses to send password reminders
+# and similar. Don't change if you want mailman-owner to be
+# a valid local part.
+MAILMAN_SITE_LIST = %(MAILMAN_SITE_LIST)r
+
+#-------------------------------------------------------------
+# If you change these, you have to configure your http server
+# accordingly (Alias and ScriptAlias directives in most httpds)
+DEFAULT_URL_PATTERN = %(DEFAULT_URL_PATTERN)r
+# For logos on MM web pages, add this to your httpd config:
+#   Alias %(IMAGE_LOGOS)s /usr/share/images/mailman/
+IMAGE_LOGOS         = %(IMAGE_LOGOS)r
+
+#-------------------------------------------------------------
+# Default host for web interface of newly created MLs
+DEFAULT_URL_HOST   = %(DEFAULT_URL_HOST)r
+#-------------------------------------------------------------
+# Default domain for email addresses of newly created MLs
+DEFAULT_EMAIL_HOST = %(DEFAULT_EMAIL_HOST)r
+#-------------------------------------------------------------
+# Required when setting any of its arguments.
+add_virtualhost(DEFAULT_URL_HOST, DEFAULT_EMAIL_HOST)
+
+#-------------------------------------------------------------
+# The default language for this server (may be changed to a
+# supported language when mailman-i18n is installed).
+DEFAULT_SERVER_LANGUAGE = %(DEFAULT_SERVER_LANGUAGE)r
+
+#-------------------------------------------------------------
+# Don't use address from envelope instead of from headers when
+# determining if a message comes from a list member.
+USE_ENVELOPE_SENDER    = %(USE_ENVELOPE_SENDER)r
+
+#-------------------------------------------------------------
+# By default don't send monthly password reminders for newly
+# created lists.
+DEFAULT_SEND_REMINDERS = %(DEFAULT_SEND_REMINDERS)r
+
+#-------------------------------------------------------------
+# Uncomment this if you configured your MTA such that it
+# automatically recognizes newly created lists.
+# (see /usr/share/doc/mailman/README.{EXIM,...})
+# MTA=None   # Misnomer, suppresses alias output on newlist
+
+#-------------------------------------------------------------
+# Uncomment if you use Postfix virtual domains, but be sure to
+# read /usr/share/doc/mailman/README.POSTFIX first.
+# MTA='Postfix'
+
+# Note - if you're looking for something that is imported from mm_cfg, but you
+# didn't find it above, it's probably in /usr/lib/mailman/Mailman/Defaults.py.
+
+#-------------------------------------------------------------
+# Local settings not managed by Debian maintainer scripts. 
+# only variables not mentioned above are preserved on package
+# upgrade. If you define variables mentioned above here,
+# the last setting here will be used above and occurrences
+# below are removed.
+'''


Property changes on: branches/pkg-split/core/debian/Debian/templates.py
___________________________________________________________________
Name: svn:keywords
   + Id URL

Modified: branches/pkg-split/core/debian/config
===================================================================
--- branches/pkg-split/core/debian/config	2004-05-02 14:58:34 UTC (rev 104)
+++ branches/pkg-split/core/debian/config	2004-05-03 08:02:55 UTC (rev 105)
@@ -60,7 +60,7 @@
     try:
         from Mailman.Utils import list_exists
         return list_exists(listname)
-    except ImportError:
+    except:
         list_dir = os.path.join(mm_lists, listname)
         return os.path.isdir(list_dir)
 
@@ -88,7 +88,7 @@
     mailname = mailname.read().strip()
 
     if os.path.exists(mm_cfg):
-        for line in os.popen('egrep "^DEFAULT_[^ ]+ =" %(mm_cfg)s' % locals()):
+        for line in os.popen('egrep "^DEFAULT_[^ =]+ *=" %(mm_cfg)s' % locals()):
             exec line in gbls
     default_email_host      = gbls.get('DEFAULT_EMAIL_HOST', mailname)
     default_url_host        = gbls.get('DEFAULT_URL_HOST', '')
@@ -97,6 +97,8 @@
     db.set('mailman/email_host', default_email_host)
     db_input(MEDIUM, 'mailman/email_host')
 
+    if not default_url_host:
+        default_url_host = 'www.' + default_email_host
     db.set('mailman/url_host',   default_url_host)
     db_input(MEDIUM, 'mailman/url_host')
 

Modified: branches/pkg-split/core/debian/links
===================================================================
--- branches/pkg-split/core/debian/links	2004-05-02 14:58:34 UTC (rev 104)
+++ branches/pkg-split/core/debian/links	2004-05-03 08:02:55 UTC (rev 105)
@@ -210,6 +210,7 @@
 var/lib/mailman/.INST/Mailman/versions.py  var/lib/mailman/Mailman/versions.py
 var/lib/mailman/.INST/Mailman/Debian/__init__.py  var/lib/mailman/Mailman/Debian/__init__.py
 var/lib/mailman/.INST/Mailman/Debian/helpers.py  var/lib/mailman/Mailman/Debian/helpers.py
+var/lib/mailman/.INST/Mailman/Debian/templates.py  var/lib/mailman/Mailman/Debian/templates.py
 var/lib/mailman/.INST/cron/crontab.in  var/lib/mailman/cron/crontab.in
 var/lib/mailman/.INST/cron/checkdbs  var/lib/mailman/cron/checkdbs
 var/lib/mailman/.INST/cron/mailpasswds  var/lib/mailman/cron/mailpasswds

Deleted: branches/pkg-split/core/debian/mm_cfg.py
===================================================================
--- branches/pkg-split/core/debian/mm_cfg.py	2004-05-02 14:58:34 UTC (rev 104)
+++ branches/pkg-split/core/debian/mm_cfg.py	2004-05-03 08:02:55 UTC (rev 105)
@@ -1,97 +0,0 @@
-# -*- python -*-
-
-# Copyright (C) 1998,1999,2000 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-
-"""This is the module which takes your site-specific settings.
-
-From a raw distribution it should be copied to mm_cfg.py.  If you
-already have an mm_cfg.py, be careful to add in only the new settings
-you want.  The complete set of distributed defaults, with annotation,
-are in ./Defaults.  In mm_cfg, override only those you want to
-change, after the
-
-  from Defaults import *
-
-line (see below).
-
-Note that these are just default settings - many can be overridden via the
-admin and user interfaces on a per-list or per-user basis.
-
-Note also that some of the settings are resolved against the active list
-setting by using the value as a format string against the
-list-instance-object's dictionary - see the distributed value of
-DEFAULT_MSG_FOOTER for an example."""
-
-
-#######################################################
-#    Here's where we get the distributed defaults.    #
-
-from Defaults import *
-
-##############################################################
-# Put YOUR site-specific configuration below, in mm_cfg.py . #
-# See Defaults.py for explanations of the values.            #
-
-#-------------------------------------------------------------
-# The name of the list Mailman uses to send password reminders
-# and similar. Don't change if you want mailman-owner to be
-# a valid local part.
-MAILMAN_SITE_LIST = 'mailman'
-
-#-------------------------------------------------------------
-# If you change these, you have to configure your http server
-# accordingly (Alias and ScriptAlias directives in most httpds)
-DEFAULT_URL_PATTERN = 'http://%s/cgi-bin/mailman'
-PRIVATE_ARCHIVE_URL = '/cgi-bin/mailman/private'
-IMAGE_LOGOS         = '/images/mailman/'
-
-#-------------------------------------------------------------
-# Default domain for email addresses of newly created MLs
-DEFAULT_EMAIL_HOST = 'thunderchild.aszi.sztaki.hu'
-#-------------------------------------------------------------
-# Default host for web interface of newly created MLs
-DEFAULT_URL_HOST   = 'thunderchild.aszi.sztaki.hu'
-#-------------------------------------------------------------
-# Required when setting any of its arguments.
-add_virtualhost(DEFAULT_URL_HOST, DEFAULT_EMAIL_HOST)
-
-#-------------------------------------------------------------
-# The default language for this server.
-DEFAULT_SERVER_LANGUAGE = 'en'
-
-#-------------------------------------------------------------
-# Iirc this was used in pre 2.1, leave it for now
-USE_ENVELOPE_SENDER    = 0              # Still used?
-
-#-------------------------------------------------------------
-# Unset send_reminders on newly created lists
-DEFAULT_SEND_REMINDERS = 0
-
-#-------------------------------------------------------------
-# Uncomment this if you configured your MTA such that it
-# automatically recognizes newly created lists.
-# (see /usr/share/doc/mailman/README.{EXIM,...})
-# MTA=None   # Misnomer, suppresses alias output on newlist
-
-#-------------------------------------------------------------
-# Uncomment if you use Postfix virtual domains, but be sure to
-# read /usr/share/doc/mailman/README.POSTFIX first.
-# MTA='Postfix'
-
-# Note - if you're looking for something that is imported from mm_cfg, but you
-# didn't find it above, it's probably in /usr/lib/mailman/Mailman/Defaults.py.

Modified: branches/pkg-split/core/debian/postinst
===================================================================
--- branches/pkg-split/core/debian/postinst	2004-05-02 14:58:34 UTC (rev 104)
+++ branches/pkg-split/core/debian/postinst	2004-05-03 08:02:55 UTC (rev 105)
@@ -30,13 +30,13 @@
 
 MM_HOME = '/var/lib/mailman'
 
-sys.path[0] = MM_HOME
+sys.path.insert(0, MM_HOME)
 
 from Mailman.Debian import DebuggingLogger, CommandRunner
 
 MM_BIN  = os.path.join(MM_HOME, 'bin')
+MM_INST = '/usr/share/mailman'
 
-
 def compile_modules(directory):
     """Compiles all python modules in the specified directory.
 
@@ -58,11 +58,30 @@
     log(' done.')
 
 def create_mm_cfg():
+    """Create an initial /etc/mailman/mm_cfg.py
+
+    This works only for a first time install.
+    """#
     try:
-        db_email_host = db.get('mailman/email_host')
-        log('DEBCONF email_host=%(db_email_host)r' % locals(), lvl=2)
-        db_url_host   = db.get('mailman/url_host')
-        log('DEBCONF url_host=%(db_url_host)r' % locals(), lvl=2)
+        gbls = globals().copy()
+
+        from Mailman.Debian import mm_cfg_defaults, mm_cfg_fillin
+        mm_cfg_fl = open('/etc/mailman/mm_cfg.py', 'w')
+        # Writing a constant prefix (including the import from Defaults)
+        # beforehand makes sure there is a formally working mm_cfg.
+        mm_cfg_fl.write(mm_cfg_defaults)
+        mm_cfg_fl.flush()
+
+        exec 'from Mailman.Defaults import *' in gbls
+
+        email_host = db.get('mailman/email_host')
+        gbls['DEFAULT_EMAIL_HOST'] = email_host
+        log('DEBCONF email_host=%(DEFAULT_EMAIL_HOST)r' % gbls, lvl=2)
+        url_host = db.get('mailman/url_host') or 'www.'+email_host
+        gbls['DEFAULT_URL_HOST']   = url_host
+        log('DEBCONF url_host=%(DEFAULT_URL_HOST)r' % gbls, lvl=2)
+        mm_cfg_fl.write(mm_cfg_fillin % gbls)
+        mm_cfg_fl.close()
     except DebconfError, exc:
         log.exception()