upload-symbols.py 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. #!/usr/bin/env python
  2. import os
  3. import glob
  4. import sys
  5. from lib.config import PLATFORM, s3_config, enable_verbose_mode
  6. from lib.util import get_electron_branding, execute, rm_rf, safe_mkdir, s3put, \
  7. get_out_dir
  8. SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
  9. RELEASE_DIR = get_out_dir()
  10. PROJECT_NAME = get_electron_branding()['project_name']
  11. PRODUCT_NAME = get_electron_branding()['product_name']
  12. SYMBOLS_DIR = os.path.join(RELEASE_DIR, 'breakpad_symbols')
  13. PDB_LIST = [
  14. os.path.join(RELEASE_DIR, '{0}.exe.pdb'.format(PROJECT_NAME))
  15. ]
  16. def main():
  17. os.chdir(SOURCE_ROOT)
  18. if PLATFORM == 'win32':
  19. for pdb in PDB_LIST:
  20. run_symstore(pdb, SYMBOLS_DIR, PRODUCT_NAME)
  21. files = glob.glob(SYMBOLS_DIR + '/*.pdb/*/*.pdb')
  22. else:
  23. files = glob.glob(SYMBOLS_DIR + '/*/*/*.sym')
  24. # The file upload needs to be atom-shell/symbols/:symbol_name/:hash/:symbol
  25. os.chdir(SYMBOLS_DIR)
  26. files = [os.path.relpath(f, os.getcwd()) for f in files]
  27. # The symbol server needs lowercase paths, it will fail otherwise
  28. # So lowercase all the file paths here
  29. files = [f.lower() for f in files]
  30. bucket, access_key, secret_key = s3_config()
  31. upload_symbols(bucket, access_key, secret_key, files)
  32. def run_symstore(pdb, dest, product):
  33. execute(['symstore', 'add', '/r', '/f', pdb, '/s', dest, '/t', product])
  34. def upload_symbols(bucket, access_key, secret_key, files):
  35. s3put(bucket, access_key, secret_key, SYMBOLS_DIR, 'atom-shell/symbols',
  36. files)
  37. if __name__ == '__main__':
  38. sys.exit(main())