Remove API owners check from presubmit script
This is now enforced using OWNERS Change-Id: Iee0c639731376d7bc4c3deaa65ccadef3fae53f4 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/445642 Reviewed-by: Kevin Lubick <kjlubick@google.com> Reviewed-by: Ravi Mistry <rmistry@google.com> Commit-Queue: Brian Osman <brianosman@google.com>
This commit is contained in:
parent
f8af49ebd8
commit
0f124cd7cd
84
PRESUBMIT.py
84
PRESUBMIT.py
@ -18,20 +18,6 @@ import sys
|
|||||||
import traceback
|
import traceback
|
||||||
|
|
||||||
|
|
||||||
REVERT_CL_SUBJECT_PREFIX = 'Revert '
|
|
||||||
|
|
||||||
# Please add the complete email address here (and not just 'xyz@' or 'xyz').
|
|
||||||
PUBLIC_API_OWNERS = (
|
|
||||||
'brianosman@google.com',
|
|
||||||
'bsalomon@google.com',
|
|
||||||
'djsollen@chromium.org',
|
|
||||||
'djsollen@google.com',
|
|
||||||
'hcm@chromium.org',
|
|
||||||
'hcm@google.com',
|
|
||||||
'reed@chromium.org',
|
|
||||||
'reed@google.com',
|
|
||||||
)
|
|
||||||
|
|
||||||
AUTHORS_FILE_NAME = 'AUTHORS'
|
AUTHORS_FILE_NAME = 'AUTHORS'
|
||||||
RELEASE_NOTES_FILE_NAME = 'RELEASE_NOTES.txt'
|
RELEASE_NOTES_FILE_NAME = 'RELEASE_NOTES.txt'
|
||||||
|
|
||||||
@ -404,75 +390,6 @@ def _CheckReleaseNotesForPublicAPI(input_api, output_api):
|
|||||||
return results
|
return results
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def _CheckLGTMsForPublicAPI(input_api, output_api):
|
|
||||||
"""Check LGTMs for public API changes.
|
|
||||||
|
|
||||||
For public API files make sure there is an LGTM from the list of owners in
|
|
||||||
PUBLIC_API_OWNERS.
|
|
||||||
"""
|
|
||||||
results = []
|
|
||||||
requires_owner_check = False
|
|
||||||
for affected_file in input_api.AffectedFiles():
|
|
||||||
affected_file_path = affected_file.LocalPath()
|
|
||||||
file_path, file_ext = os.path.splitext(affected_file_path)
|
|
||||||
# We only care about files that end in .h and are under the top-level
|
|
||||||
# include dir, but not include/private.
|
|
||||||
if (file_ext == '.h' and
|
|
||||||
'include' == file_path.split(os.path.sep)[0] and
|
|
||||||
'private' not in file_path):
|
|
||||||
requires_owner_check = True
|
|
||||||
|
|
||||||
if not requires_owner_check:
|
|
||||||
return results
|
|
||||||
|
|
||||||
lgtm_from_owner = False
|
|
||||||
if input_api.change.issue:
|
|
||||||
cr = CodeReview(input_api)
|
|
||||||
|
|
||||||
if re.match(REVERT_CL_SUBJECT_PREFIX, cr.GetSubject(), re.I):
|
|
||||||
# It is a revert CL, ignore the public api owners check.
|
|
||||||
return results
|
|
||||||
|
|
||||||
if input_api.gerrit:
|
|
||||||
for reviewer in cr.GetReviewers():
|
|
||||||
if reviewer in PUBLIC_API_OWNERS:
|
|
||||||
# If an owner is specified as an reviewer in Gerrit then ignore the
|
|
||||||
# public api owners check.
|
|
||||||
return results
|
|
||||||
else:
|
|
||||||
match = re.search(r'^TBR=(.*)$', cr.GetDescription(), re.M)
|
|
||||||
if match:
|
|
||||||
tbr_section = match.group(1).strip().split(' ')[0]
|
|
||||||
tbr_entries = tbr_section.split(',')
|
|
||||||
for owner in PUBLIC_API_OWNERS:
|
|
||||||
if owner in tbr_entries or owner.split('@')[0] in tbr_entries:
|
|
||||||
# If an owner is specified in the TBR= line then ignore the public
|
|
||||||
# api owners check.
|
|
||||||
return results
|
|
||||||
|
|
||||||
if cr.GetOwnerEmail() in PUBLIC_API_OWNERS:
|
|
||||||
# An owner created the CL that is an automatic LGTM.
|
|
||||||
lgtm_from_owner = True
|
|
||||||
|
|
||||||
for approver in cr.GetApprovers():
|
|
||||||
if approver in PUBLIC_API_OWNERS:
|
|
||||||
# Found an lgtm in a message from an owner.
|
|
||||||
lgtm_from_owner = True
|
|
||||||
break
|
|
||||||
|
|
||||||
if not lgtm_from_owner:
|
|
||||||
results.append(
|
|
||||||
output_api.PresubmitError(
|
|
||||||
"If this CL adds to or changes Skia's public API, you need an LGTM "
|
|
||||||
"from any of %s. If this CL only removes from or doesn't change "
|
|
||||||
"Skia's public API, please add a short note to the CL saying so. "
|
|
||||||
"Add one of the owners as a reviewer to your CL as well as to the "
|
|
||||||
"TBR= line. If you don't know if this CL affects Skia's public "
|
|
||||||
"API, treat it like it does." % str(PUBLIC_API_OWNERS)))
|
|
||||||
return results
|
|
||||||
|
|
||||||
|
|
||||||
def PostUploadHook(gerrit, change, output_api):
|
def PostUploadHook(gerrit, change, output_api):
|
||||||
"""git cl upload will call this hook after the issue is created/modified.
|
"""git cl upload will call this hook after the issue is created/modified.
|
||||||
|
|
||||||
@ -528,7 +445,6 @@ def CheckChangeOnCommit(input_api, output_api):
|
|||||||
"""Presubmit checks for the change on commit."""
|
"""Presubmit checks for the change on commit."""
|
||||||
results = []
|
results = []
|
||||||
results.extend(_CommonChecks(input_api, output_api))
|
results.extend(_CommonChecks(input_api, output_api))
|
||||||
results.extend(_CheckLGTMsForPublicAPI(input_api, output_api))
|
|
||||||
results.extend(_CheckOwnerIsInAuthorsFile(input_api, output_api))
|
results.extend(_CheckOwnerIsInAuthorsFile(input_api, output_api))
|
||||||
# Checks for the presence of 'DO NOT''SUBMIT' in CL description and in
|
# Checks for the presence of 'DO NOT''SUBMIT' in CL description and in
|
||||||
# content of files.
|
# content of files.
|
||||||
|
Loading…
Reference in New Issue
Block a user