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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tools/checkperms/checkperms.py » ('j') | tools/checkperms/checkperms.py » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: PRESUBMIT.py
diff --git a/PRESUBMIT.py b/PRESUBMIT.py
index 33525749f7ca15436815de578dd0b311c14fab6c..9df2cfd3d524c8e66fbe3774f42f6c02a20047ea 100644
--- a/PRESUBMIT.py
+++ b/PRESUBMIT.py
@@ -10,6 +10,7 @@ for more details about the presubmit API built into gcl.
import re
+import subprocess
import sys
@@ -435,6 +436,22 @@ def _CheckUnwantedDependencies(input_api, output_api):
return results
+def _CheckFilePermissions(input_api, output_api):
+ """Check that all files have their permissions properly set."""
+ args = [sys.executable, 'tools/checkperms/checkperms.py', '--root',
+ input_api.change.RepositoryRoot()]
+ for f in input_api.AffectedFiles():
+ args += ['--file', f.LocalPath()]
+ errors = []
+ (errors, stderrdata) = subprocess.Popen(args).communicate()
+
+ results = []
+ if errors:
+ results.append(output_api.PreSubmitError('checkperms.py failed.',
+ errors))
+ return results
+
+
def _CommonChecks(input_api, output_api):
"""Checks common to both upload and commit."""
results = []
@@ -450,6 +467,7 @@ def _CommonChecks(input_api, output_api):
results.extend(_CheckNoBannedFunctions(input_api, output_api))
results.extend(_CheckNoPragmaOnce(input_api, output_api))
results.extend(_CheckUnwantedDependencies(input_api, output_api))
+ results.extend(_CheckFilePermissions(input_api, output_api))
return results
« 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