Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1087)

Side by Side Diff: PRESUBMIT.py

Issue 10831194: Add permission checking to the presumit checks. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | tools/checkperms/checkperms.py » ('j') | tools/checkperms/checkperms.py » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
13 import sys 14 import sys
14 15
15 16
16 _EXCLUDED_PATHS = ( 17 _EXCLUDED_PATHS = (
17 r"^breakpad[\\\/].*", 18 r"^breakpad[\\\/].*",
18 r"^native_client_sdk[\\\/].*", 19 r"^native_client_sdk[\\\/].*",
19 r"^net[\\\/]tools[\\\/]spdyshark[\\\/].*", 20 r"^net[\\\/]tools[\\\/]spdyshark[\\\/].*",
20 r"^skia[\\\/].*", 21 r"^skia[\\\/].*",
21 r"^v8[\\\/].*", 22 r"^v8[\\\/].*",
22 r".*MakeFile$", 23 r".*MakeFile$",
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after
428 error_descriptions)) 429 error_descriptions))
429 if warning_descriptions: 430 if warning_descriptions:
430 results.append(output_api.PresubmitPromptWarning( 431 results.append(output_api.PresubmitPromptWarning(
431 'You added one or more #includes of files that are temporarily\n' 432 'You added one or more #includes of files that are temporarily\n'
432 'allowed but being removed. Can you avoid introducing the\n' 433 'allowed but being removed. Can you avoid introducing the\n'
433 '#include? See relevant DEPS file(s) for details and contacts.', 434 '#include? See relevant DEPS file(s) for details and contacts.',
434 warning_descriptions)) 435 warning_descriptions))
435 return results 436 return results
436 437
437 438
439 def _CheckFilePermissions(input_api, output_api):
440 """Check that all files have their permissions properly set."""
441 args = [sys.executable, 'tools/checkperms/checkperms.py', '--root',
442 input_api.change.RepositoryRoot()]
443 for f in input_api.AffectedFiles():
444 args += ['--file', f.LocalPath()]
445 errors = []
446 (errors, stderrdata) = subprocess.Popen(args).communicate()
447
448 results = []
449 if errors:
450 results.append(output_api.PreSubmitError('checkperms.py failed.',
451 errors))
452 return results
453
454
438 def _CommonChecks(input_api, output_api): 455 def _CommonChecks(input_api, output_api):
439 """Checks common to both upload and commit.""" 456 """Checks common to both upload and commit."""
440 results = [] 457 results = []
441 results.extend(input_api.canned_checks.PanProjectChecks( 458 results.extend(input_api.canned_checks.PanProjectChecks(
442 input_api, output_api, excluded_paths=_EXCLUDED_PATHS)) 459 input_api, output_api, excluded_paths=_EXCLUDED_PATHS))
443 results.extend(_CheckAuthorizedAuthor(input_api, output_api)) 460 results.extend(_CheckAuthorizedAuthor(input_api, output_api))
444 results.extend( 461 results.extend(
445 _CheckNoProductionCodeUsingTestOnlyFunctions(input_api, output_api)) 462 _CheckNoProductionCodeUsingTestOnlyFunctions(input_api, output_api))
446 results.extend(_CheckNoIOStreamInHeaders(input_api, output_api)) 463 results.extend(_CheckNoIOStreamInHeaders(input_api, output_api))
447 results.extend(_CheckNoUNIT_TESTInSourceFiles(input_api, output_api)) 464 results.extend(_CheckNoUNIT_TESTInSourceFiles(input_api, output_api))
448 results.extend(_CheckNoNewWStrings(input_api, output_api)) 465 results.extend(_CheckNoNewWStrings(input_api, output_api))
449 results.extend(_CheckNoDEPSGIT(input_api, output_api)) 466 results.extend(_CheckNoDEPSGIT(input_api, output_api))
450 results.extend(_CheckNoBannedFunctions(input_api, output_api)) 467 results.extend(_CheckNoBannedFunctions(input_api, output_api))
451 results.extend(_CheckNoPragmaOnce(input_api, output_api)) 468 results.extend(_CheckNoPragmaOnce(input_api, output_api))
452 results.extend(_CheckUnwantedDependencies(input_api, output_api)) 469 results.extend(_CheckUnwantedDependencies(input_api, output_api))
470 results.extend(_CheckFilePermissions(input_api, output_api))
453 return results 471 return results
454 472
455 473
456 def _CheckSubversionConfig(input_api, output_api): 474 def _CheckSubversionConfig(input_api, output_api):
457 """Verifies the subversion config file is correctly setup. 475 """Verifies the subversion config file is correctly setup.
458 476
459 Checks that autoprops are enabled, returns an error otherwise. 477 Checks that autoprops are enabled, returns an error otherwise.
460 """ 478 """
461 join = input_api.os_path.join 479 join = input_api.os_path.join
462 if input_api.platform == 'win32': 480 if input_api.platform == 'win32':
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
572 590
573 trybots = ['win_rel', 'linux_rel', 'mac_rel', 'linux_clang:compile', 591 trybots = ['win_rel', 'linux_rel', 'mac_rel', 'linux_clang:compile',
574 'android'] 592 'android']
575 593
576 # Match things like path/aura/file.cc and path/file_aura.cc. 594 # Match things like path/aura/file.cc and path/file_aura.cc.
577 # Same for chromeos. 595 # Same for chromeos.
578 if any(re.search('[/_](aura|chromeos)', f) for f in files): 596 if any(re.search('[/_](aura|chromeos)', f) for f in files):
579 trybots += ['linux_chromeos', 'linux_chromeos_clang:compile'] 597 trybots += ['linux_chromeos', 'linux_chromeos_clang:compile']
580 598
581 return trybots 599 return trybots
OLDNEW
« no previous file with comments | « no previous file | tools/checkperms/checkperms.py » ('j') | tools/checkperms/checkperms.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698