Enable automatic uploading of symbol packages to backtrace.io

This commit is contained in:
Roland Rossgotterer
2019-01-28 10:31:41 +01:00
committed by Mat Sutcliffe
parent f0ac008ba3
commit bc930faaa1
2 changed files with 27 additions and 37 deletions

View File

@@ -149,7 +149,7 @@ class Builder:
tar_path = path.abspath(path.join(self._get_swift_source_path(), tar_filename)) tar_path = path.abspath(path.join(self._get_swift_source_path(), tar_filename))
dumper.pack(tar_path) dumper.pack(tar_path)
if upload_symbols: if upload_symbols:
self.__upload_symbol_files(symbol_path) self.__upload_symbol_files(tar_path)
def _get_swift_source_path(self): def _get_swift_source_path(self):
return self.__source_path return self.__source_path
@@ -242,23 +242,18 @@ class Builder:
out = subprocess.check_output(['git', 'log', '-1', '--date=format:"%Y%m%d%H%M"', '--pretty=format:%cd']) out = subprocess.check_output(['git', 'log', '-1', '--date=format:"%Y%m%d%H%M"', '--pretty=format:%cd'])
return out.decode("utf-8").strip('"') return out.decode("utf-8").strip('"')
def __upload_symbol_files(self, symbol_path): def __upload_symbol_files(self, symbols_package):
print('Uploading symbols') print('Uploading symbols')
url = 'http://crashreports.swift-project.org/symfiles' url = 'https://swift-project.sp.backtrace.io:6098/post'
token = '44166372034af002070a1f0ae3c8dfd8632e0210b36577c5269626fe5b87b2f6'
symbol_files = [os.path.join(root, name) data = open(symbols_package, 'rb').read()
for root, dirs, files in os.walk(symbol_path) params = (
for name in files ('format', 'symbols'),
if name.endswith('.sym')] ('token', token),
)
for symbol_file in symbol_files: r = requests.post(url, params=params, data=data)
print ('Uploading ' + symbol_file) r.raise_for_status()
files = [
('symfile', open(symbol_file, 'rb')),
]
data = {'release': self.version}
r = requests.post(url, files=files, data=data)
r.raise_for_status()
class MSVCBuilder(Builder): class MSVCBuilder(Builder):
@@ -383,7 +378,7 @@ def main(argv):
tool_chain = '' tool_chain = ''
dev_build = False dev_build = False
jobs = None jobs = None
upload_symbols = False upload_symbols = True
eolInMonth = 0 eolInMonth = 0
qmake_args = [] qmake_args = []

View File

@@ -3,37 +3,32 @@ import sys
import platform import platform
import requests import requests
def upload_symbol_files(symbol_path, version): def upload_symbol_files(symbols_package):
print('Uploading symbols') print('Uploading symbols')
url = 'http://crashreports.swift-project.org/symfiles' url = 'https://swift-project.sp.backtrace.io:6098/post'
token = '44166372034af002070a1f0ae3c8dfd8632e0210b36577c5269626fe5b87b2f6'
symbol_files = [os.path.join(root, name) print ('Uploading ' + symbols_package)
for root, dirs, files in os.walk(symbol_path) data = open(symbols_package, 'rb').read()
for name in files params = (
if name.endswith('.sym')] ('format', 'symbols'),
('token', token),
for symbol_file in symbol_files: )
print ('Uploading ' + symbol_file) r = requests.post(url, params=params, data=data)
files = [ r.raise_for_status()
('symfile', open(symbol_file, 'rb')),
]
data = {'release': version}
r = requests.post(url, files=files, data=data)
r.raise_for_status()
def print_help(): def print_help():
print('Usage: symbolupload.py <symbol path> <version>') print('Usage: symbolupload.py <symbol path>')
def main(argv): def main(argv):
print len(argv) print len(argv)
if len(argv) != 2: if len(argv) != 1:
print_help() print_help()
sys.exit(2) sys.exit(2)
symbol_path = sys.argv[1] symbols_package = sys.argv[1]
version = sys.argv[2] upload_symbol_files(symbols_package)
upload_symbol_files(symbol_path, version)
if __name__ == '__main__': if __name__ == '__main__':