2014-11-07 20:19:26 +08:00
|
|
|
#!/usr/bin/env python
|
|
|
|
|
|
|
|
import os
|
2014-11-07 20:51:25 +08:00
|
|
|
import glob
|
2015-04-12 22:26:00 +08:00
|
|
|
import sys
|
2014-11-07 20:19:26 +08:00
|
|
|
|
2019-06-26 11:32:42 -07:00
|
|
|
sys.path.append(
|
|
|
|
os.path.abspath(os.path.dirname(os.path.abspath(__file__)) + "/../.."))
|
2019-06-24 10:18:04 -07:00
|
|
|
|
2018-05-23 12:53:48 -07:00
|
|
|
from lib.config import PLATFORM, s3_config, enable_verbose_mode
|
2018-09-28 11:24:25 +10:00
|
|
|
from lib.util import get_electron_branding, execute, rm_rf, safe_mkdir, s3put, \
|
2019-06-24 10:18:04 -07:00
|
|
|
get_out_dir, ELECTRON_DIR
|
2014-11-07 20:19:26 +08:00
|
|
|
|
2018-09-28 11:24:25 +10:00
|
|
|
RELEASE_DIR = get_out_dir()
|
2015-04-12 22:26:00 +08:00
|
|
|
|
2018-09-27 13:53:08 -05:00
|
|
|
|
|
|
|
PROJECT_NAME = get_electron_branding()['project_name']
|
|
|
|
PRODUCT_NAME = get_electron_branding()['product_name']
|
2018-11-14 12:47:01 -08:00
|
|
|
SYMBOLS_DIR = os.path.join(RELEASE_DIR, 'breakpad_symbols')
|
2018-05-23 12:53:48 -07:00
|
|
|
|
2014-11-07 20:19:26 +08:00
|
|
|
PDB_LIST = [
|
2018-09-28 11:24:25 +10:00
|
|
|
os.path.join(RELEASE_DIR, '{0}.exe.pdb'.format(PROJECT_NAME))
|
2014-11-07 20:19:26 +08:00
|
|
|
]
|
|
|
|
|
|
|
|
|
|
|
|
def main():
|
2019-06-24 10:18:04 -07:00
|
|
|
os.chdir(ELECTRON_DIR)
|
2018-05-23 12:53:48 -07:00
|
|
|
if PLATFORM == 'win32':
|
|
|
|
for pdb in PDB_LIST:
|
|
|
|
run_symstore(pdb, SYMBOLS_DIR, PRODUCT_NAME)
|
|
|
|
files = glob.glob(SYMBOLS_DIR + '/*.pdb/*/*.pdb')
|
|
|
|
else:
|
|
|
|
files = glob.glob(SYMBOLS_DIR + '/*/*/*.sym')
|
2019-02-12 14:10:24 -08:00
|
|
|
|
|
|
|
# The file upload needs to be atom-shell/symbols/:symbol_name/:hash/:symbol
|
|
|
|
os.chdir(SYMBOLS_DIR)
|
|
|
|
files = [os.path.relpath(f, os.getcwd()) for f in files]
|
|
|
|
|
2018-10-18 17:18:35 -07:00
|
|
|
# The symbol server needs lowercase paths, it will fail otherwise
|
|
|
|
# So lowercase all the file paths here
|
|
|
|
files = [f.lower() for f in files]
|
2014-11-07 20:19:26 +08:00
|
|
|
|
2014-11-07 20:51:25 +08:00
|
|
|
bucket, access_key, secret_key = s3_config()
|
|
|
|
upload_symbols(bucket, access_key, secret_key, files)
|
|
|
|
|
2014-11-07 20:19:26 +08:00
|
|
|
|
|
|
|
def run_symstore(pdb, dest, product):
|
|
|
|
execute(['symstore', 'add', '/r', '/f', pdb, '/s', dest, '/t', product])
|
|
|
|
|
|
|
|
|
2014-11-07 20:51:25 +08:00
|
|
|
def upload_symbols(bucket, access_key, secret_key, files):
|
2014-11-10 23:33:56 +08:00
|
|
|
s3put(bucket, access_key, secret_key, SYMBOLS_DIR, 'atom-shell/symbols',
|
|
|
|
files)
|
2014-11-07 20:51:25 +08:00
|
|
|
|
|
|
|
|
2014-11-07 20:19:26 +08:00
|
|
|
if __name__ == '__main__':
|
|
|
|
sys.exit(main())
|