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

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

Issue 61893007: Cleanup of scripts after removal of trunk builders. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 1 month 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 | « no previous file | editor/build/promote.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) 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
11 import os 11 import os
12 import re 12 import re
13 import shutil 13 import shutil
14 import stat 14 import stat
15 import subprocess 15 import subprocess
16 import sys 16 import sys
17 import tempfile 17 import tempfile
18 import zipfile 18 import zipfile
19 import ziputils 19 import ziputils
20 20
21 from os.path import join 21 from os.path import join
22 22
23 BUILD_OS = None 23 BUILD_OS = None
24 DART_PATH = None 24 DART_PATH = None
25 TOOLS_PATH = None 25 TOOLS_PATH = None
26 26
27 GSU_PATH_REV = None
28 GSU_PATH_LATEST = None
29 GSU_API_DOCS_PATH = None 27 GSU_API_DOCS_PATH = None
30 GSU_API_DOCS_BUCKET = 'gs://dartlang-api-docs' 28 GSU_API_DOCS_BUCKET = 'gs://dartlang-api-docs'
31 29
32 CHANNEL = None 30 CHANNEL = None
33 PLUGINS_BUILD = None 31 PLUGINS_BUILD = None
34 REVISION = None 32 REVISION = None
35 SYSTEM = None 33 SYSTEM = None
36 TRUNK_BUILD = None
37 34
38 NO_UPLOAD = None 35 NO_UPLOAD = None
39 36
40 DART_DIR = os.path.abspath(os.path.join(__file__, '..', '..', '..')) 37 DART_DIR = os.path.abspath(os.path.join(__file__, '..', '..', '..'))
41 utils = imp.load_source('utils', os.path.join(DART_DIR, 'tools', 'utils.py')) 38 utils = imp.load_source('utils', os.path.join(DART_DIR, 'tools', 'utils.py'))
42 bot_utils = imp.load_source('bot_utils', 39 bot_utils = imp.load_source('bot_utils',
43 os.path.join(DART_DIR, 'tools', 'bots', 'bot_utils.py')) 40 os.path.join(DART_DIR, 'tools', 'bots', 'bot_utils.py'))
44 41
45 def DartArchiveFile(local_path, remote_path, create_md5sum=False): 42 def DartArchiveFile(local_path, remote_path, create_md5sum=False):
46 # Copy it to the new unified gs://dart-archive bucket 43 # Copy it to the new unified gs://dart-archive bucket
47 # TODO(kustermann/ricow): Remove all the old archiving code, once everything
48 # points to the new location
49 gsutil = bot_utils.GSUtil() 44 gsutil = bot_utils.GSUtil()
50 gsutil.upload(local_path, remote_path, public=True) 45 gsutil.upload(local_path, remote_path, public=True)
51 if create_md5sum: 46 if create_md5sum:
52 # 'local_path' may have a different filename than 'remote_path'. So we need 47 # 'local_path' may have a different filename than 'remote_path'. So we need
53 # to make sure the *.md5sum file contains the correct name. 48 # to make sure the *.md5sum file contains the correct name.
54 assert '/' in remote_path and not remote_path.endswith('/') 49 assert '/' in remote_path and not remote_path.endswith('/')
55 mangled_filename = remote_path[remote_path.rfind('/') + 1:] 50 mangled_filename = remote_path[remote_path.rfind('/') + 1:]
56 local_md5sum = bot_utils.CreateChecksumFile(local_path, mangled_filename) 51 local_md5sum = bot_utils.CreateChecksumFile(local_path, mangled_filename)
57 gsutil.upload(local_md5sum, remote_path + '.md5sum', public=True) 52 gsutil.upload(local_md5sum, remote_path + '.md5sum', public=True)
58 53
59 def DartArchiveUploadEditorZipFile(zipfile): 54 def DartArchiveUploadEditorZipFile(zipfile):
60 # TODO(kustermann): We don't archive trunk builds to gs://dart-archive/
61 # Remove this once the channel transition is done.
62 if CHANNEL == 'trunk': return
63 namer = bot_utils.GCSNamer(CHANNEL, bot_utils.ReleaseType.RAW) 55 namer = bot_utils.GCSNamer(CHANNEL, bot_utils.ReleaseType.RAW)
64 gsutil = bot_utils.GSUtil() 56 gsutil = bot_utils.GSUtil()
65 57
66 basename = os.path.basename(zipfile) 58 basename = os.path.basename(zipfile)
67 system = None 59 system = None
68 arch = None 60 arch = None
69 if basename.startswith('darteditor-linux'): 61 if basename.startswith('darteditor-linux'):
70 system = 'linux' 62 system = 'linux'
71 elif basename.startswith('darteditor-mac'): 63 elif basename.startswith('darteditor-mac'):
72 system = 'macos' 64 system = 'macos'
73 elif basename.startswith('darteditor-win'): 65 elif basename.startswith('darteditor-win'):
74 system = 'windows' 66 system = 'windows'
75 67
76 if basename.endswith('-32.zip'): 68 if basename.endswith('-32.zip'):
77 arch = 'ia32' 69 arch = 'ia32'
78 elif basename.endswith('-64.zip'): 70 elif basename.endswith('-64.zip'):
79 arch = 'x64' 71 arch = 'x64'
80 72
81 assert system and arch 73 assert system and arch
82 74
83 for revision in [REVISION, 'latest']: 75 for revision in [REVISION, 'latest']:
84 DartArchiveFile(zipfile, namer.editor_zipfilepath(revision, system, arch), 76 DartArchiveFile(zipfile, namer.editor_zipfilepath(revision, system, arch),
85 create_md5sum=True) 77 create_md5sum=True)
86 78
87 def DartArchiveUploadUpdateSite(local_path): 79 def DartArchiveUploadUpdateSite(local_path):
88 # TODO(kustermann): We don't archive trunk builds to gs://dart-archive/
89 # Remove this once the channel transition is done.
90 if CHANNEL == 'trunk': return
91 namer = bot_utils.GCSNamer(CHANNEL, bot_utils.ReleaseType.RAW) 80 namer = bot_utils.GCSNamer(CHANNEL, bot_utils.ReleaseType.RAW)
92 gsutil = bot_utils.GSUtil() 81 gsutil = bot_utils.GSUtil()
93 for revision in [REVISION, 'latest']: 82 for revision in [REVISION, 'latest']:
94 update_site_dir = namer.editor_eclipse_update_directory(revision) 83 update_site_dir = namer.editor_eclipse_update_directory(revision)
95 try: 84 try:
96 gsutil.remove(update_site_dir, recursive=True) 85 gsutil.remove(update_site_dir, recursive=True)
97 except: 86 except:
98 # Ignore this, in the general case there is nothing. 87 # Ignore this, in the general case there is nothing.
99 pass 88 pass
100 gsutil.upload(local_path, update_site_dir, recursive=True, public=True) 89 gsutil.upload(local_path, update_site_dir, recursive=True, public=True)
101 90
102 def DartArchiveUploadSDKs(system, sdk32_zip, sdk64_zip): 91 def DartArchiveUploadSDKs(system, sdk32_zip, sdk64_zip):
103 # TODO(kustermann): We don't archive trunk builds to gs://dart-archive/
104 # Remove this once the channel transition is done.
105 if CHANNEL == 'trunk': return
106 namer = bot_utils.GCSNamer(CHANNEL, bot_utils.ReleaseType.RAW) 92 namer = bot_utils.GCSNamer(CHANNEL, bot_utils.ReleaseType.RAW)
107 for revision in [REVISION, 'latest']: 93 for revision in [REVISION, 'latest']:
108 path32 = namer.sdk_zipfilepath(revision, system, 'ia32', 'release') 94 path32 = namer.sdk_zipfilepath(revision, system, 'ia32', 'release')
109 path64 = namer.sdk_zipfilepath(revision, system, 'x64', 'release') 95 path64 = namer.sdk_zipfilepath(revision, system, 'x64', 'release')
110 DartArchiveFile(sdk32_zip, path32, create_md5sum=True) 96 DartArchiveFile(sdk32_zip, path32, create_md5sum=True)
111 DartArchiveFile(sdk64_zip, path64, create_md5sum=True) 97 DartArchiveFile(sdk64_zip, path64, create_md5sum=True)
112 98
113 def DartArchiveUploadAPIDocs(api_zip): 99 def DartArchiveUploadAPIDocs(api_zip):
114 # TODO(kustermann): We don't archive trunk builds to gs://dart-archive/
115 # Remove this once the channel transition is done.
116 if CHANNEL == 'trunk': return
117 namer = bot_utils.GCSNamer(CHANNEL, bot_utils.ReleaseType.RAW) 100 namer = bot_utils.GCSNamer(CHANNEL, bot_utils.ReleaseType.RAW)
118 for revision in [REVISION, 'latest']: 101 for revision in [REVISION, 'latest']:
119 destination = (namer.apidocs_directory(revision) + '/' + 102 destination = (namer.apidocs_directory(revision) + '/' +
120 namer.apidocs_zipfilename()) 103 namer.apidocs_zipfilename())
121 DartArchiveFile(api_zip, destination, create_md5sum=False) 104 DartArchiveFile(api_zip, destination, create_md5sum=False)
122 105
123 def DartArchiveUploadVersionFile(version_file): 106 def DartArchiveUploadVersionFile(version_file):
124 # TODO(kustermann): We don't archive trunk builds to gs://dart-archive/.
125 # Remove this once the channel transition is done.
126 if CHANNEL == 'trunk': return
127 namer = bot_utils.GCSNamer(CHANNEL, bot_utils.ReleaseType.RAW) 107 namer = bot_utils.GCSNamer(CHANNEL, bot_utils.ReleaseType.RAW)
128 for revision in [REVISION, 'latest']: 108 for revision in [REVISION, 'latest']:
129 DartArchiveFile(version_file, namer.version_filepath(revision), 109 DartArchiveFile(version_file, namer.version_filepath(revision),
130 create_md5sum=False) 110 create_md5sum=False)
131 111
132 def DartArchiveUploadInstaller( 112 def DartArchiveUploadInstaller(
133 arch, installer_file, extension, release_type=bot_utils.ReleaseType.RAW): 113 arch, installer_file, extension, release_type=bot_utils.ReleaseType.RAW):
134 namer = bot_utils.GCSNamer(CHANNEL, release_type) 114 namer = bot_utils.GCSNamer(CHANNEL, release_type)
135 gsu_path = namer.editor_installer_filepath( 115 gsu_path = namer.editor_installer_filepath(
136 REVISION, SYSTEM, arch, extension) 116 REVISION, SYSTEM, arch, extension)
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 222
243 print ' '.join(args) 223 print ' '.join(args)
244 status = subprocess.call(args, shell=is_windows) 224 status = subprocess.call(args, shell=is_windows)
245 os.chdir(cwd) 225 os.chdir(cwd)
246 return status 226 return status
247 227
248 228
249 def BuildOptions(): 229 def BuildOptions():
250 """Setup the argument processing for this program.""" 230 """Setup the argument processing for this program."""
251 result = optparse.OptionParser() 231 result = optparse.OptionParser()
252 result.set_default('dest', 'gs://dart-editor-archive-continuous')
253 result.add_option('-m', '--mode', 232 result.add_option('-m', '--mode',
254 help='Build variants (comma-separated).', 233 help='Build variants (comma-separated).',
255 metavar='[all,debug,release]', 234 metavar='[all,debug,release]',
256 default='debug') 235 default='debug')
257 result.add_option('-v', '--verbose', 236 result.add_option('-v', '--verbose',
258 help='Verbose output.', 237 help='Verbose output.',
259 default=False, action='store') 238 default=False, action='store')
260 result.add_option('-r', '--revision', 239 result.add_option('-r', '--revision',
261 help='SVN Revision.', 240 help='SVN Revision.',
262 action='store') 241 action='store')
(...skipping 10 matching lines...) Expand all
273 help='Fetch editor, build installer and archive it.', 252 help='Fetch editor, build installer and archive it.',
274 action='store_true', default=False) 253 action='store_true', default=False)
275 return result 254 return result
276 255
277 def main(): 256 def main():
278 """Main entry point for the build program.""" 257 """Main entry point for the build program."""
279 global BUILD_OS 258 global BUILD_OS
280 global CHANNEL 259 global CHANNEL
281 global DART_PATH 260 global DART_PATH
282 global GSU_API_DOCS_PATH 261 global GSU_API_DOCS_PATH
283 global GSU_PATH_LATEST
284 global GSU_PATH_REV
285 global NO_UPLOAD 262 global NO_UPLOAD
286 global PLUGINS_BUILD 263 global PLUGINS_BUILD
287 global REVISION 264 global REVISION
288 global SYSTEM 265 global SYSTEM
289 global TOOLS_PATH 266 global TOOLS_PATH
290 global TRUNK_BUILD
291 267
292 if not sys.argv: 268 if not sys.argv:
293 print 'Script pathname not known, giving up.' 269 print 'Script pathname not known, giving up.'
294 return 1 270 return 1
295 271
296 scriptdir = os.path.abspath(os.path.dirname(sys.argv[0])) 272 scriptdir = os.path.abspath(os.path.dirname(sys.argv[0]))
297 editorpath = os.path.abspath(os.path.join(scriptdir, '..')) 273 editorpath = os.path.abspath(os.path.join(scriptdir, '..'))
298 thirdpartypath = os.path.abspath(os.path.join(scriptdir, '..', '..', 274 thirdpartypath = os.path.abspath(os.path.join(scriptdir, '..', '..',
299 'third_party')) 275 'third_party'))
300 toolspath = os.path.abspath(os.path.join(scriptdir, '..', '..', 276 toolspath = os.path.abspath(os.path.join(scriptdir, '..', '..',
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 lastc = revision[-1] 339 lastc = revision[-1]
364 if lastc.isalpha(): 340 if lastc.isalpha():
365 revision = revision[0:-1] 341 revision = revision[0:-1]
366 index = revision.find(':') 342 index = revision.find(':')
367 if index > -1: 343 if index > -1:
368 revision = revision[0:index] 344 revision = revision[0:index]
369 print 'revision = |{0}|'.format(revision) 345 print 'revision = |{0}|'.format(revision)
370 buildout = os.path.abspath(options.out) 346 buildout = os.path.abspath(options.out)
371 print 'buildout = {0}'.format(buildout) 347 print 'buildout = {0}'.format(buildout)
372 348
373 # Get user name. If it does not start with chrome then deploy to the test 349 username = utils.GetUserName()
374 # bucket; otherwise deploy to the continuous bucket. 350 if not username:
375 username = os.environ.get('USER')
376 if username is None:
377 username = os.environ.get('USERNAME')
378
379 if username is None:
380 print 'Could not find username' 351 print 'Could not find username'
381 return 6 352 return 6
382 353
383 build_skip_tests = os.environ.get('DART_SKIP_RUNNING_TESTS') 354 build_skip_tests = os.environ.get('DART_SKIP_RUNNING_TESTS')
384 sdk_environment = os.environ 355 sdk_environment = os.environ
385 if sdk_environment.has_key('JAVA_HOME'): 356 if sdk_environment.has_key('JAVA_HOME'):
386 print 'JAVA_HOME = {0}'.format(str(sdk_environment['JAVA_HOME'])) 357 print 'JAVA_HOME = {0}'.format(str(sdk_environment['JAVA_HOME']))
387 358
388 # dart-editor[-trunk], dart-editor-(win/mac/linux)[-trunk/be/dev/stable]
389 builder_name = str(options.name)
390
391 EDITOR_REGEXP = (r'^dart-editor(-(?P<installer>(installer)))?' 359 EDITOR_REGEXP = (r'^dart-editor(-(?P<installer>(installer)))?'
392 '(-(?P<system>(win|mac|linux)))?' + 360 '(-(?P<system>(win|mac|linux)))?' +
393 '(-(?P<channel>(trunk|be|dev|stable)))?$') 361 '(-(?P<channel>(be|dev|stable)))?$')
362 builder_name = str(options.name)
394 match = re.match(EDITOR_REGEXP, builder_name) 363 match = re.match(EDITOR_REGEXP, builder_name)
395 if not match: 364 if not match:
396 raise Exception("Buildername '%s' does not match pattern '%s'." 365 raise Exception("Buildername '%s' does not match pattern '%s'."
397 % (builder_name, EDITOR_REGEXP)) 366 % (builder_name, EDITOR_REGEXP))
398 367
399 CHANNEL = match.groupdict()['channel'] or 'be' 368 CHANNEL = match.groupdict()['channel'] or 'be'
400 SYSTEM = match.groupdict()['system'] 369 SYSTEM = match.groupdict()['system']
401 BUILD_INSTALLER = bool(match.groupdict()['installer']) 370 BUILD_INSTALLER = bool(match.groupdict()['installer'])
402 371
403 TRUNK_BUILD = CHANNEL == 'trunk'
404 PLUGINS_BUILD = SYSTEM is None 372 PLUGINS_BUILD = SYSTEM is None
405 REVISION = revision 373 REVISION = revision
406 374
407 # Make sure the buildername and the options agree 375 # Make sure the buildername and the options agree
408 assert BUILD_INSTALLER == options.build_installer 376 assert BUILD_INSTALLER == options.build_installer
409 377
410 if username.startswith('chrome'): 378 running_on_buildbot = username.startswith('chrome')
411 if TRUNK_BUILD:
412 bucket = 'gs://dart-editor-archive-trunk'
413 else:
414 bucket = 'gs://dart-editor-archive-continuous'
415 running_on_buildbot = True
416 else:
417 bucket = 'gs://dart-editor-archive-testing'
418 running_on_buildbot = False
419 sdk_environment['DART_LOCAL_BUILD'] = 'dart-editor-archive-testing'
420 379
421 GSU_PATH_REV = '%s/%s' % (bucket, REVISION)
422 GSU_PATH_LATEST = '%s/%s' % (bucket, 'latest')
423 GSU_API_DOCS_PATH = '%s/%s' % (GSU_API_DOCS_BUCKET, REVISION) 380 GSU_API_DOCS_PATH = '%s/%s' % (GSU_API_DOCS_BUCKET, REVISION)
424 381
425 homegsutil = join(DART_PATH, 'third_party', 'gsutil', 'gsutil') 382 homegsutil = join(DART_PATH, 'third_party', 'gsutil', 'gsutil')
426 gsu = gsutil.GsUtil(False, homegsutil, 383 gsu = gsutil.GsUtil(False, homegsutil,
427 running_on_buildbot=running_on_buildbot) 384 running_on_buildbot=running_on_buildbot)
428 385
429 def build_installer(): 386 def build_installer():
430 release_type = bot_utils.ReleaseType.SIGNED 387 release_type = bot_utils.ReleaseType.SIGNED
431 if CHANNEL == 'be': 388 if CHANNEL == 'be':
432 # We don't have signed bits on bleeding_edge, so we take the unsigned 389 # We don't have signed bits on bleeding_edge, so we take the unsigned
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
592 _InstallArtifacts(buildout, buildos, extra_artifacts) 549 _InstallArtifacts(buildout, buildos, extra_artifacts)
593 550
594 # dart-editor-linux.gtk.x86.zip --> darteditor-linux-32.zip 551 # dart-editor-linux.gtk.x86.zip --> darteditor-linux-32.zip
595 RenameRcpZipFiles(buildout) 552 RenameRcpZipFiles(buildout)
596 553
597 PostProcessEditorBuilds(buildout, buildos) 554 PostProcessEditorBuilds(buildout, buildos)
598 555
599 if running_on_buildbot: 556 if running_on_buildbot:
600 version_file = _FindVersionFile(buildout) 557 version_file = _FindVersionFile(buildout)
601 if version_file: 558 if version_file:
602 UploadFile(version_file, False)
603 DartArchiveUploadVersionFile(version_file) 559 DartArchiveUploadVersionFile(version_file)
604 560
605 found_zips = _FindRcpZipFiles(buildout) 561 found_zips = _FindRcpZipFiles(buildout)
606 for zipfile in found_zips: 562 for zipfile in found_zips:
607 UploadFile(zipfile)
608 DartArchiveUploadEditorZipFile(zipfile) 563 DartArchiveUploadEditorZipFile(zipfile)
609 564
610 return 0 565 return 0
611 566
612 if BUILD_INSTALLER: 567 if BUILD_INSTALLER:
613 build_installer() 568 build_installer()
614 else: 569 else:
615 build_editor(sdk_zip) 570 build_editor(sdk_zip)
616 finally: 571 finally:
617 if ant_property_file is not None: 572 if ant_property_file is not None:
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
813 # black/white-listing mechanism. 768 # black/white-listing mechanism.
814 FileDelete(join(add_path, 'mini_installer.exe')) 769 FileDelete(join(add_path, 'mini_installer.exe'))
815 FileDelete(join(add_path, 'sync_unit_tests.exe')) 770 FileDelete(join(add_path, 'sync_unit_tests.exe'))
816 FileDelete(join(add_path, 'chrome.packed.7z')) 771 FileDelete(join(add_path, 'chrome.packed.7z'))
817 772
818 # Add dartium to the rcp zip 773 # Add dartium to the rcp zip
819 dart_zip.AddDirectoryTree(add_path, 'dart/chromium') 774 dart_zip.AddDirectoryTree(add_path, 'dart/chromium')
820 shutil.rmtree(tmp_dir, True) 775 shutil.rmtree(tmp_dir, True)
821 776
822 777
823 def InstallDartiumFromOldDartiumArchive(buildroot, buildout, buildos, gsu):
824 """Install Dartium into the RCP zip files and upload a version of Dartium
825
826 Args:
827 buildroot: the boot of the build output
828 buildout: the location of the ant build output
829 buildos: the OS the build is running under
830 gsu: the gsutil wrapper
831 Raises:
832 Exception: if no dartium files can be found
833 """
834 print 'InstallDartium(%s, %s, %s)' % (buildroot, buildout, buildos)
835
836 tmp_dir = os.path.join(buildroot, 'tmp')
837
838 rcpZipFiles = _FindRcpZipFiles(buildout)
839
840 for rcpZipFile in rcpZipFiles:
841 print ' found rcp: %s' % rcpZipFile
842
843 dartiumFiles = []
844
845 dartiumFiles.append("gs://dartium-archive/dartium-mac-full-trunk/"
846 + "dartium-mac-full-trunk-%s.0.zip" % REVISION)
847 dartiumFiles.append("gs://dartium-archive/dartium-win-full-trunk/"
848 + "dartium-win-full-trunk-%s.0.zip" % REVISION)
849 dartiumFiles.append("gs://dartium-archive/dartium-lucid32-full-trunk/"
850 + "dartium-lucid32-full-trunk-%s.0.zip" % REVISION)
851 dartiumFiles.append("gs://dartium-archive/dartium-lucid64-full-trunk/"
852 + "dartium-lucid64-full-trunk-%s.0.zip" % REVISION)
853
854 for rcpZipFile in rcpZipFiles:
855 searchString = None
856
857 # dart-editor-linux.gtk.x86.zip, ...
858
859 if '-linux.gtk.x86.zip' in rcpZipFile:
860 searchString = 'dartium-lucid32'
861 if '-linux.gtk.x86_64.zip' in rcpZipFile:
862 searchString = 'dartium-lucid64'
863 if 'macosx' in rcpZipFile:
864 searchString = 'dartium-mac'
865 if 'win32' in rcpZipFile:
866 searchString = 'dartium-win'
867
868 for dartiumFile in dartiumFiles:
869 if searchString in dartiumFile:
870 #download and unzip dartium
871 unzip_dir = os.path.join(tmp_dir,
872 os.path.splitext(os.path.basename(dartiumFile))[0])
873 if not os.path.exists(unzip_dir):
874 os.makedirs(unzip_dir)
875 # Always download as searchString.zip
876 basename = "%s.zip" % searchString
877 tmp_zip_file = os.path.join(tmp_dir, basename)
878
879 if not os.path.exists(tmp_zip_file):
880 if gsu.Copy(dartiumFile, tmp_zip_file, False):
881 raise Exception("gsutil command failed, aborting.")
882
883 # Upload dartium zip to make sure we have consistent dartium downloads
884 UploadFile(tmp_zip_file)
885
886 # Dartium is unzipped into ~ unzip_dir/dartium-win-full-7665.7665
887 dartium_zip = ziputils.ZipUtil(tmp_zip_file, buildos)
888 dartium_zip.UnZip(unzip_dir)
889 else:
890 dartium_zip = ziputils.ZipUtil(tmp_zip_file, buildos)
891
892 dart_zip_path = join(buildout, rcpZipFile)
893 dart_zip = ziputils.ZipUtil(dart_zip_path, buildos)
894
895 if 'lin' in buildos:
896 paths = glob.glob(join(unzip_dir, 'dartium-*'))
897 add_path = paths[0]
898 zip_rel_path = 'dart/chromium'
899 # add to the rcp zip
900 dart_zip.AddDirectoryTree(add_path, zip_rel_path)
901 if 'win' in buildos:
902 paths = glob.glob(join(unzip_dir, 'dartium-*'))
903 add_path = paths[0]
904 zip_rel_path = 'dart/chromium'
905 FileDelete(join(add_path, 'mini_installer.exe'))
906 FileDelete(join(add_path, 'sync_unit_tests.exe'))
907 FileDelete(join(add_path, 'chrome.packed.7z'))
908 # add to the rcp zip
909 dart_zip.AddDirectoryTree(add_path, zip_rel_path)
910 if 'mac' in buildos:
911 paths = glob.glob(join(unzip_dir, 'dartium-*'))
912 add_path = paths[0]
913 zip_rel_path = 'dart/chromium'
914 # add to the rcp zip
915 dart_zip.AddDirectoryTree(add_path, zip_rel_path)
916
917
918 shutil.rmtree(tmp_dir, True)
919
920
921 def InstallDartium(buildroot, buildout, buildos, gsu): 778 def InstallDartium(buildroot, buildout, buildos, gsu):
922 if TRUNK_BUILD: 779 # On our be/dev/stable channels, we fetch dartium from the new
923 # On trunk builds we fetch dartium from the old location (where the 780 # gs://dart-archive/ location.
924 # dartium-*-trunk builders archive to) 781 InstallDartiumFromDartArchive(buildroot, buildout, buildos, gsu)
925 InstallDartiumFromOldDartiumArchive(buildroot, buildout, buildos, gsu)
926 else:
927 # On our be/dev/stable channels, we fetch dartium from the new
928 # gs://dart-archive/ location.
929 InstallDartiumFromDartArchive(buildroot, buildout, buildos, gsu)
930 782
931 783
932 def _InstallArtifacts(buildout, buildos, extra_artifacts): 784 def _InstallArtifacts(buildout, buildos, extra_artifacts):
933 """Install extra build artifacts into the RCP zip files. 785 """Install extra build artifacts into the RCP zip files.
934 786
935 Args: 787 Args:
936 buildout: the location of the ant build output 788 buildout: the location of the ant build output
937 buildos: the OS the build is running under 789 buildos: the OS the build is running under
938 extra_artifacts: the directory containing the extra artifacts 790 extra_artifacts: the directory containing the extra artifacts
939 """ 791 """
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
1059 readme_file = join('dart', 'README') 911 readme_file = join('dart', 'README')
1060 if (basename.startswith('darteditor-win32-')): 912 if (basename.startswith('darteditor-win32-')):
1061 seven_zip = os.path.join(DART_DIR, 'third_party', '7zip', '7za.exe') 913 seven_zip = os.path.join(DART_DIR, 'third_party', '7zip', '7za.exe')
1062 bot_utils.run([seven_zip, 'd', zipFile, readme_file], env=os.environ) 914 bot_utils.run([seven_zip, 'd', zipFile, readme_file], env=os.environ)
1063 else: 915 else:
1064 bot_utils.run(['zip', '-d', zipFile, readme_file], env=os.environ) 916 bot_utils.run(['zip', '-d', zipFile, readme_file], env=os.environ)
1065 917
1066 # If we're on -dev/-stable build: add an editor.properties file 918 # If we're on -dev/-stable build: add an editor.properties file
1067 # pointing to the correct update location of the editor for the channel 919 # pointing to the correct update location of the editor for the channel
1068 # we're building for. 920 # we're building for.
1069 if not TRUNK_BUILD and CHANNEL != 'be': 921 if CHANNEL != 'be':
1070 f = ziputils.ZipUtil(zipFile, buildos) 922 f = ziputils.ZipUtil(zipFile, buildos)
1071 f.AddFile(editor_properties, 'dart/editor.properties') 923 f.AddFile(editor_properties, 'dart/editor.properties')
1072 924
1073 # Add a shell/bat script to download contentshell and dartium debug. 925 # Add a shell/bat script to download contentshell and dartium debug.
1074 # (including the necessary tools/dartium/download_file.dart helper). 926 # (including the necessary tools/dartium/download_file.dart helper).
1075 add_download_scripts(zipFile, '64' if is_64bit else '32') 927 add_download_scripts(zipFile, '64' if is_64bit else '32')
1076 928
1077 # adjust memory params for 64 bit versions 929 # adjust memory params for 64 bit versions
1078 if is_64bit: 930 if is_64bit:
1079 if (basename.startswith('darteditor-macos-')): 931 if (basename.startswith('darteditor-macos-')):
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
1114 966
1115 def Modify64BitDartEditorIni(iniFilePath): 967 def Modify64BitDartEditorIni(iniFilePath):
1116 f = open(iniFilePath, 'r') 968 f = open(iniFilePath, 'r')
1117 lines = f.readlines() 969 lines = f.readlines()
1118 f.close() 970 f.close()
1119 lines[lines.index('-Xms40m\n')] = '-Xms256m\n' 971 lines[lines.index('-Xms40m\n')] = '-Xms256m\n'
1120 lines[lines.index('-Xmx1000m\n')] = '-Xmx2000m\n' 972 lines[lines.index('-Xmx1000m\n')] = '-Xmx2000m\n'
1121 # Add -d64 to give better error messages to user in 64 bit mode. 973 # Add -d64 to give better error messages to user in 64 bit mode.
1122 lines[lines.index('-vmargs\n')] = '-vmargs\n-d64\n' 974 lines[lines.index('-vmargs\n')] = '-vmargs\n-d64\n'
1123 f = open(iniFilePath, 'w') 975 f = open(iniFilePath, 'w')
1124 f.writelines(lines); 976 f.writelines(lines)
1125 f.close() 977 f.close()
1126 978
1127 979
1128 def RunEditorTests(buildout, buildos): 980 def RunEditorTests(buildout, buildos):
1129 StartBuildStep('run_tests') 981 StartBuildStep('run_tests')
1130 982
1131 for editorArchive in _GetTestableRcpArchives(buildout): 983 for editorArchive in _GetTestableRcpArchives(buildout):
1132 with utils.TempDir('editor_') as tempDir: 984 with utils.TempDir('editor_') as tempDir:
1133 print 'Running tests for %s...' % editorArchive 985 print 'Running tests for %s...' % editorArchive
1134 986
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
1208 1060
1209 def BuildUpdateSite(ant, revision, name, buildroot, buildout, 1061 def BuildUpdateSite(ant, revision, name, buildroot, buildout,
1210 editorpath, buildos): 1062 editorpath, buildos):
1211 status = ant.RunAnt('../com.google.dart.eclipse.feature_releng', 1063 status = ant.RunAnt('../com.google.dart.eclipse.feature_releng',
1212 'build.xml', revision, name, buildroot, buildout, 1064 'build.xml', revision, name, buildroot, buildout,
1213 editorpath, buildos, ['-Dbuild.dir=%s' % buildout]) 1065 editorpath, buildos, ['-Dbuild.dir=%s' % buildout])
1214 if status: 1066 if status:
1215 BuildStepFailure() 1067 BuildStepFailure()
1216 else: 1068 else:
1217 StartBuildStep('upload_artifacts') 1069 StartBuildStep('upload_artifacts')
1218 UploadSite(buildout, "%s/%s" % (GSU_PATH_REV, 'eclipse-update')) 1070 DartArchiveUploadUpdateSite(join(buildout, 'buildRepo'))
1219 UploadSite(buildout, "%s/%s" % (GSU_PATH_LATEST, 'eclipse-update'))
1220 return status 1071 return status
1221 1072
1222 1073
1223 def UploadSite(buildout, gsPath) :
1224 # remove any old artifacts
1225 try:
1226 Gsutil(['rm', '-R', join(gsPath, '*')])
1227 except:
1228 # Ignore this, in the general case there is nothing.
1229 pass
1230 # create eclipse-update/index.html first to ensure eclipse-update prefix
1231 # exists (needed for recursive copy to follow)
1232 Gsutil(['cp', '-a', 'public-read',
1233 r'file://' + join(buildout, 'buildRepo', 'index.html'),
1234 join(gsPath,'index.html')])
1235
1236 # recursively copy update site contents
1237 UploadDirectory(glob.glob(join(buildout, 'buildRepo', '*')), gsPath)
1238 DartArchiveUploadUpdateSite(join(buildout, 'buildRepo'))
1239
1240 def CreateApiDocs(buildLocation): 1074 def CreateApiDocs(buildLocation):
1241 """Zip up api_docs, upload it, and upload the raw tree of docs""" 1075 """Zip up api_docs, upload it, and upload the raw tree of docs"""
1242 1076
1243 apidir = join(DART_PATH, 1077 apidir = join(DART_PATH,
1244 utils.GetBuildRoot(BUILD_OS, 'release', 'ia32'), 1078 utils.GetBuildRoot(BUILD_OS, 'release', 'ia32'),
1245 'api_docs') 1079 'api_docs')
1246 1080
1247 shutil.rmtree(apidir, ignore_errors = True) 1081 shutil.rmtree(apidir, ignore_errors = True)
1248 1082
1249 CallBuildScript('release', 'ia32', 'api_docs') 1083 CallBuildScript('release', 'ia32', 'api_docs')
1250 1084
1251 UploadApiDocs(apidir) 1085 UploadApiDocs(apidir)
1252 1086
1253 api_zip = join(buildLocation, 'dart-api-docs.zip') 1087 api_zip = join(buildLocation, 'dart-api-docs.zip')
1254 1088
1255 CreateZip(apidir, api_zip) 1089 CreateZip(apidir, api_zip)
1256 1090
1257 # upload to continuous/svn_rev and to continuous/latest
1258 UploadFile(api_zip, False)
1259
1260 DartArchiveUploadAPIDocs(api_zip) 1091 DartArchiveUploadAPIDocs(api_zip)
1261 1092
1262 1093
1263 def CreateSDK(sdkpath): 1094 def CreateSDK(sdkpath):
1264 """Create the dart-sdk's for the current OS""" 1095 """Create the dart-sdk's for the current OS"""
1265 1096
1266 if BUILD_OS == 'linux': 1097 if BUILD_OS == 'linux':
1267 return CreateLinuxSDK(sdkpath) 1098 return CreateLinuxSDK(sdkpath)
1268 if BUILD_OS == 'macos': 1099 if BUILD_OS == 'macos':
1269 return CreateMacosSDK(sdkpath) 1100 return CreateMacosSDK(sdkpath)
1270 if BUILD_OS == 'win32': 1101 if BUILD_OS == 'win32':
1271 return CreateWin32SDK(sdkpath) 1102 return CreateWin32SDK(sdkpath)
1272 1103
1273 def CreateLinuxSDK(sdkpath): 1104 def CreateLinuxSDK(sdkpath):
1274 sdkdir32 = join(DART_PATH, utils.GetBuildRoot('linux', 'release', 'ia32'), 1105 sdkdir32 = join(DART_PATH, utils.GetBuildRoot('linux', 'release', 'ia32'),
1275 'dart-sdk') 1106 'dart-sdk')
1276 sdkdir64 = join(DART_PATH, utils.GetBuildRoot('linux', 'release', 'x64'), 1107 sdkdir64 = join(DART_PATH, utils.GetBuildRoot('linux', 'release', 'x64'),
1277 'dart-sdk') 1108 'dart-sdk')
1278 1109
1279 # Build the SDK 1110 # Build the SDK
1280 CallBuildScript('release', 'ia32,x64', 'create_sdk') 1111 CallBuildScript('release', 'ia32,x64', 'create_sdk')
1281 1112
1282 sdk32_zip = join(sdkpath, 'dartsdk-linux-32.zip') 1113 sdk32_zip = join(sdkpath, 'dartsdk-linux-32.zip')
1283 sdk32_tgz = join(sdkpath, 'dartsdk-linux-32.tar.gz')
1284 sdk64_zip = join(sdkpath, 'dartsdk-linux-64.zip') 1114 sdk64_zip = join(sdkpath, 'dartsdk-linux-64.zip')
1285 sdk64_tgz = join(sdkpath, 'dartsdk-linux-64.tar.gz')
1286 1115
1287 CreateZip(sdkdir32, sdk32_zip) 1116 CreateZip(sdkdir32, sdk32_zip)
1288 CreateTgz(sdkdir32, sdk32_tgz)
1289 CreateZip(sdkdir64, sdk64_zip) 1117 CreateZip(sdkdir64, sdk64_zip)
1290 CreateTgz(sdkdir64, sdk64_tgz)
1291
1292 UploadFile(sdk32_zip)
1293 UploadFile(sdk32_tgz)
1294 UploadFile(sdk64_zip)
1295 UploadFile(sdk64_tgz)
1296 1118
1297 DartArchiveUploadSDKs('linux', sdk32_zip, sdk64_zip) 1119 DartArchiveUploadSDKs('linux', sdk32_zip, sdk64_zip)
1298 1120
1299 return sdk32_zip 1121 return sdk32_zip
1300 1122
1301 1123
1302 def CreateMacosSDK(sdkpath): 1124 def CreateMacosSDK(sdkpath):
1303 # Build the SDK 1125 # Build the SDK
1304 CallBuildScript('release', 'ia32,x64', 'create_sdk') 1126 CallBuildScript('release', 'ia32,x64', 'create_sdk')
1305 1127
1306 sdk32_zip = join(sdkpath, 'dartsdk-macos-32.zip') 1128 sdk32_zip = join(sdkpath, 'dartsdk-macos-32.zip')
1307 sdk64_zip = join(sdkpath, 'dartsdk-macos-64.zip') 1129 sdk64_zip = join(sdkpath, 'dartsdk-macos-64.zip')
1308 sdk32_tgz = join(sdkpath, 'dartsdk-macos-32.tar.gz')
1309 sdk64_tgz = join(sdkpath, 'dartsdk-macos-64.tar.gz')
1310 1130
1311 CreateZip(join(DART_PATH, utils.GetBuildRoot('macos', 'release', 'ia32'), 1131 CreateZip(join(DART_PATH, utils.GetBuildRoot('macos', 'release', 'ia32'),
1312 'dart-sdk'), sdk32_zip) 1132 'dart-sdk'), sdk32_zip)
1313 CreateZip(join(DART_PATH, utils.GetBuildRoot('macos', 'release', 'x64'), 1133 CreateZip(join(DART_PATH, utils.GetBuildRoot('macos', 'release', 'x64'),
1314 'dart-sdk'), sdk64_zip) 1134 'dart-sdk'), sdk64_zip)
1315 CreateTgz(join(DART_PATH, utils.GetBuildRoot('macos', 'release', 'ia32'),
1316 'dart-sdk'), sdk32_tgz)
1317 CreateTgz(join(DART_PATH, utils.GetBuildRoot('macos', 'release', 'x64'),
1318 'dart-sdk'), sdk64_tgz)
1319
1320 UploadFile(sdk32_zip)
1321 UploadFile(sdk64_zip)
1322 UploadFile(sdk32_tgz)
1323 UploadFile(sdk64_tgz)
1324 1135
1325 DartArchiveUploadSDKs('macos', sdk32_zip, sdk64_zip) 1136 DartArchiveUploadSDKs('macos', sdk32_zip, sdk64_zip)
1326 1137
1327 return sdk32_zip 1138 return sdk32_zip
1328 1139
1329 1140
1330 def CreateWin32SDK(sdkpath): 1141 def CreateWin32SDK(sdkpath):
1331 # Build the SDK 1142 # Build the SDK
1332 CallBuildScript('release', 'ia32,x64', 'create_sdk') 1143 CallBuildScript('release', 'ia32,x64', 'create_sdk')
1333 1144
1334 sdk32_zip = join(sdkpath, 'dartsdk-win32-32.zip') 1145 sdk32_zip = join(sdkpath, 'dartsdk-win32-32.zip')
1335 sdk64_zip = join(sdkpath, 'dartsdk-win32-64.zip') 1146 sdk64_zip = join(sdkpath, 'dartsdk-win32-64.zip')
1336 1147
1337 CreateZipWindows(join(DART_PATH, 1148 CreateZipWindows(join(DART_PATH,
1338 utils.GetBuildRoot('win32', 'release', 'ia32'), 1149 utils.GetBuildRoot('win32', 'release', 'ia32'),
1339 'dart-sdk'), sdk32_zip) 1150 'dart-sdk'), sdk32_zip)
1340 CreateZipWindows(join(DART_PATH, 1151 CreateZipWindows(join(DART_PATH,
1341 utils.GetBuildRoot('win32', 'release', 'x64'), 1152 utils.GetBuildRoot('win32', 'release', 'x64'),
1342 'dart-sdk'), sdk64_zip) 1153 'dart-sdk'), sdk64_zip)
1343 1154
1344 UploadFile(sdk32_zip)
1345 UploadFile(sdk64_zip)
1346
1347 DartArchiveUploadSDKs('win32', sdk32_zip, sdk64_zip) 1155 DartArchiveUploadSDKs('win32', sdk32_zip, sdk64_zip)
1348 1156
1349 return sdk32_zip 1157 return sdk32_zip
1350 1158
1351 1159
1352 def CallBuildScript(mode, arch, target): 1160 def CallBuildScript(mode, arch, target):
1353 """invoke tools/build.py""" 1161 """invoke tools/build.py"""
1354 buildScript = join(TOOLS_PATH, 'build.py') 1162 buildScript = join(TOOLS_PATH, 'build.py')
1355 cmd = [sys.executable, buildScript, '--mode=%s' % mode, '--arch=%s' % arch, 1163 cmd = [sys.executable, buildScript, '--mode=%s' % mode, '--arch=%s' % arch,
1356 target] 1164 target]
1357 try: 1165 try:
1358 ExecuteCommand(cmd, DART_PATH) 1166 ExecuteCommand(cmd, DART_PATH)
1359 except: 1167 except Exception as error:
1360 print '%s build failed: %s' % (target, status) 1168 print '%s build failed: %s' % (target, error)
1361 BuildStepFailure() 1169 BuildStepFailure()
1362 raise Exception('%s build failed' % target) 1170 raise Exception('%s build failed' % target)
1363 1171
1364 1172
1365 def CreateZip(directory, targetFile): 1173 def CreateZip(directory, targetFile):
1366 """zip the given directory into the file""" 1174 """zip the given directory into the file"""
1367 EnsureDirectoryExists(targetFile) 1175 EnsureDirectoryExists(targetFile)
1368 FileDelete(targetFile) 1176 FileDelete(targetFile)
1369 ExecuteCommand(['zip', '-yrq9', targetFile, os.path.basename(directory)], 1177 ExecuteCommand(['zip', '-yrq9', targetFile, os.path.basename(directory)],
1370 os.path.dirname(directory)) 1178 os.path.dirname(directory))
1371 1179
1372 1180
1373 def CreateZipWindows(directory, targetFile): 1181 def CreateZipWindows(directory, targetFile):
1374 """zip the given directory into the file - win32 specific""" 1182 """zip the given directory into the file - win32 specific"""
1375 EnsureDirectoryExists(targetFile) 1183 EnsureDirectoryExists(targetFile)
1376 FileDelete(targetFile) 1184 FileDelete(targetFile)
1377 ExecuteCommand([join(DART_PATH, 'third_party', '7zip', '7za'), 'a', '-tzip', 1185 ExecuteCommand([join(DART_PATH, 'third_party', '7zip', '7za'), 'a', '-tzip',
1378 targetFile, 1186 targetFile,
1379 os.path.basename(directory)], 1187 os.path.basename(directory)],
1380 os.path.dirname(directory)) 1188 os.path.dirname(directory))
1381 1189
1382 1190
1383 def CreateTgz(directory, targetFile):
1384 """tar gzip the given directory into the file"""
1385 EnsureDirectoryExists(targetFile)
1386 FileDelete(targetFile)
1387 ExecuteCommand(['tar', 'czf', targetFile, os.path.basename(directory)],
1388 os.path.dirname(directory))
1389
1390
1391 def UploadFile(targetFile, createChecksum=True):
1392 """Upload the given file to google storage."""
1393
1394 if (NO_UPLOAD):
1395 return
1396
1397 filePathRev = "%s/%s" % (GSU_PATH_REV, os.path.basename(targetFile))
1398 filePathLatest = "%s/%s" % (GSU_PATH_LATEST, os.path.basename(targetFile))
1399
1400 if createChecksum:
1401 checksum = bot_utils.CreateChecksumFile(targetFile)
1402
1403 checksumRev = "%s/%s" % (GSU_PATH_REV, os.path.basename(checksum))
1404 checksumLatest = "%s/%s" % (GSU_PATH_LATEST, os.path.basename(checksum))
1405
1406 Gsutil(['cp', '-a', 'public-read', r'file://' + targetFile, filePathRev])
1407
1408 if (createChecksum):
1409 Gsutil(['cp', '-a', 'public-read', r'file://' + checksum, checksumRev])
1410
1411 Gsutil(['cp', '-a', 'public-read', filePathRev, filePathLatest])
1412 if (createChecksum):
1413 Gsutil(['cp', '-a', 'public-read', checksumRev, checksumLatest])
1414
1415
1416 def UploadDirectory(filesToUpload, gs_dir): 1191 def UploadDirectory(filesToUpload, gs_dir):
1417 Gsutil(['-m', 'cp', '-a', 'public-read', '-r'] + filesToUpload + [gs_dir]) 1192 Gsutil(['-m', 'cp', '-a', 'public-read', '-r'] + filesToUpload + [gs_dir])
1418 1193
1419 1194
1420 def UploadApiDocs(dirName): 1195 def UploadApiDocs(dirName):
1421 # create file in dartlang-api-docs/REVISION/index.html 1196 # create file in dartlang-api-docs/REVISION/index.html
1422 # this lets us do the recursive copy in the next step 1197 # this lets us do the recursive copy in the next step
1423 1198
1424 localIndexFile = join(dirName, 'index.html') 1199 localIndexFile = join(dirName, 'index.html')
1425 destIndexFile = GSU_API_DOCS_PATH + '/index.html' 1200 destIndexFile = GSU_API_DOCS_PATH + '/index.html'
1426 1201
1427 Gsutil(['cp', '-a', 'public-read', localIndexFile, destIndexFile]) 1202 Gsutil(['cp', '-a', 'public-read', localIndexFile, destIndexFile])
1428 1203
1429 # copy -R api_docs into dartlang-api-docs/REVISION 1204 # copy -R api_docs into dartlang-api-docs/REVISION
1430 filesToUpload = glob.glob(join(dirName, '*')) 1205 filesToUpload = glob.glob(join(dirName, '*'))
1431 result = Gsutil(['-m', 'cp', '-q', '-a', 'public-read', '-r'] + 1206 Gsutil(['-m', 'cp', '-q', '-a', 'public-read', '-r'] +
1432 filesToUpload + [GSU_API_DOCS_PATH]) 1207 filesToUpload + [GSU_API_DOCS_PATH])
1433 1208
1434 if result == 0: 1209 destLatestRevFile = GSU_API_DOCS_BUCKET + '/latest.txt'
1435 destLatestRevFile = GSU_API_DOCS_BUCKET + '/latest.txt' 1210 localLatestRevFilename = join(dirName, 'latest.txt')
1436 localLatestRevFilename = join(dirName, 'latest.txt') 1211 with open(localLatestRevFilename, 'w+') as f:
1437 with open(localLatestRevFilename, 'w+') as f: 1212 f.write(REVISION)
1438 f.write(REVISION)
1439 1213
1440 # overwrite dartlang-api-docs/latest.txt to contain REVISION 1214 # overwrite dartlang-api-docs/latest.txt to contain REVISION
1441 Gsutil(['cp', '-a', 'public-read', localLatestRevFilename, 1215 Gsutil(['cp', '-a', 'public-read', localLatestRevFilename,
1442 destLatestRevFile]) 1216 destLatestRevFile])
1443 1217
1444 1218
1445 def Gsutil(cmd): 1219 def Gsutil(cmd):
1446 gsutilTool = join(DART_PATH, 'third_party', 'gsutil', 'gsutil') 1220 gsutilTool = join(DART_PATH, 'third_party', 'gsutil', 'gsutil')
1447 ExecuteCommand([sys.executable, gsutilTool] + cmd) 1221 ExecuteCommand([sys.executable, gsutilTool] + cmd)
1448 1222
1449 1223
1450 def EnsureDirectoryExists(f): 1224 def EnsureDirectoryExists(f):
1451 d = os.path.dirname(f) 1225 d = os.path.dirname(f)
1452 if not os.path.exists(d): 1226 if not os.path.exists(d):
(...skipping 14 matching lines...) Expand all
1467 """delete the given file - do not re-throw any exceptions that occur""" 1241 """delete the given file - do not re-throw any exceptions that occur"""
1468 if os.path.exists(f): 1242 if os.path.exists(f):
1469 try: 1243 try:
1470 os.remove(f) 1244 os.remove(f)
1471 except OSError: 1245 except OSError:
1472 print 'error deleting %s' % f 1246 print 'error deleting %s' % f
1473 1247
1474 1248
1475 if __name__ == '__main__': 1249 if __name__ == '__main__':
1476 sys.exit(main()) 1250 sys.exit(main())
OLDNEW
« no previous file with comments | « no previous file | editor/build/promote.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698