Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: tools/clang/scripts/package.py

Issue 2709613004: upload clang pdbs to chrome's symbol server (Closed)
Patch Set: . Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | tools/clang/scripts/update.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2015 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2015 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """This script will check out llvm and clang, and then package the results up 6 """This script will check out llvm and clang, and then package the results up
7 to a tgz file.""" 7 to a tgz file."""
8 8
9 import argparse 9 import argparse
10 import fnmatch 10 import fnmatch
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 print 'Uploading %s to Google Cloud Storage...' % archive_name 103 print 'Uploading %s to Google Cloud Storage...' % archive_name
104 exit_code = RunGsutil(gsutil_args) 104 exit_code = RunGsutil(gsutil_args)
105 if exit_code != 0: 105 if exit_code != 0:
106 print "gsutil failed, exit_code: %s" % exit_code 106 print "gsutil failed, exit_code: %s" % exit_code
107 os.exit(exit_code) 107 os.exit(exit_code)
108 else: 108 else:
109 print 'To upload, run:' 109 print 'To upload, run:'
110 print ('gsutil %s' % ' '.join(gsutil_args)) 110 print ('gsutil %s' % ' '.join(gsutil_args))
111 111
112 112
113 def UploadPDBToSymbolServer():
114 assert sys.platform == 'win32'
115 # Upload PDB and binary to the symbol server on Windows. Put them into the
116 # chromium-browser-symsrv bucket, since chrome devs have that in their
117 # _NT_SYMBOL_PATH already. Executable and PDB must be at paths following a
118 # certain pattern for the Microsoft debuggers to be able to load them.
119 # Executable:
120 # chromium-browser-symsrv/clang-cl.exe/ABCDEFAB01234/clang-cl.exe
121 # ABCDEFAB is the executable's timestamp in %08X format, 01234 is the
122 # executable's image size in %x format. tools/symsrc/img_fingerprint.py
123 # can compute this ABCDEFAB01234 string for us, so use that.
124 # XXX put at clang-cl.ex_ and compress? Use symstore.exe?
125 # PDB:
126 # gs://chromium-browser-symsrv/clang-cl.exe.pdb/AABBCCDD/clang-cl.dll.pd_
127 # AABBCCDD here is computed from the output of
128 # dumpbin /all mybinary.exe | find "Format: RSDS"
129 # but tools/symsrc/pdb_fingerprint_from_img.py can compute it already, so
130 # again just use that.
131 sys.path.insert(0, os.path.join(CHROMIUM_DIR, 'tools', 'symsrc'))
132 import img_fingerprint, pdb_fingerprint_from_img
133
134 clang_cl_path = 'bin/clang-cl.exe'
135 clang_cl_id = img_fingerprint.GetImgFingerprint(img_path)
136
137 # The build process builds clang.exe and then copies it to clang-cl.exe
138 # (both are the same binary and they behave differently on what their
139 # filename is). Hence, the pdb is at clang.pdb, not at clang-cl.pdb.
140 clang_pdb_path = 'bin/clang.pdb'
141 clang_pdb_id, = img_fingerprint.GetImgFingerprint(img_path)
142 (clang_pdb_id, clang_pdb_path2) = \
143 pdb_fingerprint_from_img.GetPDBInfoFromImg(img_path)
144 assert clang_pdb_path == clang_pdb_path2 # XXX
145
146 # XXX compress
147
148 gsutil_args = ['cp', '-n', '-a', 'public-read', clang_cl_path,
149 'gs://chromium-browser-symsrv/clang-cl.exe/%s/clang-cl.exe' %
150 img_id]
151 if RunGsutil(gsutil_args) != 0:
152 print "gsutil failed"
153 os.exit(1)
154
155 gsutil_args = ['cp', '-n', '-a', 'public-read', clang_pdb_path,
156 'gs://chromium-browser-symsrv/clang.pdb/%s/clang.pdb' %
Nico 2017/03/08 22:41:12 Should this be clang.pdb/%s/clang.pdb, or clang-cl
157 pdb_id]
158 if RunGsutil(gsutil_args) != 0:
159 print "gsutil failed"
160 os.exit(1)
161
113 def main(): 162 def main():
114 parser = argparse.ArgumentParser(description='build and package clang') 163 parser = argparse.ArgumentParser(description='build and package clang')
115 parser.add_argument('--upload', action='store_true', 164 parser.add_argument('--upload', action='store_true',
116 help='Upload the target archive to Google Cloud Storage.') 165 help='Upload the target archive to Google Cloud Storage.')
117 args = parser.parse_args() 166 args = parser.parse_args()
118 167
119 # Check that the script is not going to upload a toolchain built from HEAD. 168 # Check that the script is not going to upload a toolchain built from HEAD.
120 use_head_revision = 'LLVM_FORCE_HEAD_REVISION' in os.environ 169 use_head_revision = 'LLVM_FORCE_HEAD_REVISION' in os.environ
121 if args.upload and use_head_revision: 170 if args.upload and use_head_revision:
122 print ("--upload and LLVM_FORCE_HEAD_REVISION could not be used " 171 print ("--upload and LLVM_FORCE_HEAD_REVISION could not be used "
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 objdumpdir = 'llvmobjdump-' + stamp 344 objdumpdir = 'llvmobjdump-' + stamp
296 shutil.rmtree(objdumpdir, ignore_errors=True) 345 shutil.rmtree(objdumpdir, ignore_errors=True)
297 os.makedirs(os.path.join(objdumpdir, 'bin')) 346 os.makedirs(os.path.join(objdumpdir, 'bin'))
298 shutil.copy(os.path.join(LLVM_RELEASE_DIR, 'bin', 'llvm-objdump' + exe_ext), 347 shutil.copy(os.path.join(LLVM_RELEASE_DIR, 'bin', 'llvm-objdump' + exe_ext),
299 os.path.join(objdumpdir, 'bin')) 348 os.path.join(objdumpdir, 'bin'))
300 with tarfile.open(objdumpdir + '.tgz', 'w:gz') as tar: 349 with tarfile.open(objdumpdir + '.tgz', 'w:gz') as tar:
301 tar.add(os.path.join(objdumpdir, 'bin'), arcname='bin', 350 tar.add(os.path.join(objdumpdir, 'bin'), arcname='bin',
302 filter=PrintTarProgress) 351 filter=PrintTarProgress)
303 MaybeUpload(args, objdumpdir, platform) 352 MaybeUpload(args, objdumpdir, platform)
304 353
354 if sys.platform == 'win32' and args.upload:
355 UploadPDBToSymbolServer()
356
305 # FIXME: Warn if the file already exists on the server. 357 # FIXME: Warn if the file already exists on the server.
306 358
307 359
308 if __name__ == '__main__': 360 if __name__ == '__main__':
309 sys.exit(main()) 361 sys.exit(main())
OLDNEW
« no previous file with comments | « no previous file | tools/clang/scripts/update.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698