From 2edddda23451bd4895a8b301dbaf3a47d7908c0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Mart=C3=AD?= Date: Sat, 10 Jan 2015 13:49:54 +0100 Subject: [PATCH] scanner: adapt to new scan_source format (fixes #59) --- fdroidserver/build.py | 2 +- fdroidserver/scanner.py | 29 +++++++++++++++-------------- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/fdroidserver/build.py b/fdroidserver/build.py index e5efc46f..6d6dc6b3 100644 --- a/fdroidserver/build.py +++ b/fdroidserver/build.py @@ -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) diff --git a/fdroidserver/scanner.py b/fdroidserver/scanner.py index 134716c7..bc7623cc 100644 --- a/fdroidserver/scanner.py +++ b/fdroidserver/scanner.py @@ -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()