mirror of
https://github.com/mollyim/webrtc.git
synced 2025-05-12 21:30:45 +01:00
Upload WebRTC CLs from Chromium.
This CL removes some assumptions that were making it difficult to upload a patch from the directory //third_party/webrtc in a Chromium checkout. Bug: webrtc:9705 Change-Id: I227ca492d5cf03875474ffd4d31abf387f947e5e Reviewed-on: https://webrtc-review.googlesource.com/97600 Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org> Reviewed-by: Patrik Höglund <phoglund@webrtc.org> Cr-Commit-Position: refs/heads/master@{#24549}
This commit is contained in:
parent
944ba82905
commit
d866544578
4 changed files with 41 additions and 11 deletions
14
PRESUBMIT.py
14
PRESUBMIT.py
|
@ -110,6 +110,14 @@ SOURCES_RE = re.compile(r'sources \+?= \[(?P<sources>.*?)\]',
|
|||
FILE_PATH_RE = re.compile(r'"(?P<file_path>(\w|\/)+)(?P<extension>\.\w+)"')
|
||||
|
||||
|
||||
def FindSrcDirPath(starting_dir):
|
||||
"""Returns the abs path to the src/ dir of the project."""
|
||||
src_dir = starting_dir
|
||||
while os.path.basename(src_dir) != 'src':
|
||||
src_dir = os.path.normpath(os.path.join(src_dir, os.pardir))
|
||||
return src_dir
|
||||
|
||||
|
||||
@contextmanager
|
||||
def _AddToPath(*paths):
|
||||
original_sys_path = sys.path
|
||||
|
@ -554,7 +562,7 @@ def CheckGnGen(input_api, output_api):
|
|||
with _AddToPath(input_api.os_path.join(
|
||||
input_api.PresubmitLocalPath(), 'tools_webrtc', 'presubmit_checks_lib')):
|
||||
from gn_check import RunGnCheck
|
||||
errors = RunGnCheck(input_api.PresubmitLocalPath())[:5]
|
||||
errors = RunGnCheck(FindSrcDirPath(input_api.PresubmitLocalPath()))[:5]
|
||||
if errors:
|
||||
return [output_api.PresubmitPromptWarning(
|
||||
'Some #includes do not match the build dependency graph. Please run:\n'
|
||||
|
@ -573,8 +581,8 @@ def CheckUnwantedDependencies(input_api, output_api, source_file_filter):
|
|||
# We need to wait until we have an input_api object and use this
|
||||
# roundabout construct to import checkdeps because this file is
|
||||
# eval-ed and thus doesn't have __file__.
|
||||
checkdeps_path = input_api.os_path.join(input_api.PresubmitLocalPath(),
|
||||
'buildtools', 'checkdeps')
|
||||
src_path = FindSrcDirPath(input_api.PresubmitLocalPath())
|
||||
checkdeps_path = input_api.os_path.join(src_path, 'buildtools', 'checkdeps')
|
||||
if not os.path.exists(checkdeps_path):
|
||||
return [output_api.PresubmitError(
|
||||
'Cannot find checkdeps at %s\nHave you run "gclient sync" to '
|
||||
|
|
|
@ -19,6 +19,13 @@ import subprocess
|
|||
import sys
|
||||
import urllib2
|
||||
|
||||
def FindSrcDirPath():
|
||||
"""Returns the abs path to the src/ dir of the project."""
|
||||
src_dir = os.path.dirname(os.path.abspath(__file__))
|
||||
while os.path.basename(src_dir) != 'src':
|
||||
src_dir = os.path.normpath(os.path.join(src_dir, os.pardir))
|
||||
return src_dir
|
||||
|
||||
# Skip these dependencies (list without solution name prefix).
|
||||
DONT_AUTOROLL_THESE = [
|
||||
'src/examples/androidtests/third_party/gradle',
|
||||
|
@ -41,8 +48,7 @@ CLANG_REVISION_RE = re.compile(r'^CLANG_REVISION = \'(\d+)\'$')
|
|||
ROLL_BRANCH_NAME = 'roll_chromium_revision'
|
||||
|
||||
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
|
||||
CHECKOUT_SRC_DIR = os.path.realpath(os.path.join(SCRIPT_DIR, os.pardir,
|
||||
os.pardir))
|
||||
CHECKOUT_SRC_DIR = FindSrcDirPath()
|
||||
CHECKOUT_ROOT_DIR = os.path.realpath(os.path.join(CHECKOUT_SRC_DIR, os.pardir))
|
||||
|
||||
sys.path.append(os.path.join(CHECKOUT_SRC_DIR, 'build'))
|
||||
|
|
|
@ -21,6 +21,14 @@ import re
|
|||
import subprocess
|
||||
|
||||
|
||||
def FindSrcDirPath():
|
||||
"""Returns the abs path to the src/ dir of the project."""
|
||||
src_dir = os.path.dirname(os.path.abspath(__file__))
|
||||
while os.path.basename(src_dir) != 'src':
|
||||
src_dir = os.path.normpath(os.path.join(src_dir, os.pardir))
|
||||
return src_dir
|
||||
|
||||
|
||||
LIB_TO_LICENSES_DICT = {
|
||||
'abseil-cpp': ['third_party/abseil-cpp/LICENSE'],
|
||||
'android_tools': ['third_party/android_tools/LICENSE'],
|
||||
|
@ -62,8 +70,9 @@ LIB_TO_LICENSES_DICT = {
|
|||
}
|
||||
|
||||
SCRIPT_DIR = os.path.dirname(os.path.realpath(sys.argv[0]))
|
||||
CHECKOUT_ROOT = os.path.abspath(os.path.join(SCRIPT_DIR, os.pardir, os.pardir))
|
||||
sys.path.append(os.path.join(CHECKOUT_ROOT, 'build'))
|
||||
WEBRTC_ROOT = os.path.abspath(os.path.join(SCRIPT_DIR, os.pardir, os.pardir))
|
||||
SRC_DIR = FindSrcDirPath()
|
||||
sys.path.append(os.path.join(SRC_DIR, 'build'))
|
||||
import find_depot_tools
|
||||
|
||||
THIRD_PARTY_LIB_REGEX = r'^.*/third_party/([\w\-+]+).*$'
|
||||
|
@ -101,7 +110,7 @@ class LicenseBuilder(object):
|
|||
target,
|
||||
]
|
||||
logging.debug("Running: %r", cmd)
|
||||
output_json = subprocess.check_output(cmd, cwd=CHECKOUT_ROOT)
|
||||
output_json = subprocess.check_output(cmd, cwd=WEBRTC_ROOT)
|
||||
logging.debug("Output: %s", output_json)
|
||||
return output_json
|
||||
|
||||
|
@ -147,7 +156,7 @@ class LicenseBuilder(object):
|
|||
output_license_file.write('# %s\n' % license_lib)
|
||||
output_license_file.write('```\n')
|
||||
for path in LIB_TO_LICENSES_DICT[license_lib]:
|
||||
license_path = os.path.join(CHECKOUT_ROOT, path)
|
||||
license_path = os.path.join(WEBRTC_ROOT, path)
|
||||
with open(license_path, 'r') as license_file:
|
||||
license_text = cgi.escape(license_file.read(), quote=True)
|
||||
output_license_file.write(license_text)
|
||||
|
|
|
@ -14,8 +14,15 @@ import sys
|
|||
import tempfile
|
||||
|
||||
|
||||
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
|
||||
SRC_DIR = os.path.normpath(os.path.join(SCRIPT_DIR, os.pardir, os.pardir))
|
||||
def FindSrcDirPath():
|
||||
"""Returns the abs path to the src/ dir of the project."""
|
||||
src_dir = os.path.dirname(os.path.abspath(__file__))
|
||||
while os.path.basename(src_dir) != 'src':
|
||||
src_dir = os.path.normpath(os.path.join(src_dir, os.pardir))
|
||||
return src_dir
|
||||
|
||||
|
||||
SRC_DIR = FindSrcDirPath()
|
||||
sys.path.append(os.path.join(SRC_DIR, 'build'))
|
||||
import find_depot_tools
|
||||
|
||||
|
|
Loading…
Reference in a new issue