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

From: Novell Forge SVN <noreply_at_novell.com>
Date: Tue, 3 Mar 2009 02:46:23 -0700 (MST)
Author: poeml
Date: 2009-03-03 02:46:20 -0700 (Tue, 03 Mar 2009)
New Revision: 6665

Modified:
   trunk/tools/download-redirector-v2/tools/metalink-hasher.py
Log:
metalink-hasher:
- make --ignore-mask work for directories, too
- precompile regular expressions for efficiency reasons


Modified: trunk/tools/download-redirector-v2/tools/metalink-hasher.py
===================================================================
--- trunk/tools/download-redirector-v2/tools/metalink-hasher.py	2009-03-03 09:07:37 UTC (rev 6664)
+++ trunk/tools/download-redirector-v2/tools/metalink-hasher.py	2009-03-03 09:46:20 UTC (rev 6665)
@@ -141,6 +141,10 @@
 
         directories = [startdir]
 
+        if opts.ignore_mask: 
+            opts.ignore_mask = re.compile(opts.ignore_mask)
+        if opts.file_mask: 
+            opts.file_mask = re.compile(opts.file_mask)
 
         while len(directories)>0:
             directory = directories.pop()
@@ -152,18 +156,20 @@
                 if os.path.islink(fullpath):
                     continue
 
+                if opts.ignore_mask and re.match(opts.ignore_mask, fullpath):
+                    continue
+
                 if os.path.isfile(fullpath):
                     if not opts.file_mask or re.match(opts.file_mask, name):
-                        if not opts.ignore_mask or not re.match(opts.ignore_mask, name):
-                            #print fullpath
-                            if opts.base_dir:
-                                target = fullpath[len(opts.base_dir):]
-                            else:
-                                target = fullpath
-                            target = os.path.join(opts.target_dir, target.lstrip('/'))
-                            if opts.verbose:
-                                print 'target:', target
-                            make_hashes(fullpath, target, opts=opts)
+                        #print fullpath
+                        if opts.base_dir:
+                            target = fullpath[len(opts.base_dir):]
+                        else:
+                            target = fullpath
+                        target = os.path.join(opts.target_dir, target.lstrip('/'))
+                        if opts.verbose:
+                            print 'target:', target
+                        make_hashes(fullpath, target, opts=opts)
 
                 elif os.path.isdir(fullpath):
                     directories.append(fullpath)  # It's a directory, store it.

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


_______________________________________________
mirrorbrain-commits mailing list

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-03Z09:47:07

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