OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright 2014 The Chromium Authors. All rights reserved. | 2 # Copyright 2015 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 import json | 6 import json |
7 import os | 7 import os |
8 import sys | 8 import sys |
9 | 9 |
10 | 10 |
11 import common | 11 import common |
12 | 12 |
13 | 13 |
14 def main_run(args): | 14 def main_run(args): |
15 with common.temporary_file() as tempfile_path: | 15 with common.temporary_file() as tempfile_path: |
16 rc = common.run_command([ | 16 rc = common.run_command([ |
17 os.path.join(common.SRC_DIR, 'buildtools', 'checkdeps', 'checkdeps.py'), | 17 os.path.join(common.SRC_DIR, 'tools', 'checkperms', 'checkperms.py'), |
| 18 '--root', args.paths['checkout'], |
18 '--json', tempfile_path | 19 '--json', tempfile_path |
19 ]) | 20 ]) |
20 | 21 |
21 with open(tempfile_path) as f: | 22 with open(tempfile_path) as f: |
22 checkdeps_results = json.load(f) | 23 checkperms_results = json.load(f) |
23 | 24 |
24 result_set = set() | 25 result_set = set() |
25 for result in checkdeps_results: | 26 for result in checkperms_results: |
26 for violation in result['violations']: | 27 result_set.add((result['rel_path'], result['error'])) |
27 result_set.add((result['dependee_path'], violation['include_path'])) | |
28 | 28 |
29 json.dump({ | 29 json.dump({ |
30 'valid': True, | 30 'valid': True, |
31 'failures': ['%s: %s' % (r[0], r[1]) for r in result_set], | 31 'failures': ['%s: %s' % (r[0], r[1]) for r in result_set], |
32 }, args.output) | 32 }, args.output) |
33 | 33 |
34 return rc | 34 return rc |
35 | 35 |
36 | 36 |
37 def main_compile_targets(args): | 37 def main_compile_targets(args): |
38 json.dump([], args.output) | 38 json.dump([], args.output) |
39 | 39 |
40 | 40 |
41 if __name__ == '__main__': | 41 if __name__ == '__main__': |
42 funcs = { | 42 funcs = { |
43 'run': main_run, | 43 'run': main_run, |
44 'compile_targets': main_compile_targets, | 44 'compile_targets': main_compile_targets, |
45 } | 45 } |
46 sys.exit(common.run_script(sys.argv[1:], funcs)) | 46 sys.exit(common.run_script(sys.argv[1:], funcs)) |
OLD | NEW |