[mirrorbrain-commits] [opensuse-svn] r6937 - trunk/tools/download-redirector-v2/mirrordoctor

From: Novell Forge SVN <noreply_at_novell.com>
Date: Sun, 29 Mar 2009 10:42:52 -0600 (MDT)
Author: poeml
Date: 2009-03-29 10:42:50 -0600 (Sun, 29 Mar 2009)
New Revision: 6937

Modified:
   trunk/tools/download-redirector-v2/mirrordoctor/mirrordoctor.py
Log:
mb scan:
- to get rid of hardcoded excludes from the scanner script, this commit
  implements the first steop of two new config directives for mirrorbrain.conf:
    scan_exclude 
    scan_exclude_rsync
  The former will take regular expressions and be effective for FTP and HTTP scans, 
  while the latter will take rsync patterns, which are passed directly to the
  remote rsync.
- pass contents of the new config directives to the scanner 
  (as --exclude respectively --exclude-rsync)


Modified: trunk/tools/download-redirector-v2/mirrordoctor/mirrordoctor.py
===================================================================
--- trunk/tools/download-redirector-v2/mirrordoctor/mirrordoctor.py	2009-03-28 18:08:42 UTC (rev 6936)
+++ trunk/tools/download-redirector-v2/mirrordoctor/mirrordoctor.py	2009-03-29 16:42:50 UTC (rev 6937)
@@ -610,40 +610,46 @@
         ${cmd_option_list}
         """
 
-        import os
-        cmd = opts.scanner or '/usr/bin/scanner'
-        cmd += ' '
+        cmd = []
+        cmd.append(opts.scanner or '/usr/bin/scanner')
+
         if self.options.brain_instance:
-            cmd += '-b %s ' % self.options.brain_instance
+            cmd.append('-b %s' % self.options.brain_instance)
 
         if opts.sql_debug:
-            cmd += '-S '
-        cmd += '-v ' * opts.verbosity
+            cmd.append('-S')
+        for i in range(opts.verbosity):
+            cmd.append('-v')
 
         if opts.enable:
-            cmd += '-e '
+            cmd.append('-e')
         if opts.directory:
-            cmd += '-d %s ' % opts.directory
+            cmd.append('-d %s' % opts.directory)
         if opts.jobs:
-            cmd += '-j %s ' % opts.jobs
+            cmd += [ '-j', opts.jobs ]
         if opts.all:
-            cmd += '-a '
+            cmd.append('-a')
         else:
-            cmd += '-f '
+            cmd.append('-f')
 
-        scan_top_include = self.config.dbconfig.get('scan_top_include', '').split()
-        for i in scan_top_include:
-            cmd += '-I %s ' % i
+        cmd += [ '-I %s' % i for i in 
+                 self.config.dbconfig.get('scan_top_include', '').split() ]
+        cmd += [ '--exclude %s' % i for i in 
+                 self.config.dbconfig.get('scan_exclude', '').split() ]
+        cmd += [ '--exclude-rsync %s' % i for i in 
+                 self.config.dbconfig.get('scan_exclude_rsync', '').split() ]
 
         mirrors = []
         for arg in args:
             mirrors.append(lookup_mirror(self, arg))
 
-        cmd += ' '.join([mirror.identifier for mirror in mirrors])
+        cmd += [ mirror.identifier for mirror in mirrors ]
 
+        cmd = ' '.join(cmd)
         if self.options.debug:
             print cmd
         
+        import os
         rc = os.system(cmd)
 
         if opts.enable and rc == 0:

_______________________________________________
Opensuse-svn mailing list
Opensuse-svn_at_forge.novell.com
http://forge.novell.com/mailman/listinfo/opensuse-svn


_______________________________________________
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 2009-03-29Z16:44:07

This archive was generated by hypermail 2.2.0 : 2009-07-10Z19:18:12 GMT