checkperms: Add a --file-list option.
And use it from //PRESUBMIT.py instead of passing --file <file> for each
file that needs to be processed.
The idea is to read the list of files we want to process from a text file
instead of reading everything from the command-line.
web-platform-test imports were hitting an "argument list too long" error
because there's a particularly huge import with several directories being
renamed; at one point, we ended up with a command-line with ~260k
characters.
Bug: 780055, 780629
Change-Id: Ib1c8b902c42ade77ccbd2662905301d7f766f9d9
Reviewed-on: https://chromium-review.googlesource.com/751504
Reviewed-by: Aaron Gable <[email protected]>
Reviewed-by: Dirk Pranke <[email protected]>
Reviewed-by: Quinten Yearsley <[email protected]>
Reviewed-by: Daniel Cheng <[email protected]>
Commit-Queue: Raphael Kubo da Costa (rakuco) <[email protected]>
Cr-Commit-Position: refs/heads/master@{#515960}
diff --git a/PRESUBMIT.py b/PRESUBMIT.py
index 02cb37a..4c5451f 100644
--- a/PRESUBMIT.py
+++ b/PRESUBMIT.py
@@ -926,16 +926,20 @@
'tools', 'checkperms', 'checkperms.py')
args = [input_api.python_executable, checkperms_tool,
'--root', input_api.change.RepositoryRoot()]
- for f in input_api.AffectedFiles():
- # checkperms.py file/directory arguments must be relative to the repository.
- args += ['--file', f.LocalPath()]
- try:
- input_api.subprocess.check_output(args)
- return []
- except input_api.subprocess.CalledProcessError as error:
- return [output_api.PresubmitError(
- 'checkperms.py failed:',
- long_text=error.output)]
+ with input_api.CreateTemporaryFile() as file_list:
+ for f in input_api.AffectedFiles():
+ # checkperms.py file/directory arguments must be relative to the
+ # repository.
+ file_list.write(f.LocalPath() + '\n')
+ file_list.close()
+ args += ['--file-list', file_list.name]
+ try:
+ input_api.subprocess.check_output(args)
+ return []
+ except input_api.subprocess.CalledProcessError as error:
+ return [output_api.PresubmitError(
+ 'checkperms.py failed:',
+ long_text=error.output)]
def _CheckTeamTags(input_api, output_api):