scanner: adapt to new scan_source format (fixes #59)

This commit is contained in:
Daniel Martí 2015-01-10 13:49:54 +01:00
parent e830b25561
commit 2edddda234
2 changed files with 16 additions and 15 deletions

View 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) count = common.scan_source(build_dir, root_dir, thisbuild)
if count > 0: if count > 0:
if force: if force:
logging.warn('Scanner found %d problems:' % count) logging.warn('Scanner found %d problems' % count)
else: else:
raise BuildException("Can't build due to %d errors while scanning" % count) raise BuildException("Can't build due to %d errors while scanning" % count)

View file

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