Generate and upload breakpad symbols if BREAKPAD_SYMBOL_SERVER variable is set. (bug 5229, r=dvander)
Generate and upload breakpad symbols if BREAKPAD_SYMBOL_SERVER variable is set. (
bug 5229, r=dvander)
1.1 --- a/AMBuildScript Thu Feb 16 19:26:49 2012 +0000
1.2 +++ b/AMBuildScript Fri Feb 17 03:28:02 2012 +0000
1.3 @@ -401,7 +401,8 @@
1.4 ['sourcepawn', 'jit', 'AMBuilder'],
1.5 ['sourcepawn', 'compiler', 'AMBuilder'],
1.6 ['plugins', 'AMBuilder'],
1.7 - ['tools', 'buildbot', 'PackageScript']
1.8 + ['tools', 'buildbot', 'PackageScript'],
1.9 + ['tools', 'buildbot', 'BreakpadSymbols']
1.10 ]
1.11
1.12 for parts in FileList:
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2.2 +++ b/tools/buildbot/BreakpadSymbols Fri Feb 17 03:28:02 2012 +0000
2.3 @@ -0,0 +1,41 @@
2.4 +# vim: set ts=2 sw=2 tw=99 noet ft=python:
2.5 +import os
2.6 +import urllib.request
2.7 +from ambuild.command import Command
2.8 +from ambuild.command import ShellCommand
2.9 +
2.10 +class IterateDebugInfoCommand(Command):
2.11 + def run(self, master, job):
2.12 + pdblog = open(os.path.join(AMBuild.outputFolder, 'pdblog.txt'), 'rt')
2.13 + for debug_info in pdblog:
2.14 + debug_info = os.path.join(AMBuild.outputFolder, debug_info.strip())
2.15 + job.AddCommand(SymbolCommand(debug_info, symbolServer))
2.16 + pdblog.close()
2.17 +
2.18 +class SymbolCommand(ShellCommand):
2.19 + def __init__(self, debugFile, symbolServer):
2.20 + self.serverResponse = None
2.21 + self.symbolServer = symbolServer
2.22 + if AMBuild.target['platform'] == 'linux':
2.23 + cmdstring = "dump_syms {0} {1}".format(debugFile, os.path.dirname(debugFile))
2.24 + elif AMBuild.target['platform'] == 'darwin':
2.25 + cmdstring = "dump_syms {0}".format(debugFile)
2.26 + elif AMBuild.target['platform'] == 'windows':
2.27 + cmdstring = "dump_syms.exe {0}".format(debugFile)
2.28 + ShellCommand.__init__(self, cmdstring)
2.29 + def run(self, master, job):
2.30 + ShellCommand.run(self, master, job)
2.31 + if self.stdout != None and len(self.stdout) > 0:
2.32 + request = urllib.request.Request(symbolServer, self.stdout.encode('utf-8'))
2.33 + request.add_header("Content-Type", "text/plain")
2.34 + self.serverResponse = urllib.request.urlopen(request).read().decode('utf-8')
2.35 + def spew(self, runner):
2.36 + if self.stderr != None and len(self.stderr) > 0:
2.37 + runner.PrintOut(self.stderr)
2.38 + if self.serverResponse != None and len(self.serverResponse) > 0:
2.39 + runner.PrintOut(self.serverResponse)
2.40 +
2.41 +if 'BREAKPAD_SYMBOL_SERVER' in os.environ:
2.42 + symbolServer = os.environ['BREAKPAD_SYMBOL_SERVER']
2.43 + job = AMBuild.AddJob('breakpad-symbols')
2.44 + job.AddCommand(IterateDebugInfoCommand())
3.1 --- a/tools/buildbot/PackageScript Thu Feb 16 19:26:49 2012 +0000
3.2 +++ b/tools/buildbot/PackageScript Fri Feb 17 03:28:02 2012 +0000
3.3 @@ -186,7 +186,14 @@
3.4 def AddNormalLibrary(name, dest):
3.5 dest = os.path.join('addons', 'sourcemod', dest)
3.6 bincopies.append(CopyFile(os.path.join('..', name, name + osutil.SharedLibSuffix()), dest))
3.7 - pdb_list.append(name + '\\' + name + '.pdb')
3.8 +
3.9 + # Each platform's version of dump_syms needs the path in a different format.
3.10 + if AMBuild.target['platform'] == 'linux':
3.11 + debug_info.append(name + '/' + name + '.so')
3.12 + elif AMBuild.target['platform'] == 'darwin':
3.13 + debug_info.append(name + '/' + name + '.dylib.dSYM')
3.14 + elif AMBuild.target['platform'] == 'windows':
3.15 + debug_info.append(name + '\\' + name + '.pdb')
3.16
3.17 def AddHL2Library(name, dest):
3.18 for i in SM.sdkInfo:
3.19 @@ -195,18 +202,20 @@
3.20 continue
3.21 AddNormalLibrary(name + '.' + sdk['ext'], dest)
3.22
3.23 -pdb_list = []
3.24 +debug_info = []
3.25
3.26 if AMBuild.target['platform'] == 'linux':
3.27 bincopies.append(CopyFile(os.path.join('..', 'loader', 'sourcemod_mm_i486.so'),
3.28 os.path.join('addons', 'sourcemod', 'bin')))
3.29 + debug_info.append('loader/sourcemod_mm_i486.so')
3.30 elif AMBuild.target['platform'] == 'darwin':
3.31 bincopies.append(CopyFile(os.path.join('..', 'loader', 'sourcemod_mm.dylib'),
3.32 os.path.join('addons', 'sourcemod', 'bin')))
3.33 + debug_info.append('loader/sourcemod_mm.dylib.dSYM')
3.34 elif AMBuild.target['platform'] == 'windows':
3.35 bincopies.append(CopyFile(os.path.join('..', 'loader', 'sourcemod_mm.dll'),
3.36 os.path.join('addons', 'sourcemod', 'bin')))
3.37 - pdb_list.append('loader\\sourcemod_mm.pdb')
3.38 + debug_info.append('loader\\sourcemod_mm.pdb')
3.39
3.40 AddHL2Library('sourcemod', 'bin')
3.41 AddNormalLibrary('sourcemod.logic', 'bin')
3.42 @@ -233,8 +242,9 @@
3.43 job.AddCommand(CopyFile(
3.44 os.path.join(AMBuild.sourceFolder, 'sourcepawn', 'batchtool', 'compile.exe'),
3.45 os.path.join('addons', 'sourcemod', 'scripting')))
3.46 - pdblog = open(os.path.join(AMBuild.outputFolder, 'pdblog.txt'), 'wt')
3.47 - for pdb in pdb_list:
3.48 - pdblog.write(pdb + '\n')
3.49 - pdblog.close()
3.50 +
3.51 +pdblog = open(os.path.join(AMBuild.outputFolder, 'pdblog.txt'), 'wt')
3.52 +for pdb in debug_info:
3.53 + pdblog.write(pdb + '\n')
3.54 +pdblog.close()
3.55