| OLD | NEW |
| 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) 2012, 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 optparse | 8 import optparse |
| 9 import os | 9 import os |
| 10 import re | 10 import re |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 print 'thirdpartypath = {0}'.format(thirdpartypath) | 271 print 'thirdpartypath = {0}'.format(thirdpartypath) |
| 272 print 'toolspath = {0}'.format(toolspath) | 272 print 'toolspath = {0}'.format(toolspath) |
| 273 print 'antpath = {0}'.format(antpath) | 273 print 'antpath = {0}'.format(antpath) |
| 274 print 'bzip2libpath = {0}'.format(bzip2libpath) | 274 print 'bzip2libpath = {0}'.format(bzip2libpath) |
| 275 print 'buildpath = {0}'.format(buildpath) | 275 print 'buildpath = {0}'.format(buildpath) |
| 276 print 'buildroot = {0}'.format(buildroot) | 276 print 'buildroot = {0}'.format(buildroot) |
| 277 print 'dartpath = {0}'.format(dartpath) | 277 print 'dartpath = {0}'.format(dartpath) |
| 278 print 'revision(in) = |{0}|'.format(options.revision) | 278 print 'revision(in) = |{0}|'.format(options.revision) |
| 279 #this code handles getting the revision on the developer machine | 279 #this code handles getting the revision on the developer machine |
| 280 #where it can be 123, 123M 123:125M | 280 #where it can be 123, 123M 123:125M |
| 281 print 'revision(in) = {0}|'.format(options.revision) | 281 print 'revision(in) = |{0}|'.format(options.revision) |
| 282 revision = options.revision.rstrip() | 282 revision = options.revision.rstrip() |
| 283 lastc = revision[-1] | 283 lastc = revision[-1] |
| 284 if lastc.isalpha(): | 284 if lastc.isalpha(): |
| 285 revision = revision[0:-1] | 285 revision = revision[0:-1] |
| 286 index = revision.find(':') | 286 index = revision.find(':') |
| 287 if index > -1: | 287 if index > -1: |
| 288 revision = revision[0:index] | 288 revision = revision[0:index] |
| 289 print 'revision = |{0}|'.format(revision) | 289 print 'revision = |{0}|'.format(revision) |
| 290 buildout = os.path.abspath(options.out) | 290 buildout = os.path.abspath(options.out) |
| 291 print 'buildout = {0}'.format(buildout) | 291 print 'buildout = {0}'.format(buildout) |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 324 if TRUNK_BUILD: | 324 if TRUNK_BUILD: |
| 325 to_bucket = 'gs://dart-editor-archive-trunk' | 325 to_bucket = 'gs://dart-editor-archive-trunk' |
| 326 else: | 326 else: |
| 327 to_bucket = 'gs://dart-editor-archive-continuous' | 327 to_bucket = 'gs://dart-editor-archive-continuous' |
| 328 running_on_buildbot = True | 328 running_on_buildbot = True |
| 329 else: | 329 else: |
| 330 to_bucket = 'gs://dart-editor-archive-testing' | 330 to_bucket = 'gs://dart-editor-archive-testing' |
| 331 running_on_buildbot = False | 331 running_on_buildbot = False |
| 332 sdk_environment['DART_LOCAL_BUILD'] = 'dart-editor-archive-testing' | 332 sdk_environment['DART_LOCAL_BUILD'] = 'dart-editor-archive-testing' |
| 333 | 333 |
| 334 REVISION = options.revision | 334 REVISION = revision |
| 335 GSU_PATH_REV = '%s/%s' % (to_bucket, options.revision) | 335 GSU_PATH_REV = '%s/%s' % (to_bucket, REVISION) |
| 336 GSU_PATH_LATEST = '%s/%s' % (to_bucket, 'latest') | 336 GSU_PATH_LATEST = '%s/%s' % (to_bucket, 'latest') |
| 337 GSU_API_DOCS_PATH = '%s/%s' % (GSU_API_DOCS_BUCKET, options.revision) | 337 GSU_API_DOCS_PATH = '%s/%s' % (GSU_API_DOCS_BUCKET, REVISION) |
| 338 | 338 |
| 339 homegsutil = join(DART_PATH, 'third_party', 'gsutil', 'gsutil') | 339 homegsutil = join(DART_PATH, 'third_party', 'gsutil', 'gsutil') |
| 340 gsu = gsutil.GsUtil(False, homegsutil, running_on_buildbot=running_on_buildb
ot) | 340 gsu = gsutil.GsUtil(False, homegsutil, running_on_buildbot=running_on_buildb
ot) |
| 341 | 341 |
| 342 print '@@@BUILD_STEP dart-ide dart clients: %s@@@' % options.name | 342 print '@@@BUILD_STEP dart-ide dart clients: %s@@@' % options.name |
| 343 if sdk_environment.has_key('JAVA_HOME'): | 343 if sdk_environment.has_key('JAVA_HOME'): |
| 344 print 'JAVA_HOME = {0}'.format(str(sdk_environment['JAVA_HOME'])) | 344 print 'JAVA_HOME = {0}'.format(str(sdk_environment['JAVA_HOME'])) |
| 345 | 345 |
| 346 if not PLUGINS_BUILD: | 346 if not PLUGINS_BUILD: |
| 347 PrintSeparator('running the build of the Dart SDK') | 347 PrintSeparator('running the build of the Dart SDK') |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 496 def UploadTestHtml(buildout, bucket, svnid, buildos, gsu): | 496 def UploadTestHtml(buildout, bucket, svnid, buildos, gsu): |
| 497 """Upload the Test Results HTML to GoogleStorage. | 497 """Upload the Test Results HTML to GoogleStorage. |
| 498 | 498 |
| 499 Args: | 499 Args: |
| 500 buildout: the location ofthe output of the build | 500 buildout: the location ofthe output of the build |
| 501 bucket: the Google Storage bucket the code is staged in | 501 bucket: the Google Storage bucket the code is staged in |
| 502 svnid: the revision id for this build | 502 svnid: the revision id for this build |
| 503 buildos: the os the build is running on | 503 buildos: the os the build is running on |
| 504 gsu: the gsutil object | 504 gsu: the gsutil object |
| 505 """ | 505 """ |
| 506 print 'UploadTestHtml({0}, {1}, {2}, {3}, gsu)'.format(buildout, | 506 print 'UploadTestHtml(%s, %s, %s, %s)' % (buildout, bucket, svnid, buildos) |
| 507 bucket, | |
| 508 svnid, | |
| 509 buildos) | |
| 510 gs_dir = '{0}/{1}'.format(bucket, svnid) | |
| 511 local_dir = '{0}'.format(svnid) | 507 local_dir = '{0}'.format(svnid) |
| 512 html_dir = os.path.join(buildout, 'html') | 508 html_dir = os.path.join(buildout, 'html') |
| 513 cwd = os.getcwd() | 509 cwd = os.getcwd() |
| 514 gs_test_dir_name = 'tests' | 510 gs_test_dir_name = 'tests' |
| 515 tmp_dir = None | 511 tmp_dir = None |
| 516 try: | 512 try: |
| 517 if os.path.exists(html_dir): | 513 if os.path.exists(html_dir): |
| 518 tmp_dir = tempfile.mkdtemp(prefix=gs_test_dir_name) | 514 tmp_dir = tempfile.mkdtemp(prefix=gs_test_dir_name) |
| 519 local_path = os.path.join(tmp_dir, local_dir) | 515 local_path = os.path.join(tmp_dir, local_dir) |
| 520 os.makedirs(local_path) | 516 os.makedirs(local_path) |
| 521 os.chdir(tmp_dir) | 517 os.chdir(tmp_dir) |
| 522 shutil.copytree(html_dir, os.path.join(local_path, gs_test_dir_name, | 518 shutil.copytree(html_dir, os.path.join(local_path, gs_test_dir_name, |
| 523 buildos)) | 519 buildos)) |
| 524 gsu.Copy(svnid, bucket, recursive_flag=True) | 520 gsu.Copy(svnid, bucket, recursive_flag=True) |
| 525 gs_elements = gsu.ReadBucket('{0}/{1}/{2}/*'.format(gs_dir, | |
| 526 gs_test_dir_name, | |
| 527 buildos)) | |
| 528 finally: | 521 finally: |
| 529 os.chdir(cwd) | 522 os.chdir(cwd) |
| 530 if tmp_dir is not None and os.path.exists(tmp_dir): | 523 if tmp_dir is not None and os.path.exists(tmp_dir): |
| 531 shutil.rmtree(tmp_dir, ignore_errors=True) | 524 shutil.rmtree(tmp_dir, ignore_errors=True) |
| 532 | 525 |
| 533 | 526 |
| 534 def _FindRcpZipFiles(out_dir): | 527 def _FindRcpZipFiles(out_dir): |
| 535 """Find the Zipped RCP files. | 528 """Find the Zipped RCP files. |
| 536 | 529 |
| 537 Args: | 530 Args: |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 615 Exception: if no dartium files can be found | 608 Exception: if no dartium files can be found |
| 616 """ | 609 """ |
| 617 print 'InstallDartium(%s, %s, %s)' % (buildroot, buildout, buildos) | 610 print 'InstallDartium(%s, %s, %s)' % (buildroot, buildout, buildos) |
| 618 | 611 |
| 619 tmp_dir = os.path.join(buildroot, 'tmp') | 612 tmp_dir = os.path.join(buildroot, 'tmp') |
| 620 | 613 |
| 621 rcpZipFiles = _FindRcpZipFiles(buildout) | 614 rcpZipFiles = _FindRcpZipFiles(buildout) |
| 622 | 615 |
| 623 for rcpZipFile in rcpZipFiles: | 616 for rcpZipFile in rcpZipFiles: |
| 624 print ' found rcp: %s' % rcpZipFile | 617 print ' found rcp: %s' % rcpZipFile |
| 618 |
| 619 if TRUNK_BUILD: |
| 620 # we look for Dartium artifacts differently for trunk vs continuous builds |
| 621 gsPrefix = "gs://dartium-archive" |
| 622 |
| 623 dartiumFiles = [] |
| 624 dartiumFiles.append( |
| 625 "%s/dartium-mac-full-trunk/dartium-mac-full-trunk-%s.0.zip" |
| 626 % (gsPrefix, REVISION)) |
| 627 dartiumFiles.append( |
| 628 "%s/dartium-lucid32-full-trunk/dartium-lucid32-full-trunk-%s.0.zip" |
| 629 % (gsPrefix, REVISION)) |
| 630 dartiumFiles.append( |
| 631 "%s/dartium-lucid64-full-trunk/dartium-lucid64-full-trunk-%s.0.zip" |
| 632 % (gsPrefix, REVISION)) |
| 633 dartiumFiles.append( |
| 634 "%s/dartium-win-full-trunk/dartium-win-full-trunk-%s.0.zip" |
| 635 % (gsPrefix, REVISION)) |
| 636 else: |
| 637 # dartium-lucid32-full-9420.9420.zip |
| 638 # dartium-lucid64-full-9420.9420.zip |
| 639 # dartium-mac-full-9420.9420.zip |
| 640 # dartium-win-full-9420.9420.zip |
| 641 # exclude dartium-lucid64-full-trunk-9571.9571.zip |
| 642 dartiumFiles = gsu.ReadBucket( |
| 643 'gs://dartium-archive/latest/dartium-*-full-[0-9]*.zip') |
| 644 |
| 645 if not dartiumFiles: |
| 646 raise Exception("could not find any dartium files") |
| 647 |
| 648 tempList = [] |
| 625 | 649 |
| 626 # dartium-lucid32-full-9420.9420.zip | 650 for dartiumFile in dartiumFiles: |
| 627 # dartium-lucid64-full-9420.9420.zip | 651 print ' found dartium: %s' % dartiumFile |
| 628 # dartium-mac-full-9420.9420.zip | 652 tempList.append(RemapDartiumUrl(dartiumFile)) |
| 629 # dartium-win-full-9420.9420.zip | |
| 630 # exclude dartium-lucid64-full-trunk-9571.9571.zip | |
| 631 dartiumFiles = gsu.ReadBucket('gs://dartium-archive/latest/dartium-*-full-[0-9
]*.zip') | |
| 632 | 653 |
| 633 if not dartiumFiles: | 654 dartiumFiles = tempList |
| 634 raise Exception("could not find any dartium files") | |
| 635 | |
| 636 tempList = [] | |
| 637 | |
| 638 for dartiumFile in dartiumFiles: | |
| 639 print ' found dartium: %s' % dartiumFile | |
| 640 tempList.append(RemapDartiumUrl(dartiumFile)) | |
| 641 | |
| 642 dartiumFiles = tempList | |
| 643 | |
| 644 | 655 |
| 645 for rcpZipFile in rcpZipFiles: | 656 for rcpZipFile in rcpZipFiles: |
| 646 searchString = None | 657 searchString = None |
| 647 | 658 |
| 648 # dart-editor-linux.gtk.x86.zip | 659 # dart-editor-linux.gtk.x86.zip |
| 649 # dart-editor-linux.gtk.x86_64.zip | 660 # dart-editor-linux.gtk.x86_64.zip |
| 650 # dart-editor-macosx.cocoa.x86.zip | 661 # dart-editor-macosx.cocoa.x86.zip |
| 651 # dart-editor-macosx.cocoa.x86_64.zip | 662 # dart-editor-macosx.cocoa.x86_64.zip |
| 652 # dart-editor-win32.win32.x86.zip | 663 # dart-editor-win32.win32.x86.zip |
| 653 # dart-editor-win32.win32.x86_64.zip | 664 # dart-editor-win32.win32.x86_64.zip |
| (...skipping 11 matching lines...) Expand all Loading... |
| 665 if searchString in dartiumFile: | 676 if searchString in dartiumFile: |
| 666 #download and unzip dartium | 677 #download and unzip dartium |
| 667 unzip_dir = os.path.join(tmp_dir, os.path.splitext(os.path.basename(dart
iumFile))[0]) | 678 unzip_dir = os.path.join(tmp_dir, os.path.splitext(os.path.basename(dart
iumFile))[0]) |
| 668 if not os.path.exists(unzip_dir): | 679 if not os.path.exists(unzip_dir): |
| 669 os.makedirs(unzip_dir) | 680 os.makedirs(unzip_dir) |
| 670 tmp_zip_file = os.path.join(tmp_dir, os.path.basename(dartiumFile)) | 681 tmp_zip_file = os.path.join(tmp_dir, os.path.basename(dartiumFile)) |
| 671 | 682 |
| 672 if not os.path.exists(tmp_zip_file): | 683 if not os.path.exists(tmp_zip_file): |
| 673 gsu.Copy(dartiumFile, tmp_zip_file, False) | 684 gsu.Copy(dartiumFile, tmp_zip_file, False) |
| 674 | 685 |
| 675 # Dartium is unzipped into ~ unzip_dir/dartium-win-inc-7665.7665 | 686 # Dartium is unzipped into ~ unzip_dir/dartium-win-full-7665.7665 |
| 676 dartium_zip = ziputils.ZipUtil(tmp_zip_file, buildos) | 687 dartium_zip = ziputils.ZipUtil(tmp_zip_file, buildos) |
| 677 dartium_zip.UnZip(unzip_dir) | 688 dartium_zip.UnZip(unzip_dir) |
| 678 else: | 689 else: |
| 679 dartium_zip = ziputils.ZipUtil(tmp_zip_file, buildos) | 690 dartium_zip = ziputils.ZipUtil(tmp_zip_file, buildos) |
| 680 | 691 |
| 681 add_path = None | 692 add_path = None |
| 682 | 693 |
| 683 if 'lin' in buildos: | 694 if 'lin' in buildos: |
| 684 paths = glob.glob(os.path.join(unzip_dir, 'dartium-*')) | 695 paths = glob.glob(os.path.join(unzip_dir, 'dartium-*')) |
| 685 add_path = paths[0] | 696 add_path = paths[0] |
| (...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1081 """delete the given file - do not re-throw any exceptions that occur""" | 1092 """delete the given file - do not re-throw any exceptions that occur""" |
| 1082 if os.path.exists(f): | 1093 if os.path.exists(f): |
| 1083 try: | 1094 try: |
| 1084 os.remove(f) | 1095 os.remove(f) |
| 1085 except: | 1096 except: |
| 1086 print 'error deleting %s' % f | 1097 print 'error deleting %s' % f |
| 1087 | 1098 |
| 1088 | 1099 |
| 1089 if __name__ == '__main__': | 1100 if __name__ == '__main__': |
| 1090 sys.exit(main()) | 1101 sys.exit(main()) |
| OLD | NEW |