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

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

Issue 1491203003: Fix downloading LLVM Gold plugin in the case, when Clang is up to date. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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 | no next file » | 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) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 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 """Windows can't run .sh files, so this is a Python implementation of 6 """Windows can't run .sh files, so this is a Python implementation of
7 update.sh. This script should replace update.sh on all platforms eventually.""" 7 update.sh. This script should replace update.sh on all platforms eventually."""
8 8
9 import argparse 9 import argparse
10 import cStringIO 10 import cStringIO
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 # Use gyp to find the MSVS installation, either in depot_tools as per above, 294 # Use gyp to find the MSVS installation, either in depot_tools as per above,
295 # or a system-wide installation otherwise. 295 # or a system-wide installation otherwise.
296 sys.path.append(os.path.join(CHROMIUM_DIR, 'tools', 'gyp', 'pylib')) 296 sys.path.append(os.path.join(CHROMIUM_DIR, 'tools', 'gyp', 'pylib'))
297 import gyp.MSVSVersion 297 import gyp.MSVSVersion
298 vs_version = gyp.MSVSVersion.SelectVisualStudioVersion('2013') 298 vs_version = gyp.MSVSVersion.SelectVisualStudioVersion('2013')
299 return vs_version 299 return vs_version
300 300
301 301
302 def UpdateClang(args): 302 def UpdateClang(args):
303 print 'Updating Clang to %s...' % PACKAGE_VERSION 303 print 'Updating Clang to %s...' % PACKAGE_VERSION
304
305 need_gold_plugin = 'LLVM_DOWNLOAD_GOLD_PLUGIN' in os.environ or (
306 sys.platform.startswith('linux') and
307 'buildtype=Official' in os.environ.get('GYP_DEFINES', '') and
308 'branding=Chrome' in os.environ.get('GYP_DEFINES', ''))
309
304 if ReadStampFile() == PACKAGE_VERSION: 310 if ReadStampFile() == PACKAGE_VERSION:
305 print 'Already up to date.' 311 print 'Clang is already up to date.'
Adrian Kuegel 2015/12/03 09:29:26 I think this early return breaks the case if you w
306 return 0 312 if not need_gold_plugin or os.path.exists(
313 os.path.join(LLVM_BUILD_DIR, "lib/LLVMgold.so")):
314 return 0
307 315
308 # Reset the stamp file in case the build is unsuccessful. 316 # Reset the stamp file in case the build is unsuccessful.
309 WriteStampFile('') 317 WriteStampFile('')
310 318
311 if not args.force_local_build: 319 if not args.force_local_build:
312 cds_file = "clang-%s.tgz" % PACKAGE_VERSION 320 cds_file = "clang-%s.tgz" % PACKAGE_VERSION
313 if sys.platform == 'win32': 321 if sys.platform == 'win32':
314 cds_full_url = CDS_URL + '/Win/' + cds_file 322 cds_full_url = CDS_URL + '/Win/' + cds_file
315 elif sys.platform == 'darwin': 323 elif sys.platform == 'darwin':
316 cds_full_url = CDS_URL + '/Mac/' + cds_file 324 cds_full_url = CDS_URL + '/Mac/' + cds_file
317 else: 325 else:
318 assert sys.platform.startswith('linux') 326 assert sys.platform.startswith('linux')
319 cds_full_url = CDS_URL + '/Linux_x64/' + cds_file 327 cds_full_url = CDS_URL + '/Linux_x64/' + cds_file
320 328
321 # Check if there's a prebuilt binary and if so just fetch that. That's 329 # Check if there's a prebuilt binary and if so just fetch that. That's
322 # faster, and goma relies on having matching binary hashes on client and 330 # faster, and goma relies on having matching binary hashes on client and
323 # server too. 331 # server too.
324 print 'Trying to download prebuilt clang' 332 print 'Trying to download prebuilt clang'
325 333
326 try: 334 try:
327 if os.path.exists(LLVM_BUILD_DIR): 335 if os.path.exists(LLVM_BUILD_DIR):
328 RmTree(LLVM_BUILD_DIR) 336 RmTree(LLVM_BUILD_DIR)
329 DownloadAndUnpack(cds_full_url, LLVM_BUILD_DIR) 337 DownloadAndUnpack(cds_full_url, LLVM_BUILD_DIR)
330 print 'clang %s unpacked' % PACKAGE_VERSION 338 print 'clang %s unpacked' % PACKAGE_VERSION
331 # Download the gold plugin if requested to by an environment variable. 339 # Download the gold plugin if requested to by an environment variable.
332 # This is used by the CFI ClusterFuzz bot, and it's required for official 340 # This is used by the CFI ClusterFuzz bot, and it's required for official
333 # builds on linux. 341 # builds on linux.
334 if 'LLVM_DOWNLOAD_GOLD_PLUGIN' in os.environ or ( 342 if need_gold_plugin:
335 sys.platform.startswith('linux') and
336 'buildtype=Official' in os.environ.get('GYP_DEFINES', '') and
337 'branding=Chrome' in os.environ.get('GYP_DEFINES', '')):
338 RunCommand(['python', CHROMIUM_DIR+'/build/download_gold_plugin.py']) 343 RunCommand(['python', CHROMIUM_DIR+'/build/download_gold_plugin.py'])
339 WriteStampFile(PACKAGE_VERSION) 344 WriteStampFile(PACKAGE_VERSION)
340 return 0 345 return 0
341 except urllib2.HTTPError: 346 except urllib2.HTTPError:
342 print 'Did not find prebuilt clang %s, building locally' % cds_file 347 print 'Did not find prebuilt clang %s, building locally' % cds_file
343 348
344 if args.with_android and not os.path.exists(ANDROID_NDK_DIR): 349 if args.with_android and not os.path.exists(ANDROID_NDK_DIR):
345 print 'Android NDK not found at ' + ANDROID_NDK_DIR 350 print 'Android NDK not found at ' + ANDROID_NDK_DIR
346 print 'The Android NDK is needed to build a Clang whose -fsanitize=address' 351 print 'The Android NDK is needed to build a Clang whose -fsanitize=address'
347 print 'works on Android. See ' 352 print 'works on Android. See '
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after
776 args.force_local_build = True 781 args.force_local_build = True
777 if 'OS=android' not in os.environ.get('GYP_DEFINES', ''): 782 if 'OS=android' not in os.environ.get('GYP_DEFINES', ''):
778 # Only build the Android ASan rt on ToT bots when targetting Android. 783 # Only build the Android ASan rt on ToT bots when targetting Android.
779 args.with_android = False 784 args.with_android = False
780 785
781 return UpdateClang(args) 786 return UpdateClang(args)
782 787
783 788
784 if __name__ == '__main__': 789 if __name__ == '__main__':
785 sys.exit(main()) 790 sys.exit(main())
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698