7"""Uploads debug symbols to the symbols server."""
17BUILD_ROOT_DIR = os.path.abspath(os.path.join(os.path.realpath(__file__),
'..',
'..',
'..',
'..'))
18FUCHSIA_ARTIFACTS_DEBUG_NAMESPACE =
'debug'
19FUCHSIA_ARTIFACTS_BUCKET_NAME =
'fuchsia-artifacts-release'
28 parts = exec_path.split(
'/')
30 return ''.
join(parts[-2:])
34 gsutil = os.path.join(os.environ[
'DEPOT_TOOLS'],
'gsutil.py')
35 command = [
'python3', gsutil,
'--',
'stat', remote_path]
36 process = subprocess.Popen(command, stderr=subprocess.PIPE, stdout=subprocess.PIPE)
37 stdout, stderr = process.communicate()
38 return_code = process.wait()
40 print(
'%s exists - skipping copy' % remote_path)
41 return return_code == 0
45 full_path = os.path.join(BUILD_ROOT_DIR, symbol_dir)
48 for (dirpath, dirnames, filenames)
in os.walk(full_path):
49 files.extend([os.path.join(dirpath, f)
for f
in filenames])
51 print(
'List of files to upload')
55 files = [f
for f
in files
if 'dbg_success' not in f]
58 remote_path =
'gs://%s/%s/%s' % (
59 FUCHSIA_ARTIFACTS_BUCKET_NAME, FUCHSIA_ARTIFACTS_DEBUG_NAMESPACE,
remote_filename(file)
62 gsutil = os.path.join(os.environ[
'DEPOT_TOOLS'],
'gsutil.py')
63 command = [
'python3', gsutil,
'--',
'cp', file, remote_path]
64 subprocess.check_call(command)
70 parser = argparse.ArgumentParser()
73 '--symbol-dir', required=
True, help=
'Directory that contain the debug symbols.'
75 parser.add_argument(
'--engine-version', required=
True, help=
'Specifies the flutter engine SHA.')
77 '--upload', default=
False, action=
'store_true', help=
'If set, uploads symbols to the server.'
80 args = parser.parse_args()
82 should_upload = args.upload
83 engine_version = args.engine_version
84 if not engine_version:
85 engine_version =
'HEAD'
92if __name__ ==
'__main__':
def print(*args, **kwargs)
def process_symbols(should_upload, symbol_dir)
def remote_filename(exec_path)
def exists_remotely(remote_path)
static SkString join(const CommandLineFlags::StringArray &)