Flutter Engine
The Flutter Engine
Functions | Variables
upload_to_symbol_server Namespace Reference

Functions

def remote_filename (exec_path)
 
def exists_remotely (remote_path)
 
def process_symbols (should_upload, symbol_dir)
 
def main ()
 

Variables

 BUILD_ROOT_DIR = os.path.abspath(os.path.join(os.path.realpath(__file__), '..', '..', '..', '..'))
 Path to the engine root checkout. More...
 
string FUCHSIA_ARTIFACTS_DEBUG_NAMESPACE = 'debug'
 
string FUCHSIA_ARTIFACTS_BUCKET_NAME = 'fuchsia-artifacts-release'
 

Function Documentation

◆ exists_remotely()

def upload_to_symbol_server.exists_remotely (   remote_path)

Definition at line 33 of file upload_to_symbol_server.py.

33def exists_remotely(remote_path):
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()
39 if return_code == 0:
40 print('%s exists - skipping copy' % remote_path)
41 return return_code == 0
42
43
def print(*args, **kwargs)
Definition: run_tests.py:49

◆ main()

def upload_to_symbol_server.main ( )

Definition at line 69 of file upload_to_symbol_server.py.

69def main():
70 parser = argparse.ArgumentParser()
71
72 parser.add_argument(
73 '--symbol-dir', required=True, help='Directory that contain the debug symbols.'
74 )
75 parser.add_argument('--engine-version', required=True, help='Specifies the flutter engine SHA.')
76 parser.add_argument(
77 '--upload', default=False, action='store_true', help='If set, uploads symbols to the server.'
78 )
79
80 args = parser.parse_args()
81
82 should_upload = args.upload
83 engine_version = args.engine_version
84 if not engine_version:
85 engine_version = 'HEAD'
86 should_upload = False
87
88 process_symbols(should_upload, args.symbol_dir)
89 return 0
90
91
def process_symbols(should_upload, symbol_dir)

◆ process_symbols()

def upload_to_symbol_server.process_symbols (   should_upload,
  symbol_dir 
)

Definition at line 44 of file upload_to_symbol_server.py.

44def process_symbols(should_upload, symbol_dir):
45 full_path = os.path.join(BUILD_ROOT_DIR, symbol_dir)
46
47 files = []
48 for (dirpath, dirnames, filenames) in os.walk(full_path):
49 files.extend([os.path.join(dirpath, f) for f in filenames])
50
51 print('List of files to upload')
52 print('\n'.join(files))
53
54 # Remove dbg_files
55 files = [f for f in files if 'dbg_success' not in f]
56
57 for file in files:
58 remote_path = 'gs://%s/%s/%s' % (
59 FUCHSIA_ARTIFACTS_BUCKET_NAME, FUCHSIA_ARTIFACTS_DEBUG_NAMESPACE, remote_filename(file)
60 )
61 if should_upload and not exists_remotely(remote_path):
62 gsutil = os.path.join(os.environ['DEPOT_TOOLS'], 'gsutil.py')
63 command = ['python3', gsutil, '--', 'cp', file, remote_path]
64 subprocess.check_call(command)
65 else:
66 print(remote_path)
67
68
static SkString join(const CommandLineFlags::StringArray &)
Definition: skpbench.cpp:741

◆ remote_filename()

def upload_to_symbol_server.remote_filename (   exec_path)

Definition at line 22 of file upload_to_symbol_server.py.

22def remote_filename(exec_path):
23 # An example of exec_path is:
24 # out/fuchsia_debug_x64/flutter-fuchsia-x64/d4/917f5976.debug
25 # In the above example "d4917f5976" is the elf BuildID for the
26 # executable. First 2 characters are used as the directory name
27 # and the rest of the string is the name of the unstripped executable.
28 parts = exec_path.split('/')
29 # We want d4917f5976.debug as the result.
30 return ''.join(parts[-2:])
31
32

Variable Documentation

◆ BUILD_ROOT_DIR

upload_to_symbol_server.BUILD_ROOT_DIR = os.path.abspath(os.path.join(os.path.realpath(__file__), '..', '..', '..', '..'))

Path to the engine root checkout.

This is used to calculate absolute paths if relative ones are passed to the script.

Definition at line 17 of file upload_to_symbol_server.py.

◆ FUCHSIA_ARTIFACTS_BUCKET_NAME

string upload_to_symbol_server.FUCHSIA_ARTIFACTS_BUCKET_NAME = 'fuchsia-artifacts-release'

Definition at line 19 of file upload_to_symbol_server.py.

◆ FUCHSIA_ARTIFACTS_DEBUG_NAMESPACE

string upload_to_symbol_server.FUCHSIA_ARTIFACTS_DEBUG_NAMESPACE = 'debug'

Definition at line 18 of file upload_to_symbol_server.py.