[mirrorbrain-commits] r8145 - in /trunk/mb: mb.py mb/exports.py

From: <poeml_at_mirrorbrain.org>
Date: Sun, 19 Sep 2010 03:25:12 -0000
Author: poeml
Date: Sun Sep 19 05:25:10 2010
New Revision: 8145

URL: http://svn.mirrorbrain.org/viewvc/mirrorbrain?rev=8145&view=rev
Log:
mb export --format=mirmon:
- Exporting a mirror list for mirmon has been adjusted to the default in
  mirmon-2.3, which is configured with list_style=plain. The other format
  (list_style=apache) can also be generated, if mb export is used with
  --format=mirmon-apache. This fixes issue #62.

Modified:
    trunk/mb/mb.py
    trunk/mb/mb/exports.py

Modified: trunk/mb/mb.py
URL: http://svn.mirrorbrain.org/viewvc/mirrorbrain/trunk/mb/mb.py?rev=8145&r1=8144&r2=8145&view=diff
==============================================================================
--- trunk/mb/mb.py (original)
+++ trunk/mb/mb.py Sun Sep 19 05:25:10 2010
_at_@ -1485,7 +1485,7 @@
     _at_cmdln.option('--target-dir', metavar='PATH',
                   help='For the "vcs" output format, specify a target directory to place files into')
     _at_cmdln.option('--format', metavar='FORMAT',
-            help='Specify the output format: [django|postgresql|mirmon|vcs]')
+            help='Specify the output format: [django|postgresql|mirmon|mirmon-apache|vcs]')
     def do_export(self, subcmd, opts, *args):
         """${cmd_name}: export the mirror list as text file
 
_at_@ -1497,7 +1497,8 @@
         database.
 
         Format "mirmon" creates a list of mirrors to be included in a mirmon
-        configuration.
+        configuration. "mirmon-apache" uses a different format, used when
+        mirmon is configured with its option "list_style = apache".
 
         Format "vcs" generates a file tree which can be imported/committed into
         a version control system (VCS). This can be used to periodically dump
_at_@ -1535,7 +1536,7 @@
         elif opts.format == 'postgresql':
             print mb.exports.postgresql_header
 
-        elif opts.format == 'mirmon':
+        elif opts.format in ['mirmon', 'mirmon-apache']:
             pass
 
         elif opts.format == 'vcs':
_at_@ -1576,14 +1577,19 @@
             elif opts.format == 'postgresql':
                 print mb.exports.postgresql_template % d
 
-            elif opts.format == 'mirmon':
+            elif opts.format in ['mirmon', 'mirmon-apache']:
+                if opts.format == 'mirmon':
+                    mirmon_template = mb.exports.mirmon_template
+                elif opts.format == 'mirmon-apache':
+                    mirmon_template = mb.exports.mirmon_apache_template
+
                 if not m.enabled:
                     continue
                 for proto, urlname in [('http', 'baseurl'), 
                                        ('ftp', 'baseurlFtp'),
                                        ('rsync', 'baseurlRsync')]:
                     if d[urlname]:
-                        print mb.exports.mirmon_template \
+                        print mirmon_template \
                                 % dict(proto=proto, 
                                        url=d[urlname], 
                                        adminEmail=d['adminEmail'],

Modified: trunk/mb/mb/exports.py
URL: http://svn.mirrorbrain.org/viewvc/mirrorbrain/trunk/mb/mb/exports.py?rev=8145&r1=8144&r2=8145&view=diff
==============================================================================
--- trunk/mb/mb/exports.py (original)
+++ trunk/mb/mb/exports.py Sun Sep 19 05:25:10 2010
_at_@ -58,4 +58,7 @@
 
 """
 
-mirmon_template = """%(proto)s\t%(country)s\t%(url)s\t%(adminEmail)s"""
+# mirmon configured with "list_style = apache"
+mirmon_apache_template = """%(proto)s\t%(country)s\t%(url)s\t%(adminEmail)s"""
+# mirmon configured with "list_style = plain"
+mirmon_template = """%(country)s\t%(url)s\t%(adminEmail)s"""




_______________________________________________
mirrorbrain-commits mailing list
Archive: http://mirrorbrain.org/archive/mirrorbrain-commits/

Note: To remove yourself from this list, send a mail with the content
 	unsubscribe
to the address mirrorbrain-commits-request_at_mirrorbrain.org
Received on Sun Sep 19 2010 - 03:25:15 GMT

This archive was generated by hypermail 2.3.0 : Mon Feb 20 2012 - 23:47:04 GMT