Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # | 2 # |
| 3 # Copyright (c) 2013, 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 |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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( | 131 def DartArchiveUploadInstaller( |
| 132 arch, installer_file, extension, release_type=bot_utils.ReleaseType.RAW): | 132 arch, installer_file, extension, release_type=bot_utils.ReleaseType.RAW): |
| 133 namer = bot_utils.GCSNamer(CHANNEL, release_type) | 133 namer = bot_utils.GCSNamer(CHANNEL, release_type) |
| 134 gsu_path = namer.editor_installer_zipfilepath( | 134 gsu_path = namer.editor_installer_filepath( |
| 135 REVISION, SYSTEM, arch, extension) | 135 REVISION, SYSTEM, arch, extension) |
| 136 DartArchiveFile(installer_file, gsu_path, create_md5sum=False) | 136 DartArchiveFile(installer_file, gsu_path, create_md5sum=False) |
| 137 | 137 |
| 138 class AntWrapper(object): | 138 class AntWrapper(object): |
| 139 """A wrapper for ant build invocations""" | 139 """A wrapper for ant build invocations""" |
| 140 | 140 |
| 141 _antpath = None | 141 _antpath = None |
| 142 _bzippath = None | 142 _bzippath = None |
| 143 _propertyfile = None | 143 _propertyfile = None |
| 144 | 144 |
| (...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 436 os_rename = {'win': 'win32', 'mac': 'macos', 'linux': 'linux'} | 436 os_rename = {'win': 'win32', 'mac': 'macos', 'linux': 'linux'} |
| 437 system = os_rename[SYSTEM] | 437 system = os_rename[SYSTEM] |
| 438 return ( | 438 return ( |
| 439 ("%s/darteditor-%s-%s.zip" % (GSU_PATH_REV, system, arch)), | 439 ("%s/darteditor-%s-%s.zip" % (GSU_PATH_REV, system, arch)), |
| 440 ("%s/darteditor-installer-%s-%s.%s" | 440 ("%s/darteditor-installer-%s-%s.%s" |
| 441 % (GSU_PATH_REV, system, arch, extension))) | 441 % (GSU_PATH_REV, system, arch, extension))) |
| 442 | 442 |
| 443 def new_location_pair(arch, extension): | 443 def new_location_pair(arch, extension): |
| 444 namer = bot_utils.GCSNamer(CHANNEL, release_type) | 444 namer = bot_utils.GCSNamer(CHANNEL, release_type) |
| 445 editor_path = namer.editor_zipfilepath(REVISION, SYSTEM, arch) | 445 editor_path = namer.editor_zipfilepath(REVISION, SYSTEM, arch) |
| 446 installer_path = namer.editor_installer_zipfilepath( | 446 installer_path = namer.editor_installer_filepath( |
| 447 REVISION, SYSTEM, arch, extension) | 447 REVISION, SYSTEM, arch, extension) |
| 448 return (editor_path, installer_path) | 448 return (editor_path, installer_path) |
| 449 | 449 |
| 450 def create_mac_installer(arch): | 450 def create_windows_installer(installer_file, input_dir): |
| 451 with utils.TempDir('build_editor_installer') as temp_dir: | 451 msi_builder = os.path.join(DART_PATH, 'tools', |
| 452 with utils.ChangedWorkingDirectory(temp_dir): | 452 'create_windows_installer.py') |
| 453 if CHANNEL == 'dev': | 453 wix_bin = os.path.join(DART_PATH, 'third_party', |
| 454 # On the dev channel we currently use the bits from trunk. | 454 'wix') |
|
kustermann
2013/10/29 08:44:47
Do we already have this in our DEPS file?
ricow1
2013/10/29 08:59:05
No, and we will not, I will explicitly check this
| |
| 455 (gsu_editor_zip, gsu_editor_dmg) = old_location_pair(arch, 'dmg') | 455 version = utils.GetShortVersion() |
| 456 else: | 456 bot_utils.run(['python', msi_builder, |
| 457 (gsu_editor_zip, gsu_editor_dmg) = new_location_pair(arch, 'dmg') | 457 '--msi_location=%s' % installer_file, |
| 458 # Fetch the editor zip file from the old location. | 458 '--input_directory=%s' % input_dir, |
| 459 if gsu.Copy(gsu_editor_zip, 'editor.zip', False): | 459 '--version=%s' % version, |
| 460 raise Exception("gsutil command failed, aborting.") | 460 '--wix_bin=%s' % wix_bin]) |
| 461 | 461 |
| 462 # Unzip the editor (which contains a directory named 'dart'). | 462 def create_mac_installer(installer_file): |
| 463 bot_utils.run(['unzip', 'editor.zip']) | 463 dart_folder_icon = os.path.join(DART_PATH, |
| 464 assert os.path.exists('dart') and os.path.isdir('dart') | 464 'editor/tools/plugins/com.google.dart.tools.ui/' + |
| 465 'icons/dart_about_140_160.png') | |
| 466 dmg_builder = os.path.join(DART_PATH, 'tools', | |
| 467 'mac_build_editor_dmg.sh') | |
| 468 bot_utils.run([dmg_builder, installer_file, 'dart', | |
| 469 dart_folder_icon, "Dart Distribution"]) | |
|
kustermann
2013/10/29 08:44:47
You could rename this to "Dart Installer" -- so we
ricow1
2013/10/29 08:59:05
Done.
| |
| 465 | 470 |
| 466 # Build the dmg installer | |
| 467 dmg_installer = os.path.join(temp_dir,'darteditor-installer.dmg') | |
| 468 dart_folder_icon = os.path.join(DART_PATH, | |
| 469 'editor/tools/plugins/com.google.dart.tools.ui/' + | |
| 470 'icons/dart_about_140_160.png') | |
| 471 dmg_builder = os.path.join(DART_PATH, 'tools', | |
| 472 'mac_build_editor_dmg.sh') | |
| 473 bot_utils.run([dmg_builder, dmg_installer, 'dart', | |
| 474 dart_folder_icon, "Dart Distribution"]) | |
| 475 assert os.path.isfile(dmg_installer) | |
| 476 | 471 |
| 477 if CHANNEL == 'dev': | 472 if SYSTEM == 'mac' or SYSTEM == 'win': |
| 478 # Archive to old bucket | 473 for arch in ['32', '64']: |
| 479 # TODO(kustermann/ricow): Remove all the old archiving code, | 474 extension = 'dmg' if SYSTEM == 'mac' else 'msi' |
| 480 # once everything points to the new location. | 475 with utils.TempDir('build_editor_installer') as temp_dir: |
| 481 if gsu.Copy(dmg_installer, gsu_editor_dmg): | 476 with utils.ChangedWorkingDirectory(temp_dir): |
| 477 if CHANNEL == 'dev': | |
| 478 # On the dev channel we currently use the bits from trunk. | |
| 479 (gsu_editor_zip, | |
| 480 gsu_editor_installer) = old_location_pair(arch, extension) | |
| 481 else: | |
| 482 (gsu_editor_zip, | |
| 483 gsu_editor_installer) = new_location_pair(arch, extension) | |
| 484 # Fetch the editor zip file from the old location. | |
| 485 zip_location = os.path.join(temp_dir, 'editor.zip') | |
| 486 if gsu.Copy(gsu_editor_zip, zip_location, False): | |
| 482 raise Exception("gsutil command failed, aborting.") | 487 raise Exception("gsutil command failed, aborting.") |
| 488 # Unzip the editor (which contains a directory named 'dart'). | |
| 489 unzip_dir = os.path.join(temp_dir, 'dart') | |
|
kustermann
2013/10/29 08:44:47
Isn't this creating a directory structure like thi
ricow1
2013/10/29 08:59:05
Indeed it is, changed
| |
| 490 os.makedirs(unzip_dir) | |
| 491 dartium_zip = ziputils.ZipUtil(zip_location, buildos) | |
| 492 dartium_zip.UnZip(unzip_dir) | |
|
kustermann
2013/10/29 08:44:47
This is not dartium. Rename it.
+ Do we need to c
ricow1
2013/10/29 08:59:05
renamed - regarding close I think you are confusin
| |
| 483 | 493 |
| 484 # Archive to new bucket | 494 assert os.path.exists('dart') and os.path.isdir('dart') |
| 485 # NOTE: This is a little bit hackisch, we fetch the editor from | 495 installer_name = 'darteditor-installer.%s' % extension |
| 486 # the old bucket and archive the dmg to the new bucket here. | 496 installer_file = os.path.join(temp_dir, installer_name) |
| 487 DartArchiveUploadInstaller(arch, dmg_installer, 'dmg', | 497 if SYSTEM == 'mac': |
| 488 release_type=release_type) | 498 create_mac_installer(installer_file) |
| 499 else: | |
| 500 create_windows_installer(installer_file, unzip_dir) | |
| 501 assert os.path.isfile(installer_file) | |
| 489 | 502 |
| 490 if SYSTEM == 'mac': | 503 if CHANNEL == 'dev': |
| 491 for arch in ['32', '64']: | 504 # Archive to old bucket |
| 492 create_mac_installer(arch) | 505 # TODO(kustermann/ricow): Remove all the old archiving code, |
| 506 # once everything points to the new location. | |
| 507 if gsu.Copy(installer_file, gsu_editor_installer): | |
| 508 raise Exception("gsutil command failed, aborting.") | |
| 509 | |
| 510 # Archive to new bucket | |
| 511 # NOTE: This is a little bit hackisch, we fetch the editor from | |
| 512 # the old bucket and archive the dmg to the new bucket here. | |
| 513 DartArchiveUploadInstaller(arch, installer_file, extension, | |
| 514 release_type=release_type) | |
| 515 | |
| 493 else: | 516 else: |
| 494 raise Exception( | 517 raise Exception( |
| 495 "We currently cannot build installers for %s" % SYSTEM) | 518 "We currently cannot build installers for %s" % SYSTEM) |
| 496 def build_editor(sdk_zip): | 519 def build_editor(sdk_zip): |
| 497 ant_property_file = tempfile.NamedTemporaryFile(suffix='.property', | 520 ant_property_file = tempfile.NamedTemporaryFile(suffix='.property', |
| 498 prefix='AntProperties', | 521 prefix='AntProperties', |
| 499 delete=False) | 522 delete=False) |
| 500 ant_property_file.close() | 523 ant_property_file.close() |
| 501 ant = AntWrapper(ant_property_file.name, os.path.join(antpath, 'bin'), | 524 ant = AntWrapper(ant_property_file.name, os.path.join(antpath, 'bin'), |
| 502 bzip2libpath) | 525 bzip2libpath) |
| (...skipping 853 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1356 """delete the given file - do not re-throw any exceptions that occur""" | 1379 """delete the given file - do not re-throw any exceptions that occur""" |
| 1357 if os.path.exists(f): | 1380 if os.path.exists(f): |
| 1358 try: | 1381 try: |
| 1359 os.remove(f) | 1382 os.remove(f) |
| 1360 except OSError: | 1383 except OSError: |
| 1361 print 'error deleting %s' % f | 1384 print 'error deleting %s' % f |
| 1362 | 1385 |
| 1363 | 1386 |
| 1364 if __name__ == '__main__': | 1387 if __name__ == '__main__': |
| 1365 sys.exit(main()) | 1388 sys.exit(main()) |
| OLD | NEW |