Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2013 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 | 5 |
| 6 """Top-level presubmit script for Skia. | 6 """Top-level presubmit script for Skia. |
| 7 | 7 |
| 8 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts | 8 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts |
| 9 for more details about the presubmit API built into gcl. | 9 for more details about the presubmit API built into gcl. |
| 10 """ | 10 """ |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 237 authors_content = '' | 237 authors_content = '' |
| 238 for line in open(AUTHORS_FILE_NAME): | 238 for line in open(AUTHORS_FILE_NAME): |
| 239 if not line.startswith('#'): | 239 if not line.startswith('#'): |
| 240 authors_content += line | 240 authors_content += line |
| 241 email_fnmatches = re.findall('<(.*)>', authors_content) | 241 email_fnmatches = re.findall('<(.*)>', authors_content) |
| 242 for email_fnmatch in email_fnmatches: | 242 for email_fnmatch in email_fnmatches: |
| 243 if fnmatch.fnmatch(owner_email, email_fnmatch): | 243 if fnmatch.fnmatch(owner_email, email_fnmatch): |
| 244 # Found a match, the user is in the AUTHORS file break out of the loop | 244 # Found a match, the user is in the AUTHORS file break out of the loop |
| 245 break | 245 break |
| 246 else: | 246 else: |
| 247 # TODO(rmistry): Remove the below CLA messaging once a CLA checker has | |
| 248 # been added to the CQ. | |
|
rmistry
2015/10/01 15:01:38
The CQ now fails if CLA has not been signed.
| |
| 249 results.append( | 247 results.append( |
| 250 output_api.PresubmitError( | 248 output_api.PresubmitError( |
| 251 'The email %s is not in Skia\'s AUTHORS file.\n' | 249 'The email %s is not in Skia\'s AUTHORS file.\n' |
| 252 'Issue owner, this CL must include an addition to the Skia AUTHORS ' | 250 'Issue owner, this CL must include an addition to the Skia AUTHORS ' |
| 253 'file.\n' | 251 'file.' |
| 254 'Googler reviewers, please check that the AUTHORS entry ' | |
| 255 'corresponds to an email address in http://goto/cla-signers. If it ' | |
| 256 'does not then ask the issue owner to sign the CLA at ' | |
| 257 'https://developers.google.com/open-source/cla/individual ' | |
| 258 '(individual) or ' | |
| 259 'https://developers.google.com/open-source/cla/corporate ' | |
| 260 '(corporate).' | |
| 261 % owner_email)) | 252 % owner_email)) |
| 262 except IOError: | 253 except IOError: |
| 263 # Do not fail if authors file cannot be found. | 254 # Do not fail if authors file cannot be found. |
| 264 traceback.print_exc() | 255 traceback.print_exc() |
| 265 input_api.logging.error('AUTHORS file not found!') | 256 input_api.logging.error('AUTHORS file not found!') |
| 266 | 257 |
| 267 return results | 258 return results |
| 268 | 259 |
| 269 | 260 |
| 270 def _CheckLGTMsForPublicAPI(input_api, output_api): | 261 def _CheckLGTMsForPublicAPI(input_api, output_api): |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 290 | 281 |
| 291 lgtm_from_owner = False | 282 lgtm_from_owner = False |
| 292 issue = input_api.change.issue | 283 issue = input_api.change.issue |
| 293 if issue and input_api.rietveld: | 284 if issue and input_api.rietveld: |
| 294 issue_properties = input_api.rietveld.get_issue_properties( | 285 issue_properties = input_api.rietveld.get_issue_properties( |
| 295 issue=int(issue), messages=True) | 286 issue=int(issue), messages=True) |
| 296 if re.match(REVERT_CL_SUBJECT_PREFIX, issue_properties['subject'], re.I): | 287 if re.match(REVERT_CL_SUBJECT_PREFIX, issue_properties['subject'], re.I): |
| 297 # It is a revert CL, ignore the public api owners check. | 288 # It is a revert CL, ignore the public api owners check. |
| 298 return results | 289 return results |
| 299 | 290 |
| 300 # TODO(rmistry): Stop checking for COMMIT=false once crbug/470609 is | 291 if issue_properties['cq_dry_run']: |
| 301 # resolved. | |
|
rmistry
2015/10/01 15:01:38
I resolved this bug.
| |
| 302 if issue_properties['cq_dry_run'] or re.search( | |
| 303 r'^COMMIT=false$', issue_properties['description'], re.M): | |
| 304 # Ignore public api owners check for dry run CLs since they are not | 292 # Ignore public api owners check for dry run CLs since they are not |
| 305 # going to be committed. | 293 # going to be committed. |
| 306 return results | 294 return results |
| 307 | 295 |
| 308 match = re.search(r'^TBR=(.*)$', issue_properties['description'], re.M) | 296 match = re.search(r'^TBR=(.*)$', issue_properties['description'], re.M) |
| 309 if match: | 297 if match: |
| 310 tbr_entries = match.group(1).strip().split(',') | 298 tbr_entries = match.group(1).strip().split(',') |
| 311 for owner in PUBLIC_API_OWNERS: | 299 for owner in PUBLIC_API_OWNERS: |
| 312 if owner in tbr_entries or owner.split('@')[0] in tbr_entries: | 300 if owner in tbr_entries or owner.split('@')[0] in tbr_entries: |
| 313 # If an owner is specified in the TBR= line then ignore the public | 301 # If an owner is specified in the TBR= line then ignore the public |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 491 state and an error if it is in 'Closed' state. | 479 state and an error if it is in 'Closed' state. |
| 492 """ | 480 """ |
| 493 results = [] | 481 results = [] |
| 494 results.extend(_CommonChecks(input_api, output_api)) | 482 results.extend(_CommonChecks(input_api, output_api)) |
| 495 results.extend( | 483 results.extend( |
| 496 _CheckTreeStatus(input_api, output_api, json_url=( | 484 _CheckTreeStatus(input_api, output_api, json_url=( |
| 497 SKIA_TREE_STATUS_URL + '/banner-status?format=json'))) | 485 SKIA_TREE_STATUS_URL + '/banner-status?format=json'))) |
| 498 results.extend(_CheckLGTMsForPublicAPI(input_api, output_api)) | 486 results.extend(_CheckLGTMsForPublicAPI(input_api, output_api)) |
| 499 results.extend(_CheckOwnerIsInAuthorsFile(input_api, output_api)) | 487 results.extend(_CheckOwnerIsInAuthorsFile(input_api, output_api)) |
| 500 return results | 488 return results |
| OLD | NEW |