mirror of
https://github.com/alliedmodders/metamod-source.git
synced 2024-11-29 11:24:19 +01:00
Merge pull request #15 from alliedmodders/symbol-upload
Add support for Throttle symbol uploading.
This commit is contained in:
commit
58c8100361
@ -429,3 +429,5 @@ if builder.backend == 'amb2':
|
|||||||
|
|
||||||
builder.RunBuildScripts(BuildScripts, { 'MMS': MMS })
|
builder.RunBuildScripts(BuildScripts, { 'MMS': MMS })
|
||||||
|
|
||||||
|
if builder.options.breakpad_dump:
|
||||||
|
builder.RunScript('support/buildbot/BreakpadSymbols', { 'MMS': MMS })
|
||||||
|
@ -25,4 +25,6 @@ run.options.add_option('-s', '--sdks', default='all', dest='sdks',
|
|||||||
'comma-delimited list of engine names (default: %default)')
|
'comma-delimited list of engine names (default: %default)')
|
||||||
run.options.add_option('--enable-tests', default=False, dest='enable_tests', action='store_true',
|
run.options.add_option('--enable-tests', default=False, dest='enable_tests', action='store_true',
|
||||||
help='Build tests.')
|
help='Build tests.')
|
||||||
|
run.options.add_option('--breakpad-dump', action='store_true', dest='breakpad_dump',
|
||||||
|
default=False, help='Dump and upload breakpad symbols')
|
||||||
run.Configure()
|
run.Configure()
|
||||||
|
43
support/buildbot/BreakpadSymbols
Normal file
43
support/buildbot/BreakpadSymbols
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
# vim: set ts=2 sw=2 tw=99 noet ft=python:
|
||||||
|
import os, sys
|
||||||
|
|
||||||
|
builder.SetBuildFolder('symbols')
|
||||||
|
|
||||||
|
UPLOAD_SCRIPT = os.path.join(builder.sourcePath, 'support', 'buildbot', 'upload_symbols.py')
|
||||||
|
|
||||||
|
cxx_tasks = MMS.binaries
|
||||||
|
for cxx_task in cxx_tasks:
|
||||||
|
if builder.target_platform in ['windows']:
|
||||||
|
debug_entry = cxx_task.debug
|
||||||
|
else:
|
||||||
|
debug_entry = cxx_task.binary
|
||||||
|
|
||||||
|
debug_file = os.path.join(builder.buildPath, debug_entry.path)
|
||||||
|
if builder.target_platform == 'linux':
|
||||||
|
argv = ['dump_syms', debug_file, os.path.dirname(debug_file)]
|
||||||
|
elif builder.target_platform == 'mac':
|
||||||
|
argv = ['dump_syms', debug_file]
|
||||||
|
elif builder.target_platform == 'windows':
|
||||||
|
argv = ['dump_syms.exe', debug_file]
|
||||||
|
|
||||||
|
base_file = os.path.splitext(os.path.basename(debug_file))[0]
|
||||||
|
symbol_file = base_file + '.breakpad'
|
||||||
|
|
||||||
|
argv = [sys.executable, UPLOAD_SCRIPT, symbol_file] + argv
|
||||||
|
builder.AddCommand(
|
||||||
|
inputs = [UPLOAD_SCRIPT, debug_entry],
|
||||||
|
argv = argv,
|
||||||
|
outputs = [symbol_file]
|
||||||
|
)
|
||||||
|
|
||||||
|
def run(self, master, job):
|
||||||
|
ShellCommand.run(self, master, job)
|
||||||
|
if self.stdout != None and len(self.stdout) > 0:
|
||||||
|
request = urllib.Request(symbolServer, self.stdout.encode('utf-8'))
|
||||||
|
request.add_header("Content-Type", "text/plain")
|
||||||
|
self.serverResponse = urllib.urlopen(request).read().decode('utf-8')
|
||||||
|
def spew(self, runner):
|
||||||
|
if self.stderr != None and len(self.stderr) > 0:
|
||||||
|
runner.PrintOut(self.stderr)
|
||||||
|
if self.serverResponse != None and len(self.serverResponse) > 0:
|
||||||
|
runner.PrintOut(self.serverResponse)
|
38
support/buildbot/upload_symbols.py
Normal file
38
support/buildbot/upload_symbols.py
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
# vim: ts=8 sts=2 sw=2 tw=99 et ft=python:
|
||||||
|
import sys
|
||||||
|
import subprocess
|
||||||
|
import os
|
||||||
|
try:
|
||||||
|
import urllib.request as urllib
|
||||||
|
except ImportError:
|
||||||
|
import urllib2 as urllib
|
||||||
|
|
||||||
|
if len(sys.argv) < 3:
|
||||||
|
sys.stderr.write('Usage: <symbol-file> <dump-syms-cmd> <args...>\n')
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
SYMBOL_SERVER = os.environ['BREAKPAD_SYMBOL_SERVER']
|
||||||
|
symbol_file = sys.argv[1]
|
||||||
|
cmd_argv = sys.argv[2:]
|
||||||
|
|
||||||
|
sys.stdout.write(' '.join(cmd_argv))
|
||||||
|
sys.stdout.write('\n')
|
||||||
|
|
||||||
|
p = subprocess.Popen(
|
||||||
|
args = cmd_argv,
|
||||||
|
stdout = subprocess.PIPE,
|
||||||
|
stderr = subprocess.PIPE,
|
||||||
|
shell = False
|
||||||
|
)
|
||||||
|
stdout, stderr = p.communicate()
|
||||||
|
out = stdout.decode('utf8')
|
||||||
|
err = stdout.decode('utf8')
|
||||||
|
|
||||||
|
with open(symbol_file, 'w') as fp:
|
||||||
|
fp.write(stdout)
|
||||||
|
fp.write(stderr)
|
||||||
|
|
||||||
|
request = urllib.Request(SYMBOL_SERVER, out)
|
||||||
|
request.add_header('Content-Type', 'text/plain')
|
||||||
|
server_response = urllib.urlopen(request).read().decode('utf8')
|
||||||
|
print(server_response)
|
Loading…
Reference in New Issue
Block a user