Moving src/webrtc into src/.

In order to eliminate the WebRTC Subtree mirror in Chromium, 
WebRTC is moving the content of the src/webrtc directory up
to the src/ directory.

NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
TBR=tommi@webrtc.org

Bug: chromium:611808
Change-Id: Iac59c5b51b950f174119565bac87955a7994bc38
Reviewed-on: https://webrtc-review.googlesource.com/1560
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Henrik Kjellander <kjellander@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#19845}
This commit is contained in:
Mirko Bonadei
2017-09-15 06:15:48 +02:00
committed by Commit Bot
parent 6674846b4a
commit bb547203bf
4576 changed files with 1092 additions and 1196 deletions

View File

@ -0,0 +1,38 @@
This directory contains prebuilt tools used during end-to-end tests.
They will be downloaded by their SHA1 hash, and are not meant to be checked in.
Updating prebuilt_apprtc.zip:
- Follow AppRTC instructions:
- `git clone https://github.com/webrtc/apprtc`
- Install NodeJS:
- Download <https://nodejs.org/> and extract it
- `export PATH="$(pwd)/node-v6.10.3-linux-x64/bin:$PATH"`
- `cd apprtc`
- `npm install`
- `export PATH="$(pwd)/node_modules/.bin:$PATH"`
- `pip install --user --upgrade pip setuptools` - needed only on old systems
- `grunt`
- Vendor collider's dependencies:
- `ln -s "$(pwd)/src/collider" src/src`
- `GOPATH="$(pwd)/src" go get -d collidermain`
- `rm src/src`
- Remove unneeded files:
- `rm -rf .git node_modules browsers`
- `zip -r prebuilt_apprtc.zip apprtc/`
- `mv prebuilt_apprtc.zip webrtc/src/webrtc/rtc_tools/testing/prebuilt_apprtc.zip`
Updating golang/*:
- Go to <https://golang.org/dl/>
- Download these files:
- go*.linux-amd64.tar.gz -> golang/linux/go.tar.gz
- go*.darwin-amd64.tar.gz -> golang/mac/go.tar.gz
- go*.windows-amd64.zip -> golang/windows/go.zip
After updating the archives:
- `cd webrtc/src/webrtc/rtc_tools/testing`
- For each updated archive:
- `upload_to_google_storage.py file.zip --bucket=chromium-webrtc-resources`
- `git commit -a && git cl upload`

View File

@ -0,0 +1,57 @@
#!/usr/bin/env python
# Copyright (c) 2017 The WebRTC project authors. All Rights Reserved.
#
# Use of this source code is governed by a BSD-style license
# that can be found in the LICENSE file in the root of the source
# tree. An additional intellectual property rights grant can be found
# in the file PATENTS. All contributing project authors may
# be found in the AUTHORS file in the root of the source tree.
"""Builds the AppRTC collider using the golang toolchain.
The golang toolchain is downloaded by download_apprtc.py. We use that here
to build the AppRTC collider server.
This script needs to know the path to the 'src' directory in apprtc, the
root directory of 'go' and the output_dir.
"""
import os
import shutil
import subprocess
import sys
import utils
USAGE_STR = "Usage: {} <apprtc_src_dir> <go_dir> <output_dir>"
def main(argv):
if len(argv) != 4:
return USAGE_STR.format(argv[0])
apprtc_dir = os.path.abspath(argv[1])
go_root_dir = os.path.abspath(argv[2])
golang_workspace = os.path.abspath(argv[3])
utils.RemoveDirectory(golang_workspace)
golang_workspace_src = os.path.join(golang_workspace, 'src')
collider_dir = os.path.join(apprtc_dir, 'collider')
shutil.copytree(collider_dir, golang_workspace_src)
golang_binary = 'go%s' % ('.exe' if utils.GetPlatform() == 'win' else '')
golang_path = os.path.join(go_root_dir, 'bin', golang_binary)
golang_env = os.environ.copy()
golang_env['GOROOT'] = go_root_dir
golang_env['GOPATH'] = golang_workspace
collider_exec = os.path.join(golang_workspace, 'collidermain')
subprocess.check_call([golang_path, 'build', '-o', collider_exec,
'collidermain'], env=golang_env)
if __name__ == '__main__':
sys.exit(main(sys.argv))

View File

@ -0,0 +1,58 @@
#!/usr/bin/env python
# Copyright (c) 2017 The WebRTC project authors. All Rights Reserved.
#
# Use of this source code is governed by a BSD-style license
# that can be found in the LICENSE file in the root of the source
# tree. An additional intellectual property rights grant can be found
# in the file PATENTS. All contributing project authors may
# be found in the AUTHORS file in the root of the source tree.
"""Downloads prebuilt AppRTC and Go from WebRTC storage and unpacks it.
Requires that depot_tools is installed and in the PATH.
It downloads compressed files in the directory where the script lives.
This is because the precondition is that the script lives in the same
directory of the .sha1 files.
"""
import os
import sys
import utils
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
def _GetGoArchivePathForPlatform():
archive_extension = 'zip' if utils.GetPlatform() == 'win' else 'tar.gz'
return os.path.join(utils.GetPlatform(), 'go.%s' % archive_extension)
def main(argv):
if len(argv) > 2:
return 'Usage: %s [output_dir]' % argv[0]
output_dir = os.path.abspath(argv[1]) if len(argv) > 1 else None
apprtc_zip_path = os.path.join(SCRIPT_DIR, 'prebuilt_apprtc.zip')
if os.path.isfile(apprtc_zip_path + '.sha1'):
utils.DownloadFilesFromGoogleStorage(SCRIPT_DIR, auto_platform=False)
if output_dir is not None:
utils.RemoveDirectory(os.path.join(output_dir, 'apprtc'))
utils.UnpackArchiveTo(apprtc_zip_path, output_dir)
golang_path = os.path.join(SCRIPT_DIR, 'golang')
golang_zip_path = os.path.join(golang_path, _GetGoArchivePathForPlatform())
if os.path.isfile(golang_zip_path + '.sha1'):
utils.DownloadFilesFromGoogleStorage(golang_path)
if output_dir is not None:
utils.RemoveDirectory(os.path.join(output_dir, 'go'))
utils.UnpackArchiveTo(golang_zip_path, output_dir)
if __name__ == '__main__':
sys.exit(main(sys.argv))

View File

@ -0,0 +1 @@
a433f76c569055ff8536d796995518dd91a9fa5b

View File

@ -0,0 +1 @@
aecf5ec9360a004fdbff181269554892743f4bf6

View File

@ -0,0 +1 @@
26bf854fb81f12e9c80a146d8f0081cd22ae9d02

View File

@ -0,0 +1 @@
d8d95f55129e0c1a4e0f5d0d3acbf7163395354c

View File

@ -0,0 +1,44 @@
#!/usr/bin/env python
# Copyright (c) 2017 The WebRTC project authors. All Rights Reserved.
#
# Use of this source code is governed by a BSD-style license
# that can be found in the LICENSE file in the root of the source
# tree. An additional intellectual property rights grant can be found
# in the file PATENTS. All contributing project authors may
# be found in the AUTHORS file in the root of the source tree.
"""This script sets up AppRTC and its dependencies.
Requires that depot_tools is installed and in the PATH.
It will put the result under <output_dir>/collider.
"""
import os
import sys
import utils
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
def main(argv):
if len(argv) == 1:
return 'Usage %s <output_dir>' % argv[0]
output_dir = os.path.abspath(argv[1])
download_apprtc_path = os.path.join(SCRIPT_DIR, 'download_apprtc.py')
utils.RunSubprocessWithRetry([download_apprtc_path, output_dir])
build_apprtc_path = os.path.join(SCRIPT_DIR, 'build_apprtc.py')
apprtc_src_dir = os.path.join(output_dir, 'apprtc', 'src')
go_dir = os.path.join(output_dir, 'go')
collider_dir = os.path.join(output_dir, 'collider')
utils.RunSubprocessWithRetry([build_apprtc_path, apprtc_src_dir,
go_dir, collider_dir])
if __name__ == '__main__':
sys.exit(main(sys.argv))

120
rtc_tools/testing/utils.py Executable file
View File

@ -0,0 +1,120 @@
#!/usr/bin/env python
# Copyright (c) 2017 The WebRTC project authors. All Rights Reserved.
#
# Use of this source code is governed by a BSD-style license
# that can be found in the LICENSE file in the root of the source
# tree. An additional intellectual property rights grant can be found
# in the file PATENTS. All contributing project authors may
# be found in the AUTHORS file in the root of the source tree.
"""Utilities for all our deps-management stuff."""
import os
import shutil
import sys
import subprocess
import tarfile
import time
import zipfile
def RunSubprocessWithRetry(cmd):
"""Invokes the subprocess and backs off exponentially on fail."""
for i in range(5):
try:
subprocess.check_call(cmd)
return
except subprocess.CalledProcessError as exception:
backoff = pow(2, i)
print 'Got %s, retrying in %d seconds...' % (exception, backoff)
time.sleep(backoff)
print 'Giving up.'
raise exception
def DownloadFilesFromGoogleStorage(path, auto_platform=True):
print 'Downloading files in %s...' % path
extension = 'bat' if 'win32' in sys.platform else 'py'
cmd = ['download_from_google_storage.%s' % extension,
'--bucket=chromium-webrtc-resources',
'--directory', path]
if auto_platform:
cmd += ['--auto_platform', '--recursive']
subprocess.check_call(cmd)
# Code partially copied from
# https://cs.chromium.org#chromium/build/scripts/common/chromium_utils.py
def RemoveDirectory(*path):
"""Recursively removes a directory, even if it's marked read-only.
Remove the directory located at *path, if it exists.
shutil.rmtree() doesn't work on Windows if any of the files or directories
are read-only, which svn repositories and some .svn files are. We need to
be able to force the files to be writable (i.e., deletable) as we traverse
the tree.
Even with all this, Windows still sometimes fails to delete a file, citing
a permission error (maybe something to do with antivirus scans or disk
indexing). The best suggestion any of the user forums had was to wait a
bit and try again, so we do that too. It's hand-waving, but sometimes it
works. :/
"""
file_path = os.path.join(*path)
print 'Deleting `{}`.'.format(file_path)
if not os.path.exists(file_path):
print '`{}` does not exist.'.format(file_path)
return
if sys.platform == 'win32':
# Give up and use cmd.exe's rd command.
file_path = os.path.normcase(file_path)
for _ in xrange(3):
print 'RemoveDirectory running %s' % (' '.join(
['cmd.exe', '/c', 'rd', '/q', '/s', file_path]))
if not subprocess.call(['cmd.exe', '/c', 'rd', '/q', '/s', file_path]):
break
print ' Failed'
time.sleep(3)
return
else:
shutil.rmtree(file_path, ignore_errors=True)
def UnpackArchiveTo(archive_path, output_dir):
extension = os.path.splitext(archive_path)[1]
if extension == '.zip':
_UnzipArchiveTo(archive_path, output_dir)
else:
_UntarArchiveTo(archive_path, output_dir)
def _UnzipArchiveTo(archive_path, output_dir):
print 'Unzipping {} in {}.'.format(archive_path, output_dir)
zip_file = zipfile.ZipFile(archive_path)
try:
zip_file.extractall(output_dir)
finally:
zip_file.close()
def _UntarArchiveTo(archive_path, output_dir):
print 'Untarring {} in {}.'.format(archive_path, output_dir)
tar_file = tarfile.open(archive_path, 'r:gz')
try:
tar_file.extractall(output_dir)
finally:
tar_file.close()
def GetPlatform():
if sys.platform.startswith('win'):
return 'win'
if sys.platform.startswith('linux'):
return 'linux'
if sys.platform.startswith('darwin'):
return 'mac'
raise Exception("Can't run on platform %s." % sys.platform)