chiark / gitweb /
scanner: adapt to new scan_source format (fixes #59)
authorDaniel Martí <mvdan@mvdan.cc>
Sat, 10 Jan 2015 12:49:54 +0000 (13:49 +0100)
committerDaniel Martí <mvdan@mvdan.cc>
Sat, 10 Jan 2015 12:49:54 +0000 (13:49 +0100)
fdroidserver/build.py
fdroidserver/scanner.py

index e5efc46f7d97929a2d8ab4fb3f2b27851e9388f7..6d6dc6b3a16ecc8bf680bbc3b6d4f9cff1e0faad 100644 (file)
@@ -547,7 +547,7 @@ def build_local(app, thisbuild, vcs, build_dir, output_dir, srclib_dir, extlib_d
         count = common.scan_source(build_dir, root_dir, thisbuild)
         if count > 0:
             if force:
-                logging.warn('Scanner found %d problems:' % count)
+                logging.warn('Scanner found %d problems' % count)
             else:
                 raise BuildException("Can't build due to %d errors while scanning" % count)
 
index 134716c7c14814c519764cf661993189aec2002f..bc7623ccac08f55c544306ca478b4e95211ec6a5 100644 (file)
@@ -48,7 +48,7 @@ def main():
     allapps = metadata.read_metadata()
     apps = common.read_app_args(args, allapps, True)
 
-    problems = []
+    probcount = 0
 
     build_dir = 'build'
     if not os.path.isdir(build_dir):
@@ -89,25 +89,26 @@ def main():
                                                         extlib_dir, False)
 
                     # Do the scan...
-                    buildprobs = common.scan_source(build_dir, root_dir, thisbuild)
-                    for problem in buildprobs:
-                        problems.append(problem + ' in ' + appid
-                                        + ' ' + thisbuild['version'])
+                    count = common.scan_source(build_dir, root_dir, thisbuild)
+                    if count > 0:
+                        logging.warn('Scanner found %d problems in %s (%s)' % (
+                            count, appid, thisbuild['vercode']))
+                        probcount += count
 
         except BuildException as be:
-            msg = "Could not scan app %s due to BuildException: %s" % (appid, be)
-            problems.append(msg)
+            logging.warn("Could not scan app %s due to BuildException: %s" % (
+                appid, be))
+            probcount += 1
         except VCSException as vcse:
-            msg = "VCS error while scanning app %s: %s" % (appid, vcse)
-            problems.append(msg)
+            logging.warn("VCS error while scanning app %s: %s" % (appid, vcse))
+            probcount += 1
         except Exception:
-            msg = "Could not scan app %s due to unknown error: %s" % (appid, traceback.format_exc())
-            problems.append(msg)
+            logging.warn("Could not scan app %s due to unknown error: %s" % (
+                appid, traceback.format_exc()))
+            probcount += 1
 
     logging.info("Finished:")
-    for problem in problems:
-        print problem
-    print str(len(problems)) + ' problems.'
+    print "%d app(s) with problems" % probcount
 
 if __name__ == "__main__":
     main()