| OLD | NEW |
| 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 """Top-level presubmit script for Chromium. | 5 """Top-level presubmit script for Chromium. |
| 6 | 6 |
| 7 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts | 7 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts |
| 8 for more details about the presubmit API built into gcl. | 8 for more details about the presubmit API built into gcl. |
| 9 """ | 9 """ |
| 10 | 10 |
| 11 | 11 |
| 12 import re | 12 import re |
| 13 import subprocess | |
| 14 import sys | 13 import sys |
| 15 | 14 |
| 16 | 15 |
| 17 _EXCLUDED_PATHS = ( | 16 _EXCLUDED_PATHS = ( |
| 18 r"^breakpad[\\\/].*", | 17 r"^breakpad[\\\/].*", |
| 19 r"^native_client_sdk[\\\/]src[\\\/]build_tools[\\\/]make_rules.py", | 18 r"^native_client_sdk[\\\/]src[\\\/]build_tools[\\\/]make_rules.py", |
| 20 r"^native_client_sdk[\\\/]src[\\\/]build_tools[\\\/]make_simple.py", | 19 r"^native_client_sdk[\\\/]src[\\\/]build_tools[\\\/]make_simple.py", |
| 21 r"^native_client_sdk[\\\/]src[\\\/]tools[\\\/].*.mk", | 20 r"^native_client_sdk[\\\/]src[\\\/]tools[\\\/].*.mk", |
| 22 r"^net[\\\/]tools[\\\/]spdyshark[\\\/].*", | 21 r"^net[\\\/]tools[\\\/]spdyshark[\\\/].*", |
| 23 r"^skia[\\\/].*", | 22 r"^skia[\\\/].*", |
| (...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 519 warning_descriptions)) | 518 warning_descriptions)) |
| 520 return results | 519 return results |
| 521 | 520 |
| 522 | 521 |
| 523 def _CheckFilePermissions(input_api, output_api): | 522 def _CheckFilePermissions(input_api, output_api): |
| 524 """Check that all files have their permissions properly set.""" | 523 """Check that all files have their permissions properly set.""" |
| 525 args = [sys.executable, 'tools/checkperms/checkperms.py', '--root', | 524 args = [sys.executable, 'tools/checkperms/checkperms.py', '--root', |
| 526 input_api.change.RepositoryRoot()] | 525 input_api.change.RepositoryRoot()] |
| 527 for f in input_api.AffectedFiles(): | 526 for f in input_api.AffectedFiles(): |
| 528 args += ['--file', f.LocalPath()] | 527 args += ['--file', f.LocalPath()] |
| 529 errors = [] | 528 checkperms = input_api.subprocess.Popen(args, |
| 530 (errors, stderrdata) = subprocess.Popen(args).communicate() | 529 stdout=input_api.subprocess.PIPE) |
| 531 | 530 errors = checkperms.communicate()[0].strip() |
| 532 results = [] | |
| 533 if errors: | 531 if errors: |
| 534 results.append(output_api.PresubmitError('checkperms.py failed.', | 532 return [output_api.PresubmitError('checkperms.py failed.', |
| 535 errors)) | 533 errors.splitlines())] |
| 536 return results | 534 return [] |
| 537 | 535 |
| 538 | 536 |
| 539 def _CheckNoAuraWindowPropertyHInHeaders(input_api, output_api): | 537 def _CheckNoAuraWindowPropertyHInHeaders(input_api, output_api): |
| 540 """Makes sure we don't include ui/aura/window_property.h | 538 """Makes sure we don't include ui/aura/window_property.h |
| 541 in header files. | 539 in header files. |
| 542 """ | 540 """ |
| 543 pattern = input_api.re.compile(r'^#include\s*"ui/aura/window_property.h"') | 541 pattern = input_api.re.compile(r'^#include\s*"ui/aura/window_property.h"') |
| 544 errors = [] | 542 errors = [] |
| 545 for f in input_api.AffectedFiles(): | 543 for f in input_api.AffectedFiles(): |
| 546 if not f.LocalPath().endswith('.h'): | 544 if not f.LocalPath().endswith('.h'): |
| (...skipping 910 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1457 trybots.extend(GetDefaultTryConfigs(['cros_x86'])) | 1455 trybots.extend(GetDefaultTryConfigs(['cros_x86'])) |
| 1458 | 1456 |
| 1459 # The AOSP bot doesn't build the chrome/ layer, so ignore any changes to it | 1457 # The AOSP bot doesn't build the chrome/ layer, so ignore any changes to it |
| 1460 # unless they're .gyp(i) files as changes to those files can break the gyp | 1458 # unless they're .gyp(i) files as changes to those files can break the gyp |
| 1461 # step on that bot. | 1459 # step on that bot. |
| 1462 if (not all(re.search('^chrome', f) for f in files) or | 1460 if (not all(re.search('^chrome', f) for f in files) or |
| 1463 any(re.search('\.gypi?$', f) for f in files)): | 1461 any(re.search('\.gypi?$', f) for f in files)): |
| 1464 trybots.extend(GetDefaultTryConfigs(['android_aosp'])) | 1462 trybots.extend(GetDefaultTryConfigs(['android_aosp'])) |
| 1465 | 1463 |
| 1466 return trybots | 1464 return trybots |
| OLD | NEW |