chiark / gitweb /
scanner: don't error on partially used globs
authorDaniel Martí <mvdan@mvdan.cc>
Sun, 4 Oct 2015 00:00:22 +0000 (17:00 -0700)
committerDaniel Martí <mvdan@mvdan.cc>
Sun, 4 Oct 2015 00:00:22 +0000 (17:00 -0700)
This meant that using something like `scanignore=*` would error if there were
ignores happening in some directories/files, but not all.

Fixes #110

fdroidserver/scanner.py

index f71120e35c379b4d671e9fe31ee33f7be8d02407..cc42adce9d6d2f8968b476e75ea6e77433eedcc5 100644 (file)
@@ -72,24 +72,26 @@ def scan_source(build_dir, root_dir, thisbuild):
             if r.match(s):
                 yield n
 
-    scanignore = common.getpaths(build_dir, thisbuild['scanignore'])
-    scandelete = common.getpaths(build_dir, thisbuild['scandelete'])
+    scanignore = common.getpaths_map(build_dir, thisbuild['scanignore'])
+    scandelete = common.getpaths_map(build_dir, thisbuild['scandelete'])
 
     scanignore_worked = set()
     scandelete_worked = set()
 
     def toignore(fd):
-        for p in scanignore:
-            if fd.startswith(p):
-                scanignore_worked.add(p)
-                return True
+        for k, paths in scanignore.iteritems():
+            for p in paths:
+                if fd.startswith(p):
+                    scanignore_worked.add(k)
+                    return True
         return False
 
     def todelete(fd):
-        for p in scandelete:
-            if fd.startswith(p):
-                scandelete_worked.add(p)
-                return True
+        for k, paths in scandelete.iteritems():
+            for p in paths:
+                if fd.startswith(p):
+                    scandelete_worked.add(k)
+                    return True
         return False
 
     def ignoreproblem(what, fd, fp):