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/update.py

Issue 1494883004: Revert of 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
310 if ReadStampFile() == PACKAGE_VERSION: 304 if ReadStampFile() == PACKAGE_VERSION:
311 print 'Clang is already up to date.' 305 print 'Already up to date.'
312 if not need_gold_plugin or os.path.exists( 306 return 0
313 os.path.join(LLVM_BUILD_DIR, "lib/LLVMgold.so")):
314 return 0
315 307
316 # Reset the stamp file in case the build is unsuccessful. 308 # Reset the stamp file in case the build is unsuccessful.
317 WriteStampFile('') 309 WriteStampFile('')
318 310
319 if not args.force_local_build: 311 if not args.force_local_build:
320 cds_file = "clang-%s.tgz" % PACKAGE_VERSION 312 cds_file = "clang-%s.tgz" % PACKAGE_VERSION
321 if sys.platform == 'win32': 313 if sys.platform == 'win32':
322 cds_full_url = CDS_URL + '/Win/' + cds_file 314 cds_full_url = CDS_URL + '/Win/' + cds_file
323 elif sys.platform == 'darwin': 315 elif sys.platform == 'darwin':
324 cds_full_url = CDS_URL + '/Mac/' + cds_file 316 cds_full_url = CDS_URL + '/Mac/' + cds_file
325 else: 317 else:
326 assert sys.platform.startswith('linux') 318 assert sys.platform.startswith('linux')
327 cds_full_url = CDS_URL + '/Linux_x64/' + cds_file 319 cds_full_url = CDS_URL + '/Linux_x64/' + cds_file
328 320
329 # Check if there's a prebuilt binary and if so just fetch that. That's 321 # Check if there's a prebuilt binary and if so just fetch that. That's
330 # faster, and goma relies on having matching binary hashes on client and 322 # faster, and goma relies on having matching binary hashes on client and
331 # server too. 323 # server too.
332 print 'Trying to download prebuilt clang' 324 print 'Trying to download prebuilt clang'
333 325
334 try: 326 try:
335 if os.path.exists(LLVM_BUILD_DIR): 327 if os.path.exists(LLVM_BUILD_DIR):
336 RmTree(LLVM_BUILD_DIR) 328 RmTree(LLVM_BUILD_DIR)
337 DownloadAndUnpack(cds_full_url, LLVM_BUILD_DIR) 329 DownloadAndUnpack(cds_full_url, LLVM_BUILD_DIR)
338 print 'clang %s unpacked' % PACKAGE_VERSION 330 print 'clang %s unpacked' % PACKAGE_VERSION
339 # Download the gold plugin if requested to by an environment variable. 331 # Download the gold plugin if requested to by an environment variable.
340 # This is used by the CFI ClusterFuzz bot, and it's required for official 332 # This is used by the CFI ClusterFuzz bot, and it's required for official
341 # builds on linux. 333 # builds on linux.
342 if need_gold_plugin: 334 if 'LLVM_DOWNLOAD_GOLD_PLUGIN' in os.environ or (
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', '')):
343 RunCommand(['python', CHROMIUM_DIR+'/build/download_gold_plugin.py']) 338 RunCommand(['python', CHROMIUM_DIR+'/build/download_gold_plugin.py'])
344 WriteStampFile(PACKAGE_VERSION) 339 WriteStampFile(PACKAGE_VERSION)
345 return 0 340 return 0
346 except urllib2.HTTPError: 341 except urllib2.HTTPError:
347 print 'Did not find prebuilt clang %s, building locally' % cds_file 342 print 'Did not find prebuilt clang %s, building locally' % cds_file
348 343
349 if args.with_android and not os.path.exists(ANDROID_NDK_DIR): 344 if args.with_android and not os.path.exists(ANDROID_NDK_DIR):
350 print 'Android NDK not found at ' + ANDROID_NDK_DIR 345 print 'Android NDK not found at ' + ANDROID_NDK_DIR
351 print 'The Android NDK is needed to build a Clang whose -fsanitize=address' 346 print 'The Android NDK is needed to build a Clang whose -fsanitize=address'
352 print 'works on Android. See ' 347 print 'works on Android. See '
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after
781 args.force_local_build = True 776 args.force_local_build = True
782 if 'OS=android' not in os.environ.get('GYP_DEFINES', ''): 777 if 'OS=android' not in os.environ.get('GYP_DEFINES', ''):
783 # Only build the Android ASan rt on ToT bots when targetting Android. 778 # Only build the Android ASan rt on ToT bots when targetting Android.
784 args.with_android = False 779 args.with_android = False
785 780
786 return UpdateClang(args) 781 return UpdateClang(args)
787 782
788 783
789 if __name__ == '__main__': 784 if __name__ == '__main__':
790 sys.exit(main()) 785 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