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

Side by Side Diff: editor/build/build.py

Issue 28773003: Changes to annotated step scripts: dart-editor-installer-* builders will build installer (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « client/tools/buildbot_annotated_steps.py ('k') | tools/bots/bot_utils.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 # 2 #
3 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 3 # Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
4 # for details. All rights reserved. Use of this source code is governed by a 4 # for details. All rights reserved. Use of this source code is governed by a
5 # BSD-style license that can be found in the LICENSE file. 5 # BSD-style license that can be found in the LICENSE file.
6 6
7 import glob 7 import glob
8 import gsutil 8 import gsutil
9 import imp 9 import imp
10 import optparse 10 import optparse
11 import os 11 import os
12 import re 12 import re
13 import shutil 13 import shutil
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 121
122 def DartArchiveUploadVersionFile(version_file): 122 def DartArchiveUploadVersionFile(version_file):
123 # TODO(kustermann): We don't archive trunk builds to gs://dart-archive/. 123 # TODO(kustermann): We don't archive trunk builds to gs://dart-archive/.
124 # Remove this once the channel transition is done. 124 # Remove this once the channel transition is done.
125 if CHANNEL == 'trunk': return 125 if CHANNEL == 'trunk': return
126 namer = bot_utils.GCSNamer(CHANNEL, bot_utils.ReleaseType.RAW) 126 namer = bot_utils.GCSNamer(CHANNEL, bot_utils.ReleaseType.RAW)
127 for revision in [REVISION, 'latest']: 127 for revision in [REVISION, 'latest']:
128 DartArchiveFile(version_file, namer.version_filepath(revision), 128 DartArchiveFile(version_file, namer.version_filepath(revision),
129 create_md5sum=False) 129 create_md5sum=False)
130 130
131 def DartArchiveUploadInstaller(
132 arch, installer_file, extension, release_type=bot_utils.ReleaseType.RAW):
133 namer = bot_utils.GCSNamer(CHANNEL, release_type)
134 for revision in [REVISION, 'latest']:
135 gsu_path = namer.editor_installer_zipfilepath(
136 revision, SYSTEM, arch, extension)
137 DartArchiveFile(installer_file, gsu_path, create_md5sum=False)
138
131 class AntWrapper(object): 139 class AntWrapper(object):
132 """A wrapper for ant build invocations""" 140 """A wrapper for ant build invocations"""
133 141
134 _antpath = None 142 _antpath = None
135 _bzippath = None 143 _bzippath = None
136 _propertyfile = None 144 _propertyfile = None
137 145
138 def __init__(self, propertyfile, antpath='/usr/bin', bzippath=None): 146 def __init__(self, propertyfile, antpath='/usr/bin', bzippath=None):
139 """Initialize the ant path. 147 """Initialize the ant path.
140 148
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 action='store') 262 action='store')
255 result.add_option('-n', '--name', 263 result.add_option('-n', '--name',
256 help='builder name.', 264 help='builder name.',
257 action='store') 265 action='store')
258 result.add_option('-o', '--out', 266 result.add_option('-o', '--out',
259 help='Output Directory.', 267 help='Output Directory.',
260 action='store') 268 action='store')
261 result.add_option('--dest', 269 result.add_option('--dest',
262 help='Output Directory.', 270 help='Output Directory.',
263 action='store') 271 action='store')
272 result.add_option('--build-installer',
273 help='Fetch editor, build installer and archive it.',
274 action='store_true', default=False)
264 return result 275 return result
265 276
266 def main(): 277 def main():
267 """Main entry point for the build program.""" 278 """Main entry point for the build program."""
268 global BUILD_OS 279 global BUILD_OS
269 global CHANNEL 280 global CHANNEL
270 global DART_PATH 281 global DART_PATH
271 global GSU_API_DOCS_PATH 282 global GSU_API_DOCS_PATH
272 global GSU_PATH_LATEST 283 global GSU_PATH_LATEST
273 global GSU_PATH_REV 284 global GSU_PATH_REV
(...skipping 30 matching lines...) Expand all
304 315
305 # TODO(devoncarew): remove this hardcoded e:\ path 316 # TODO(devoncarew): remove this hardcoded e:\ path
306 buildroot_parent = {'linux': dartpath, 'macos': dartpath, 'win32': r'e:\tmp'} 317 buildroot_parent = {'linux': dartpath, 'macos': dartpath, 'win32': r'e:\tmp'}
307 buildroot = os.path.join(buildroot_parent[buildos], 'build_root') 318 buildroot = os.path.join(buildroot_parent[buildos], 'build_root')
308 319
309 os.chdir(buildpath) 320 os.chdir(buildpath)
310 ant_property_file = None 321 ant_property_file = None
311 sdk_zip = None 322 sdk_zip = None
312 323
313 try: 324 try:
314 ant_property_file = tempfile.NamedTemporaryFile(suffix='.property',
315 prefix='AntProperties',
316 delete=False)
317 ant_property_file.close()
318 ant = AntWrapper(ant_property_file.name, os.path.join(antpath, 'bin'),
319 bzip2libpath)
320
321 ant.RunAnt(os.getcwd(), '', '', '', '',
322 '', '', buildos, ['-diagnostics'])
323
324 parser = BuildOptions() 325 parser = BuildOptions()
325 (options, args) = parser.parse_args() 326 (options, args) = parser.parse_args()
326 # Determine which targets to build. By default we build the "all" target. 327 # Determine which targets to build. By default we build the "all" target.
327 if args: 328 if args:
328 print 'only options should be passed to this script' 329 print 'only options should be passed to this script'
329 parser.print_help() 330 parser.print_help()
330 return 2 331 return 2
331 332
332 if str(options.revision) == 'None': 333 if str(options.revision) == 'None':
333 print 'missing revision option' 334 print 'missing revision option'
(...skipping 28 matching lines...) Expand all
362 lastc = revision[-1] 363 lastc = revision[-1]
363 if lastc.isalpha(): 364 if lastc.isalpha():
364 revision = revision[0:-1] 365 revision = revision[0:-1]
365 index = revision.find(':') 366 index = revision.find(':')
366 if index > -1: 367 if index > -1:
367 revision = revision[0:index] 368 revision = revision[0:index]
368 print 'revision = |{0}|'.format(revision) 369 print 'revision = |{0}|'.format(revision)
369 buildout = os.path.abspath(options.out) 370 buildout = os.path.abspath(options.out)
370 print 'buildout = {0}'.format(buildout) 371 print 'buildout = {0}'.format(buildout)
371 372
372 if not os.path.exists(buildout):
373 os.makedirs(buildout)
374
375 # clean out old build artifacts
376 for f in os.listdir(buildout):
377 if ('dartsdk-' in f) or ('darteditor-' in f) or ('dart-editor-' in f):
378 os.remove(join(buildout, f))
379
380 # Get user name. If it does not start with chrome then deploy to the test 373 # Get user name. If it does not start with chrome then deploy to the test
381 # bucket; otherwise deploy to the continuous bucket. 374 # bucket; otherwise deploy to the continuous bucket.
382 username = os.environ.get('USER') 375 username = os.environ.get('USER')
383 if username is None: 376 if username is None:
384 username = os.environ.get('USERNAME') 377 username = os.environ.get('USERNAME')
385 378
386 if username is None: 379 if username is None:
387 print 'Could not find username' 380 print 'Could not find username'
388 return 6 381 return 6
389 382
383 build_skip_tests = os.environ.get('DART_SKIP_RUNNING_TESTS')
384 sdk_environment = os.environ
385 if sdk_environment.has_key('JAVA_HOME'):
386 print 'JAVA_HOME = {0}'.format(str(sdk_environment['JAVA_HOME']))
387
390 # dart-editor[-trunk], dart-editor-(win/mac/linux)[-trunk/be/dev/stable] 388 # dart-editor[-trunk], dart-editor-(win/mac/linux)[-trunk/be/dev/stable]
391 builder_name = str(options.name) 389 builder_name = str(options.name)
392 390
393 EDITOR_REGEXP = (r'^dart-editor(-(?P<system>(win|mac|linux)))?' + 391 EDITOR_REGEXP = (r'^dart-editor(-(?P<installer>(installer)))?'
392 '(-(?P<system>(win|mac|linux)))?' +
394 '(-(?P<channel>(trunk|be|dev|stable)))?$') 393 '(-(?P<channel>(trunk|be|dev|stable)))?$')
395 match = re.match(EDITOR_REGEXP, builder_name) 394 match = re.match(EDITOR_REGEXP, builder_name)
396 if not match: 395 if not match:
397 raise Exception("Buildername '%s' does not match pattern '%s'." 396 raise Exception("Buildername '%s' does not match pattern '%s'."
398 % (builder_name, EDITOR_REGEXP)) 397 % (builder_name, EDITOR_REGEXP))
399 398
400 CHANNEL = match.groupdict()['channel'] or 'be' 399 CHANNEL = match.groupdict()['channel'] or 'be'
401 SYSTEM = match.groupdict()['system'] 400 SYSTEM = match.groupdict()['system']
401 BUILD_INSTALLER = bool(match.groupdict()['installer'])
402 402
403 TRUNK_BUILD = CHANNEL == 'trunk' 403 TRUNK_BUILD = CHANNEL == 'trunk'
404 PLUGINS_BUILD = SYSTEM is None 404 PLUGINS_BUILD = SYSTEM is None
405 REVISION = revision 405 REVISION = revision
406 406
407 build_skip_tests = os.environ.get('DART_SKIP_RUNNING_TESTS') 407 # Make sure the buildername and the options agree
408 sdk_environment = os.environ 408 assert BUILD_INSTALLER == options.build_installer
409
409 if username.startswith('chrome'): 410 if username.startswith('chrome'):
410 if TRUNK_BUILD: 411 if TRUNK_BUILD:
411 to_bucket = 'gs://dart-editor-archive-trunk' 412 bucket = 'gs://dart-editor-archive-trunk'
412 else: 413 else:
413 to_bucket = 'gs://dart-editor-archive-continuous' 414 bucket = 'gs://dart-editor-archive-continuous'
414 running_on_buildbot = True 415 running_on_buildbot = True
415 else: 416 else:
416 to_bucket = 'gs://dart-editor-archive-testing' 417 bucket = 'gs://dart-editor-archive-testing'
417 running_on_buildbot = False 418 running_on_buildbot = False
418 sdk_environment['DART_LOCAL_BUILD'] = 'dart-editor-archive-testing' 419 sdk_environment['DART_LOCAL_BUILD'] = 'dart-editor-archive-testing'
419 420
420 GSU_PATH_REV = '%s/%s' % (to_bucket, REVISION) 421 GSU_PATH_REV = '%s/%s' % (bucket, REVISION)
421 GSU_PATH_LATEST = '%s/%s' % (to_bucket, 'latest') 422 GSU_PATH_LATEST = '%s/%s' % (bucket, 'latest')
422 GSU_API_DOCS_PATH = '%s/%s' % (GSU_API_DOCS_BUCKET, REVISION) 423 GSU_API_DOCS_PATH = '%s/%s' % (GSU_API_DOCS_BUCKET, REVISION)
423 424
424 homegsutil = join(DART_PATH, 'third_party', 'gsutil', 'gsutil') 425 homegsutil = join(DART_PATH, 'third_party', 'gsutil', 'gsutil')
425 gsu = gsutil.GsUtil(False, homegsutil, 426 gsu = gsutil.GsUtil(False, homegsutil,
426 running_on_buildbot=running_on_buildbot) 427 running_on_buildbot=running_on_buildbot)
427 InstallDartium(buildroot, buildout, buildos, gsu)
428 if sdk_environment.has_key('JAVA_HOME'):
429 print 'JAVA_HOME = {0}'.format(str(sdk_environment['JAVA_HOME']))
430 428
431 if not PLUGINS_BUILD: 429 def build_installer():
432 StartBuildStep('create_sdk') 430 def old_location_pair(arch, extension):
433 EnsureDirectoryExists(buildout) 431 """Returns a tuple (zip_file, installer_file) of google cloud storage
434 try: 432 locations."""
435 sdk_zip = CreateSDK(buildout) 433 os_rename = {'win': 'win32', 'mac': 'macos', 'linux': 'linux'}
436 except: 434 system = os_rename[SYSTEM]
437 BuildStepFailure() 435 return (
436 ("%s/darteditor-%s-%s.zip" % (GSU_PATH_REV, system, arch)),
437 ("%s/darteditor-installer-%s-%s.%s"
438 % (GSU_PATH_REV, system, arch, extension)))
439
440 def create_mac_installer(arch):
441 with utils.TempDir('build_editor_installer') as temp_dir:
442 with utils.ChangedWorkingDirectory(temp_dir):
443 (gsu_editor_zip, gsu_editor_dmg) = old_location_pair(arch, 'dmg')
444 # Fetch the editor zip file from the old location.
445 if gsu.Copy(gsu_editor_zip, 'editor.zip', False):
446 raise Exception("gsutil command failed, aborting.")
447
448 # Unzip the editor (which contains a directory named 'dart').
449 bot_utils.run(['unzip', 'editor.zip'])
450 assert os.path.exists('dart') and os.path.isdir('dart')
451
452 # Build the dmg installer
453 dmg_installer = os.path.join(temp_dir,'darteditor-installer.dmg')
454 dart_folder_icon = os.path.join(DART_PATH,
455 'editor/tools/plugins/com.google.dart.tools.ui/' +
456 'icons/dart_about_140_160.png')
457 dmg_builder = os.path.join(DART_PATH, 'tools',
458 'mac_build_editor_dmg.sh')
459 bot_utils.run([dmg_builder, dmg_installer, 'dart',
460 dart_folder_icon, "Dart Distribution"])
461 assert os.path.isfile(dmg_installer)
462
463 # Archive to old bucket
464 # TODO(kustermann/ricow): Remove all the old archiving code,
465 # once everything points to the new location.
466 if gsu.Copy(dmg_installer, gsu_editor_dmg):
467 raise Exception("gsutil command failed, aborting.")
468
469 # Archive to new bucket
470 # NOTE: This is a little bit hackisch, we fetch the editor from
471 # the old bucket and archive the dmg to the new bucket here.
472 DartArchiveUploadInstaller(arch, dmg_installer, 'dmg',
473 release_type=bot_utils.ReleaseType.SIGNED)
474
475 if SYSTEM == 'mac':
476 for arch in ['32', '64']:
477 create_mac_installer(arch)
478 else:
479 raise Exception(
480 "We currently cannot build installers for %s" % SYSTEM)
481 def build_editor(sdk_zip):
482 ant_property_file = tempfile.NamedTemporaryFile(suffix='.property',
483 prefix='AntProperties',
484 delete=False)
485 ant_property_file.close()
486 ant = AntWrapper(ant_property_file.name, os.path.join(antpath, 'bin'),
487 bzip2libpath)
488
489 ant.RunAnt(os.getcwd(), '', '', '', '',
490 '', '', buildos, ['-diagnostics'])
491
492 if not os.path.exists(buildout):
493 os.makedirs(buildout)
494
495 # clean out old build artifacts
496 for f in os.listdir(buildout):
497 if ('dartsdk-' in f) or ('darteditor-' in f) or ('dart-editor-' in f):
498 os.remove(join(buildout, f))
499
500 InstallDartium(buildroot, buildout, buildos, gsu)
501
502 if not PLUGINS_BUILD:
503 StartBuildStep('create_sdk')
504 EnsureDirectoryExists(buildout)
505 try:
506 sdk_zip = CreateSDK(buildout)
507 except:
508 BuildStepFailure()
438 509
439 510
440 if builder_name.startswith('dart-editor-linux'): 511 if builder_name.startswith('dart-editor-linux'):
441 StartBuildStep('api_docs') 512 StartBuildStep('api_docs')
442 try: 513 try:
443 CreateApiDocs(buildout) 514 CreateApiDocs(buildout)
444 except: 515 except:
445 BuildStepFailure() 516 BuildStepFailure()
446 517
447 StartBuildStep(builder_name) 518 StartBuildStep(builder_name)
448 519
449 if PLUGINS_BUILD: 520 if PLUGINS_BUILD:
450 status = BuildUpdateSite(ant, revision, builder_name, buildroot, buildout, 521 status = BuildUpdateSite(ant, revision, builder_name, buildroot,
451 editorpath, buildos) 522 buildout, editorpath, buildos)
452 return status
453
454 with utils.TempDir('ExtraArtifacts') as extra_artifacts:
455 #tell the ant script where to write the sdk zip file so it can
456 #be expanded later
457 status = ant.RunAnt('.', 'build_rcp.xml', revision, builder_name,
458 buildroot, buildout, editorpath, buildos,
459 sdk_zip=sdk_zip,
460 running_on_bot=running_on_buildbot,
461 extra_artifacts=extra_artifacts)
462 #the ant script writes a property file in a known location so
463 #we can read it.
464 properties = ReadPropertyFile(buildos, ant_property_file.name)
465
466 if not properties:
467 raise Exception('no data was found in file {%s}'
468 % ant_property_file.name)
469 if status:
470 if properties['build.runtime']:
471 PrintErrorLog(properties['build.runtime'])
472 return status 523 return status
473 524
474 #For the dart-editor build, return at this point. 525 with utils.TempDir('ExtraArtifacts') as extra_artifacts:
475 #We don't need to install the sdk+dartium, run tests, or copy to google 526 # Tell the ant script where to write the sdk zip file so it can
476 #storage. 527 # be expanded later
477 if not buildos: 528 status = ant.RunAnt('.', 'build_rcp.xml', revision, builder_name,
478 print 'skipping sdk and dartium steps for dart-editor build' 529 buildroot, buildout, editorpath, buildos,
530 sdk_zip=sdk_zip,
531 running_on_bot=running_on_buildbot,
532 extra_artifacts=extra_artifacts)
533 # The ant script writes a property file in a known location so
534 # we can read it.
535 properties = ReadPropertyFile(buildos, ant_property_file.name)
536
537 if not properties:
538 raise Exception('no data was found in file {%s}'
539 % ant_property_file.name)
540 if status:
541 if properties['build.runtime']:
542 PrintErrorLog(properties['build.runtime'])
543 return status
544
545 # For the dart-editor build, return at this point.
546 # We don't need to install the sdk+dartium, run tests, or copy to google
547 # storage.
548 if not buildos:
549 print 'skipping sdk and dartium steps for dart-editor build'
550 return 0
551
552 # This is an override for local testing
553 force_run_install = os.environ.get('FORCE_RUN_INSTALL')
554
555 if force_run_install or (not PLUGINS_BUILD):
556 InstallSdk(buildroot, buildout, buildos, buildout)
557 InstallDartium(buildroot, buildout, buildos, gsu)
558
559 if status:
560 return status
561
562 if not build_skip_tests:
563 RunEditorTests(buildout, buildos)
564
565 if buildos:
566 StartBuildStep('upload_artifacts')
567
568 _InstallArtifacts(buildout, buildos, extra_artifacts)
569
570 # dart-editor-linux.gtk.x86.zip --> darteditor-linux-32.zip
571 RenameRcpZipFiles(buildout)
572
573 PostProcessEditorBuilds(buildout)
574
575 if running_on_buildbot:
576 version_file = _FindVersionFile(buildout)
577 if version_file:
578 UploadFile(version_file, False)
579 DartArchiveUploadVersionFile(version_file)
580
581 found_zips = _FindRcpZipFiles(buildout)
582 for zipfile in found_zips:
583 UploadFile(zipfile)
584 DartArchiveUploadEditorZipFile(zipfile)
585
479 return 0 586 return 0
480 587
481 #This is an override for local testing 588 if BUILD_INSTALLER:
482 force_run_install = os.environ.get('FORCE_RUN_INSTALL') 589 build_installer()
483 590 else:
484 if force_run_install or (not PLUGINS_BUILD): 591 build_editor(sdk_zip)
485 InstallSdk(buildroot, buildout, buildos, buildout)
486 InstallDartium(buildroot, buildout, buildos, gsu)
487
488 if status:
489 return status
490
491 if not build_skip_tests:
492 RunEditorTests(buildout, buildos)
493
494 if buildos:
495 StartBuildStep('upload_artifacts')
496
497 _InstallArtifacts(buildout, buildos, extra_artifacts)
498
499 # dart-editor-linux.gtk.x86.zip --> darteditor-linux-32.zip
500 RenameRcpZipFiles(buildout)
501
502 PostProcessEditorBuilds(buildout)
503
504 if running_on_buildbot:
505 version_file = _FindVersionFile(buildout)
506 if version_file:
507 UploadFile(version_file, False)
508 DartArchiveUploadVersionFile(version_file)
509
510 found_zips = _FindRcpZipFiles(buildout)
511 for zipfile in found_zips:
512 UploadFile(zipfile)
513 DartArchiveUploadEditorZipFile(zipfile)
514
515 return 0
516 finally: 592 finally:
517 if ant_property_file is not None: 593 if ant_property_file is not None:
518 print 'cleaning up temp file {0}'.format(ant_property_file.name) 594 print 'cleaning up temp file {0}'.format(ant_property_file.name)
519 os.remove(ant_property_file.name) 595 os.remove(ant_property_file.name)
520 print 'cleaning up {0}'.format(buildroot) 596 print 'cleaning up {0}'.format(buildroot)
521 shutil.rmtree(buildroot, True) 597 shutil.rmtree(buildroot, True)
522 print 'Build Done' 598 print 'Build Done'
523 599
524 600
525 def ReadPropertyFile(buildos, property_file): 601 def ReadPropertyFile(buildos, property_file):
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
691 767
692 # Download and unzip dartium 768 # Download and unzip dartium
693 unzip_dir = os.path.join(tmp_dir, 769 unzip_dir = os.path.join(tmp_dir,
694 os.path.splitext(os.path.basename(dartiumFile))[0]) 770 os.path.splitext(os.path.basename(dartiumFile))[0])
695 if not os.path.exists(unzip_dir): 771 if not os.path.exists(unzip_dir):
696 os.makedirs(unzip_dir) 772 os.makedirs(unzip_dir)
697 773
698 # Always download as local_name.zip 774 # Always download as local_name.zip
699 tmp_zip_file = os.path.join(tmp_dir, "%s.zip" % local_name) 775 tmp_zip_file = os.path.join(tmp_dir, "%s.zip" % local_name)
700 if not os.path.exists(tmp_zip_file): 776 if not os.path.exists(tmp_zip_file):
701 gsu.Copy(dartiumFile, tmp_zip_file, False) 777 if gsu.Copy(dartiumFile, tmp_zip_file, False):
778 raise Exception("gsutil command failed, aborting.")
702 # Dartium is unzipped into unzip_dir/dartium-*/ 779 # Dartium is unzipped into unzip_dir/dartium-*/
703 dartium_zip = ziputils.ZipUtil(tmp_zip_file, buildos) 780 dartium_zip = ziputils.ZipUtil(tmp_zip_file, buildos)
704 dartium_zip.UnZip(unzip_dir) 781 dartium_zip.UnZip(unzip_dir)
705 782
706 dart_zip_path = join(buildout, rcpZipFile) 783 dart_zip_path = join(buildout, rcpZipFile)
707 dart_zip = ziputils.ZipUtil(dart_zip_path, buildos) 784 dart_zip = ziputils.ZipUtil(dart_zip_path, buildos)
708 785
709 add_path = glob.glob(join(unzip_dir, 'dartium-*'))[0] 786 add_path = glob.glob(join(unzip_dir, 'dartium-*'))[0]
710 if system == 'windows': 787 if system == 'windows':
711 # TODO(ricow/kustermann): This is hackisch. We should make a generic 788 # TODO(ricow/kustermann): This is hackisch. We should make a generic
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
769 #download and unzip dartium 846 #download and unzip dartium
770 unzip_dir = os.path.join(tmp_dir, 847 unzip_dir = os.path.join(tmp_dir,
771 os.path.splitext(os.path.basename(dartiumFile))[0]) 848 os.path.splitext(os.path.basename(dartiumFile))[0])
772 if not os.path.exists(unzip_dir): 849 if not os.path.exists(unzip_dir):
773 os.makedirs(unzip_dir) 850 os.makedirs(unzip_dir)
774 # Always download as searchString.zip 851 # Always download as searchString.zip
775 basename = "%s.zip" % searchString 852 basename = "%s.zip" % searchString
776 tmp_zip_file = os.path.join(tmp_dir, basename) 853 tmp_zip_file = os.path.join(tmp_dir, basename)
777 854
778 if not os.path.exists(tmp_zip_file): 855 if not os.path.exists(tmp_zip_file):
779 gsu.Copy(dartiumFile, tmp_zip_file, False) 856 if gsu.Copy(dartiumFile, tmp_zip_file, False):
857 raise Exception("gsutil command failed, aborting.")
780 858
781 # Upload dartium zip to make sure we have consistent dartium downloads 859 # Upload dartium zip to make sure we have consistent dartium downloads
782 UploadFile(tmp_zip_file) 860 UploadFile(tmp_zip_file)
783 861
784 # Dartium is unzipped into ~ unzip_dir/dartium-win-full-7665.7665 862 # Dartium is unzipped into ~ unzip_dir/dartium-win-full-7665.7665
785 dartium_zip = ziputils.ZipUtil(tmp_zip_file, buildos) 863 dartium_zip = ziputils.ZipUtil(tmp_zip_file, buildos)
786 dartium_zip.UnZip(unzip_dir) 864 dartium_zip.UnZip(unzip_dir)
787 else: 865 else:
788 dartium_zip = ziputils.ZipUtil(tmp_zip_file, buildos) 866 dartium_zip = ziputils.ZipUtil(tmp_zip_file, buildos)
789 867
(...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after
1263 """delete the given file - do not re-throw any exceptions that occur""" 1341 """delete the given file - do not re-throw any exceptions that occur"""
1264 if os.path.exists(f): 1342 if os.path.exists(f):
1265 try: 1343 try:
1266 os.remove(f) 1344 os.remove(f)
1267 except OSError: 1345 except OSError:
1268 print 'error deleting %s' % f 1346 print 'error deleting %s' % f
1269 1347
1270 1348
1271 if __name__ == '__main__': 1349 if __name__ == '__main__':
1272 sys.exit(main()) 1350 sys.exit(main())
OLDNEW
« no previous file with comments | « client/tools/buildbot_annotated_steps.py ('k') | tools/bots/bot_utils.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698