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

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

Issue 24175002: Make editor builders archive to gs://dart-archive/ in addition to the other GCS buckets (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 3 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 | « no previous file | dart/tools/bots/__init__.py » ('j') | dart/tools/bots/__init__.py » ('J')
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) 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 gsutil 8 import gsutil
9 import hashlib 9 import hashlib
10 import imp 10 import imp
(...skipping 10 matching lines...) Expand all
21 21
22 BUILD_OS = None 22 BUILD_OS = None
23 DART_PATH = None 23 DART_PATH = None
24 TOOLS_PATH = None 24 TOOLS_PATH = None
25 25
26 GSU_PATH_REV = None 26 GSU_PATH_REV = None
27 GSU_PATH_LATEST = None 27 GSU_PATH_LATEST = None
28 GSU_API_DOCS_PATH = None 28 GSU_API_DOCS_PATH = None
29 GSU_API_DOCS_BUCKET = 'gs://dartlang-api-docs' 29 GSU_API_DOCS_BUCKET = 'gs://dartlang-api-docs'
30 30
31 CHANNEL = None
32 PLUGINS_BUILD = None
31 REVISION = None 33 REVISION = None
34 SYSTEM = None
32 TRUNK_BUILD = None 35 TRUNK_BUILD = None
33 PLUGINS_BUILD = None
34 36
35 NO_UPLOAD = None 37 NO_UPLOAD = None
36 38
37 def GetUtils(): 39 DART_DIR = os.path.abspath(os.path.join(__file__, '..', '..', '..'))
38 '''Dynamically load the tools/utils.py python module.''' 40 utils = imp.load_source('utils', os.path.join(DART_DIR, 'tools', 'utils.py'))
39 dart_dir = os.path.abspath(os.path.join(__file__, '..', '..', '..')) 41 bot_utils = imp.load_source('bot_utils',
40 return imp.load_source('utils', os.path.join(dart_dir, 'tools', 'utils.py')) 42 os.path.join(DART_DIR, 'tools', 'bots', 'bot_utils.py'))
41 43
42 utils = GetUtils() 44 def DartArchiveFile(local_path, remote_path, create_md5sum=False):
45 # Copy it to the new unified gs://dart-archive bucket
46 # TODO(kustermann/ricow): Remove all the old archiving code, once everything
47 # points to the new location
48 gsutil = bot_utils.GSUtil()
49 gsutil.execute(['cp', '-a', 'public-read', local_path, remote_path])
ricow1 2013/09/16 11:51:30 how about a copyPublic method in GSUtil class?
kustermann 2013/09/16 14:15:54 Added upload/remove with named parameters for publ
50 if create_md5sum:
51 # 'local_path' may have a different filename than 'remote_path'. So we need
52 # to make sure the *.md5sum file contains the correct name.
53 assert '/' in remote_path and not remote_path.endswith('/')
54 mangled_filename = remote_path[remote_path.rfind('/') + 1:]
55 local_md5sum = bot_utils.CreateChecksumFile(local_path, mangled_filename)
56 gsutil.execute(['cp', '-a', 'public-read', local_md5sum,
57 remote_path + '.md5sum'])
58
59 def DartArchiveUploadEditorZipFile(zipfile):
60 if CHANNEL == 'trunk': return
ricow1 2013/09/16 11:51:30 add a todo here saying why we do this
kustermann 2013/09/16 14:15:54 Done.
61 namer = bot_utils.GCSNamer(CHANNEL, bot_utils.ReleaseType.RAW)
62 gsutil = bot_utils.GSUtil()
63
64 basename = os.path.basename(zipfile)
65 system = None
66 arch = None
67 if basename.startswith('darteditor-linux'):
ricow1 2013/09/16 11:51:30 shouldn't we pass this info along instead of extra
kustermann 2013/09/16 14:15:54 I don't know what you mean by passing it along. b
68 system = 'linux'
69 elif basename.startswith('darteditor-mac'):
70 system = 'macos'
71 elif basename.startswith('darteditor-win'):
72 system = 'windows'
73
74 if basename.endswith('-32.zip'):
75 arch = 'ia32'
76 elif basename.endswith('-64.zip'):
77 arch = 'x64'
78
79 if system and arch:
80 for revision in [REVISION, 'latest']:
81 editor_dir = namer.editor_directory(revision)
82 destination_zipfile = namer.editor_zipfilename(system, arch)
83 DartArchiveFile(zipfile, editor_dir + '/' + destination_zipfile,
ricow1 2013/09/16 11:51:30 how about a namer.editor_zipfilepath instead, that
kustermann 2013/09/16 14:15:54 Added filepath functions in addition to filename/d
84 create_md5sum=True)
ricow1 2013/09/16 11:51:30 else: throw an error?
kustermann 2013/09/16 14:15:54 I added an assert (I thought we could call this fu
85
86 def DartArchiveUploadUpdateSite(local_path):
87 if CHANNEL == 'trunk': return
88 namer = bot_utils.GCSNamer(CHANNEL, bot_utils.ReleaseType.RAW)
89 gsutil = bot_utils.GSUtil()
90 for revision in [REVISION, 'latest']:
91 update_site_dir = namer.editor_eclipse_update_directory(revision)
92 try:
93 gsutil.execute(['rm', '-R', update_site_dir])
ricow1 2013/09/16 11:51:30 isn't this asking for a race condition?
kustermann 2013/09/16 14:15:54 Not AFAIK. Please explain.
ricow1 2013/09/16 15:11:28 If people are using the web interface to browse th
94 except:
95 # Ignore this, in the general case there is nothing.
96 pass
97 gsutil.execute(['cp', '-a', 'public-read', '-R',
98 local_path, update_site_dir])
99
100 def DartArchiveUploadSDKs(system, sdk32_zip, sdk64_zip):
101 if CHANNEL == 'trunk': return
102 namer = bot_utils.GCSNamer(CHANNEL, bot_utils.ReleaseType.RAW)
103 for revision in [REVISION, 'latest']:
104 sdk_dir = namer.sdk_directory(revision)
105 path32 = sdk_dir + '/' + namer.sdk_zipfilename(system, 'ia32', 'release')
ricow1 2013/09/16 11:51:30 the latest one will already be there right, will t
kustermann 2013/09/16 14:15:54 Not AFAIK. Please explain.
ricow1 2013/09/16 15:11:28 latest will already be there
106 path64 = sdk_dir + '/' + namer.sdk_zipfilename(system, 'x64', 'release')
107 DartArchiveFile(sdk32_zip, path32, create_md5sum=True)
108 DartArchiveFile(sdk64_zip, path64, create_md5sum=True)
109
43 110
44 class AntWrapper(object): 111 class AntWrapper(object):
45 """A wrapper for ant build invocations""" 112 """A wrapper for ant build invocations"""
46 113
47 _antpath = None 114 _antpath = None
48 _bzippath = None 115 _bzippath = None
49 _propertyfile = None 116 _propertyfile = None
50 117
51 def __init__(self, propertyfile, antpath='/usr/bin', bzippath=None): 118 def __init__(self, propertyfile, antpath='/usr/bin', bzippath=None):
52 """Initialize the ant path. 119 """Initialize the ant path.
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 help='Output Directory.', 239 help='Output Directory.',
173 action='store') 240 action='store')
174 result.add_option('--dest', 241 result.add_option('--dest',
175 help='Output Directory.', 242 help='Output Directory.',
176 action='store') 243 action='store')
177 return result 244 return result
178 245
179 def main(): 246 def main():
180 """Main entry point for the build program.""" 247 """Main entry point for the build program."""
181 global BUILD_OS 248 global BUILD_OS
249 global CHANNEL
182 global DART_PATH 250 global DART_PATH
183 global TOOLS_PATH
184 global GSU_PATH_REV
185 global GSU_API_DOCS_PATH 251 global GSU_API_DOCS_PATH
186 global GSU_PATH_LATEST 252 global GSU_PATH_LATEST
253 global GSU_PATH_REV
254 global NO_UPLOAD
255 global PLUGINS_BUILD
187 global REVISION 256 global REVISION
257 global SYSTEM
258 global TOOLS_PATH
188 global TRUNK_BUILD 259 global TRUNK_BUILD
189 global PLUGINS_BUILD
190 global NO_UPLOAD
191 260
192 if not sys.argv: 261 if not sys.argv:
193 print 'Script pathname not known, giving up.' 262 print 'Script pathname not known, giving up.'
194 return 1 263 return 1
195 264
196 scriptdir = os.path.abspath(os.path.dirname(sys.argv[0])) 265 scriptdir = os.path.abspath(os.path.dirname(sys.argv[0]))
197 editorpath = os.path.abspath(os.path.join(scriptdir, '..')) 266 editorpath = os.path.abspath(os.path.join(scriptdir, '..'))
198 thirdpartypath = os.path.abspath(os.path.join(scriptdir, '..', '..', 267 thirdpartypath = os.path.abspath(os.path.join(scriptdir, '..', '..',
199 'third_party')) 268 'third_party'))
200 toolspath = os.path.abspath(os.path.join(scriptdir, '..', '..', 269 toolspath = os.path.abspath(os.path.join(scriptdir, '..', '..',
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 # Get user name. If it does not start with chrome then deploy to the test 360 # Get user name. If it does not start with chrome then deploy to the test
292 # bucket; otherwise deploy to the continuous bucket. 361 # bucket; otherwise deploy to the continuous bucket.
293 username = os.environ.get('USER') 362 username = os.environ.get('USER')
294 if username is None: 363 if username is None:
295 username = os.environ.get('USERNAME') 364 username = os.environ.get('USERNAME')
296 365
297 if username is None: 366 if username is None:
298 print 'Could not find username' 367 print 'Could not find username'
299 return 6 368 return 6
300 369
301 # dart-editor[-trunk], dart-editor-(win/mac/linux)[-trunk] 370 # dart-editor[-trunk], dart-editor-(win/mac/linux)[-trunk/be/dev/stable]
302 builder_name = str(options.name) 371 builder_name = str(options.name)
303 372
304 TRUNK_BUILD = builder_name.endswith("-trunk") 373 EDITOR_REGEXP = (r'^dart-editor(-(?P<system>(win|mac|linux)))?' +
305 PLUGINS_BUILD = (builder_name == 'dart-editor' or 374 '(-(?P<channel>(trunk|be|dev|stable)))?$')
306 builder_name == 'dart-editor-trunk') 375 match = re.match(EDITOR_REGEXP, builder_name)
376 if not match:
377 raise Exception("Buildername '%s' does not match pattern '%s'."
378 % (builder_name, EDITOR_REGEXP))
379
380 CHANNEL = match.groupdict()['channel'] or 'be'
381 SYSTEM = match.groupdict()['system']
382
383 TRUNK_BUILD = CHANNEL == 'trunk'
384 PLUGINS_BUILD = SYSTEM is None
385 REVISION = revision
307 386
308 build_skip_tests = os.environ.get('DART_SKIP_RUNNING_TESTS') 387 build_skip_tests = os.environ.get('DART_SKIP_RUNNING_TESTS')
309 sdk_environment = os.environ 388 sdk_environment = os.environ
310 if username.startswith('chrome'): 389 if username.startswith('chrome'):
311 if TRUNK_BUILD: 390 if TRUNK_BUILD:
312 to_bucket = 'gs://dart-editor-archive-trunk' 391 to_bucket = 'gs://dart-editor-archive-trunk'
313 else: 392 else:
314 to_bucket = 'gs://dart-editor-archive-continuous' 393 to_bucket = 'gs://dart-editor-archive-continuous'
315 running_on_buildbot = True 394 running_on_buildbot = True
316 else: 395 else:
317 to_bucket = 'gs://dart-editor-archive-testing' 396 to_bucket = 'gs://dart-editor-archive-testing'
318 running_on_buildbot = False 397 running_on_buildbot = False
319 sdk_environment['DART_LOCAL_BUILD'] = 'dart-editor-archive-testing' 398 sdk_environment['DART_LOCAL_BUILD'] = 'dart-editor-archive-testing'
320 399
321 REVISION = revision
322 GSU_PATH_REV = '%s/%s' % (to_bucket, REVISION) 400 GSU_PATH_REV = '%s/%s' % (to_bucket, REVISION)
323 GSU_PATH_LATEST = '%s/%s' % (to_bucket, 'latest') 401 GSU_PATH_LATEST = '%s/%s' % (to_bucket, 'latest')
324 GSU_API_DOCS_PATH = '%s/%s' % (GSU_API_DOCS_BUCKET, REVISION) 402 GSU_API_DOCS_PATH = '%s/%s' % (GSU_API_DOCS_BUCKET, REVISION)
325 403
326 homegsutil = join(DART_PATH, 'third_party', 'gsutil', 'gsutil') 404 homegsutil = join(DART_PATH, 'third_party', 'gsutil', 'gsutil')
327 gsu = gsutil.GsUtil(False, homegsutil, 405 gsu = gsutil.GsUtil(False, homegsutil,
328 running_on_buildbot=running_on_buildbot) 406 running_on_buildbot=running_on_buildbot)
329 InstallDartium(buildroot, buildout, buildos, gsu) 407 InstallDartium(buildroot, buildout, buildos, gsu)
330 if sdk_environment.has_key('JAVA_HOME'): 408 if sdk_environment.has_key('JAVA_HOME'):
331 print 'JAVA_HOME = {0}'.format(str(sdk_environment['JAVA_HOME'])) 409 print 'JAVA_HOME = {0}'.format(str(sdk_environment['JAVA_HOME']))
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
400 478
401 # dart-editor-linux.gtk.x86.zip --> darteditor-linux-32.zip 479 # dart-editor-linux.gtk.x86.zip --> darteditor-linux-32.zip
402 RenameRcpZipFiles(buildout) 480 RenameRcpZipFiles(buildout)
403 481
404 PostProcessEditorBuilds(buildout) 482 PostProcessEditorBuilds(buildout)
405 483
406 if running_on_buildbot: 484 if running_on_buildbot:
407 version_file = _FindVersionFile(buildout) 485 version_file = _FindVersionFile(buildout)
408 if version_file: 486 if version_file:
409 UploadFile(version_file, False) 487 UploadFile(version_file, False)
488 if CHANNEL != 'trunk':
489 namer = bot_utils.GCSNamer(CHANNEL, bot_utils.ReleaseType.RAW)
ricow1 2013/09/16 11:51:30 Extract this to a method as well to be consistent
kustermann 2013/09/16 14:15:54 Extracted this and another one. Refactored bot_uti
490 for revision in [REVISION, 'latest']:
491 DartArchiveFile(version_file, namer.version_file(revision),
492 create_md5sum=False)
410 493
411 found_zips = _FindRcpZipFiles(buildout) 494 found_zips = _FindRcpZipFiles(buildout)
412 for zipfile in found_zips: 495 for zipfile in found_zips:
413 UploadFile(zipfile) 496 UploadFile(zipfile)
497 DartArchiveUploadEditorZipFile(zipfile)
414 498
415 return 0 499 return 0
416 finally: 500 finally:
417 if ant_property_file is not None: 501 if ant_property_file is not None:
418 print 'cleaning up temp file {0}'.format(ant_property_file.name) 502 print 'cleaning up temp file {0}'.format(ant_property_file.name)
419 os.remove(ant_property_file.name) 503 os.remove(ant_property_file.name)
420 print 'cleaning up {0}'.format(buildroot) 504 print 'cleaning up {0}'.format(buildroot)
421 shutil.rmtree(buildroot, True) 505 shutil.rmtree(buildroot, True)
422 print 'Build Done' 506 print 'Build Done'
423 507
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
606 unzip_dir = os.path.join(tmp_dir, 690 unzip_dir = os.path.join(tmp_dir,
607 os.path.splitext(os.path.basename(dartiumFile))[0]) 691 os.path.splitext(os.path.basename(dartiumFile))[0])
608 if not os.path.exists(unzip_dir): 692 if not os.path.exists(unzip_dir):
609 os.makedirs(unzip_dir) 693 os.makedirs(unzip_dir)
610 # Always download as searchString.zip 694 # Always download as searchString.zip
611 basename = "%s.zip" % searchString 695 basename = "%s.zip" % searchString
612 tmp_zip_file = os.path.join(tmp_dir, basename) 696 tmp_zip_file = os.path.join(tmp_dir, basename)
613 697
614 if not os.path.exists(tmp_zip_file): 698 if not os.path.exists(tmp_zip_file):
615 gsu.Copy(dartiumFile, tmp_zip_file, False) 699 gsu.Copy(dartiumFile, tmp_zip_file, False)
616 700
617 # Upload dartium zip to make sure we have consistent dartium downloads 701 # Upload dartium zip to make sure we have consistent dartium downloads
618 UploadFile(tmp_zip_file) 702 UploadFile(tmp_zip_file)
619 703
620 # Dartium is unzipped into ~ unzip_dir/dartium-win-full-7665.7665 704 # Dartium is unzipped into ~ unzip_dir/dartium-win-full-7665.7665
621 dartium_zip = ziputils.ZipUtil(tmp_zip_file, buildos) 705 dartium_zip = ziputils.ZipUtil(tmp_zip_file, buildos)
622 dartium_zip.UnZip(unzip_dir) 706 dartium_zip.UnZip(unzip_dir)
623 else: 707 else:
624 dartium_zip = ziputils.ZipUtil(tmp_zip_file, buildos) 708 dartium_zip = ziputils.ZipUtil(tmp_zip_file, buildos)
625 709
626 dart_zip_path = join(buildout, rcpZipFile) 710 dart_zip_path = join(buildout, rcpZipFile)
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
699 infofile = join('dart', 'DartEditor.app', 'Contents', 'Info.plist') 783 infofile = join('dart', 'DartEditor.app', 'Contents', 'Info.plist')
700 subprocess.call(['unzip', zipFile, infofile], env=os.environ) 784 subprocess.call(['unzip', zipFile, infofile], env=os.environ)
701 ReplaceInFiles( 785 ReplaceInFiles(
702 [infofile], 786 [infofile],
703 [('<dict>', 787 [('<dict>',
704 '<dict>\n\t<key>NSHighResolutionCapable</key>\n\t\t<true/>')]) 788 '<dict>\n\t<key>NSHighResolutionCapable</key>\n\t\t<true/>')])
705 subprocess.call(['zip', '-q', zipFile, infofile], env=os.environ) 789 subprocess.call(['zip', '-q', zipFile, infofile], env=os.environ)
706 os.remove(infofile) 790 os.remove(infofile)
707 791
708 792
709 def CalculateChecksum(filename):
710 """Calculate the MD5 checksum for filename."""
711
712 md5 = hashlib.md5()
713
714 with open(filename, 'rb') as f:
715 data = f.read(65536)
716 while len(data) > 0:
717 md5.update(data)
718 data = f.read(65536)
719
720 return md5.hexdigest()
721
722
723 def CreateChecksumFile(filename):
724 """Create and upload an MD5 checksum file for filename."""
725
726 checksum = CalculateChecksum(filename)
727 checksum_filename = '%s.md5sum' % filename
728
729 with open(checksum_filename, 'w') as f:
730 f.write('%s *%s' % (checksum, os.path.basename(filename)))
731
732 return checksum_filename
733
734
735 def RunEditorTests(buildout, buildos): 793 def RunEditorTests(buildout, buildos):
736 StartBuildStep('run_tests') 794 StartBuildStep('run_tests')
737 795
738 for editorArchive in _GetTestableRcpArchives(buildout): 796 for editorArchive in _GetTestableRcpArchives(buildout):
739 with utils.TempDir('editor_') as tempDir: 797 with utils.TempDir('editor_') as tempDir:
740 print 'Running tests for %s...' % editorArchive 798 print 'Running tests for %s...' % editorArchive
741 799
742 zipper = ziputils.ZipUtil(join(buildout, editorArchive), buildos) 800 zipper = ziputils.ZipUtil(join(buildout, editorArchive), buildos)
743 zipper.UnZip(tempDir) 801 zipper.UnZip(tempDir)
744 802
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
832 try: 890 try:
833 Gsutil(['rm', '-R', join(gsPath, '*')]) 891 Gsutil(['rm', '-R', join(gsPath, '*')])
834 except: 892 except:
835 # Ignore this, in the general case there is nothing. 893 # Ignore this, in the general case there is nothing.
836 pass 894 pass
837 # create eclipse-update/index.html first to ensure eclipse-update prefix 895 # create eclipse-update/index.html first to ensure eclipse-update prefix
838 # exists (needed for recursive copy to follow) 896 # exists (needed for recursive copy to follow)
839 Gsutil(['cp', '-a', 'public-read', 897 Gsutil(['cp', '-a', 'public-read',
840 r'file://' + join(buildout, 'buildRepo', 'index.html'), 898 r'file://' + join(buildout, 'buildRepo', 'index.html'),
841 join(gsPath,'index.html')]) 899 join(gsPath,'index.html')])
900
842 # recursively copy update site contents 901 # recursively copy update site contents
843 UploadDirectory(glob.glob(join(buildout, 'buildRepo', '*')), gsPath) 902 UploadDirectory(glob.glob(join(buildout, 'buildRepo', '*')), gsPath)
844 903 DartArchiveUploadUpdateSite(join(buildout, 'buildRepo'))
845 904
846 def CreateApiDocs(buildLocation): 905 def CreateApiDocs(buildLocation):
847 """Zip up api_docs, upload it, and upload the raw tree of docs""" 906 """Zip up api_docs, upload it, and upload the raw tree of docs"""
848 907
849 apidir = join(DART_PATH, 908 apidir = join(DART_PATH,
850 utils.GetBuildRoot(BUILD_OS, 'release', 'ia32'), 909 utils.GetBuildRoot(BUILD_OS, 'release', 'ia32'),
851 'api_docs') 910 'api_docs')
852 911
853 shutil.rmtree(apidir, ignore_errors = True) 912 shutil.rmtree(apidir, ignore_errors = True)
854 913
855 CallBuildScript('release', 'ia32', 'api_docs') 914 CallBuildScript('release', 'ia32', 'api_docs')
856 915
857 UploadApiDocs(apidir) 916 UploadApiDocs(apidir)
858 917
859 api_zip = join(buildLocation, 'dart-api-docs.zip') 918 api_zip = join(buildLocation, 'dart-api-docs.zip')
860 919
861 CreateZip(apidir, api_zip) 920 CreateZip(apidir, api_zip)
862 921
863 # upload to continuous/svn_rev and to continuous/latest 922 # upload to continuous/svn_rev and to continuous/latest
864 UploadFile(api_zip, False) 923 UploadFile(api_zip, False)
865 924
925 if CHANNEL != 'trunk':
926 namer = bot_utils.GCSNamer(CHANNEL, bot_utils.ReleaseType.RAW)
ricow1 2013/09/16 11:51:30 also put this into a method
kustermann 2013/09/16 14:15:54 Done.
927 for revision in [REVISION, 'latest']:
928 destination = (namer.apidocs_directory(revision) + '/' +
929 namer.apidocs_zipfile())
930 DartArchiveFile(api_zip, destination, create_md5sum=False)
931
866 932
867 def CreateSDK(sdkpath): 933 def CreateSDK(sdkpath):
868 """Create the dart-sdk's for the current OS""" 934 """Create the dart-sdk's for the current OS"""
869 935
870 if BUILD_OS == 'linux': 936 if BUILD_OS == 'linux':
871 return CreateLinuxSDK(sdkpath) 937 return CreateLinuxSDK(sdkpath)
872 if BUILD_OS == 'macos': 938 if BUILD_OS == 'macos':
873 return CreateMacosSDK(sdkpath) 939 return CreateMacosSDK(sdkpath)
874 if BUILD_OS == 'win32': 940 if BUILD_OS == 'win32':
875 return CreateWin32SDK(sdkpath) 941 return CreateWin32SDK(sdkpath)
876 942
877
878 def CreateLinuxSDK(sdkpath): 943 def CreateLinuxSDK(sdkpath):
879 sdkdir32 = join(DART_PATH, utils.GetBuildRoot('linux', 'release', 'ia32'), 944 sdkdir32 = join(DART_PATH, utils.GetBuildRoot('linux', 'release', 'ia32'),
880 'dart-sdk') 945 'dart-sdk')
881 sdkdir64 = join(DART_PATH, utils.GetBuildRoot('linux', 'release', 'x64'), 946 sdkdir64 = join(DART_PATH, utils.GetBuildRoot('linux', 'release', 'x64'),
882 'dart-sdk') 947 'dart-sdk')
883 948
884 # Build the SDK 949 # Build the SDK
885 CallBuildScript('release', 'ia32,x64', 'create_sdk') 950 CallBuildScript('release', 'ia32,x64', 'create_sdk')
886 951
887 sdk32_zip = join(sdkpath, 'dartsdk-linux-32.zip') 952 sdk32_zip = join(sdkpath, 'dartsdk-linux-32.zip')
888 sdk32_tgz = join(sdkpath, 'dartsdk-linux-32.tar.gz') 953 sdk32_tgz = join(sdkpath, 'dartsdk-linux-32.tar.gz')
889 sdk64_zip = join(sdkpath, 'dartsdk-linux-64.zip') 954 sdk64_zip = join(sdkpath, 'dartsdk-linux-64.zip')
890 sdk64_tgz = join(sdkpath, 'dartsdk-linux-64.tar.gz') 955 sdk64_tgz = join(sdkpath, 'dartsdk-linux-64.tar.gz')
891 956
892 CreateZip(sdkdir32, sdk32_zip) 957 CreateZip(sdkdir32, sdk32_zip)
893 CreateTgz(sdkdir32, sdk32_tgz) 958 CreateTgz(sdkdir32, sdk32_tgz)
894 CreateZip(sdkdir64, sdk64_zip) 959 CreateZip(sdkdir64, sdk64_zip)
895 CreateTgz(sdkdir64, sdk64_tgz) 960 CreateTgz(sdkdir64, sdk64_tgz)
896 961
897 UploadFile(sdk32_zip) 962 UploadFile(sdk32_zip)
898 UploadFile(sdk32_tgz) 963 UploadFile(sdk32_tgz)
899 UploadFile(sdk64_zip) 964 UploadFile(sdk64_zip)
900 UploadFile(sdk64_tgz) 965 UploadFile(sdk64_tgz)
901 966
967 DartArchiveUploadSDKs('linux', sdk32_zip, sdk64_zip)
968
902 return sdk32_zip 969 return sdk32_zip
903 970
904 971
905 def CreateMacosSDK(sdkpath): 972 def CreateMacosSDK(sdkpath):
906 # Build the SDK 973 # Build the SDK
907 CallBuildScript('release', 'ia32,x64', 'create_sdk') 974 CallBuildScript('release', 'ia32,x64', 'create_sdk')
908 975
909 sdk32_zip = join(sdkpath, 'dartsdk-macos-32.zip') 976 sdk32_zip = join(sdkpath, 'dartsdk-macos-32.zip')
910 sdk64_zip = join(sdkpath, 'dartsdk-macos-64.zip') 977 sdk64_zip = join(sdkpath, 'dartsdk-macos-64.zip')
911 sdk32_tgz = join(sdkpath, 'dartsdk-macos-32.tar.gz') 978 sdk32_tgz = join(sdkpath, 'dartsdk-macos-32.tar.gz')
912 sdk64_tgz = join(sdkpath, 'dartsdk-macos-64.tar.gz') 979 sdk64_tgz = join(sdkpath, 'dartsdk-macos-64.tar.gz')
913 980
914 CreateZip(join(DART_PATH, utils.GetBuildRoot('macos', 'release', 'ia32'), 981 CreateZip(join(DART_PATH, utils.GetBuildRoot('macos', 'release', 'ia32'),
915 'dart-sdk'), sdk32_zip) 982 'dart-sdk'), sdk32_zip)
916 CreateZip(join(DART_PATH, utils.GetBuildRoot('macos', 'release', 'x64'), 983 CreateZip(join(DART_PATH, utils.GetBuildRoot('macos', 'release', 'x64'),
917 'dart-sdk'), sdk64_zip) 984 'dart-sdk'), sdk64_zip)
918 CreateTgz(join(DART_PATH, utils.GetBuildRoot('macos', 'release', 'ia32'), 985 CreateTgz(join(DART_PATH, utils.GetBuildRoot('macos', 'release', 'ia32'),
919 'dart-sdk'), sdk32_tgz) 986 'dart-sdk'), sdk32_tgz)
920 CreateTgz(join(DART_PATH, utils.GetBuildRoot('macos', 'release', 'x64'), 987 CreateTgz(join(DART_PATH, utils.GetBuildRoot('macos', 'release', 'x64'),
921 'dart-sdk'), sdk64_tgz) 988 'dart-sdk'), sdk64_tgz)
922 989
923 UploadFile(sdk32_zip) 990 UploadFile(sdk32_zip)
924 UploadFile(sdk64_zip) 991 UploadFile(sdk64_zip)
925 UploadFile(sdk32_tgz) 992 UploadFile(sdk32_tgz)
926 UploadFile(sdk64_tgz) 993 UploadFile(sdk64_tgz)
927 994
995 DartArchiveUploadSDKs('macos', sdk32_zip, sdk64_zip)
996
928 return sdk32_zip 997 return sdk32_zip
929 998
930 999
931 def CreateWin32SDK(sdkpath): 1000 def CreateWin32SDK(sdkpath):
932 # Build the SDK 1001 # Build the SDK
933 CallBuildScript('release', 'ia32,x64', 'create_sdk') 1002 CallBuildScript('release', 'ia32,x64', 'create_sdk')
934 1003
935 sdk32_zip = join(sdkpath, 'dartsdk-win32-32.zip') 1004 sdk32_zip = join(sdkpath, 'dartsdk-win32-32.zip')
936 sdk64_zip = join(sdkpath, 'dartsdk-win32-64.zip') 1005 sdk64_zip = join(sdkpath, 'dartsdk-win32-64.zip')
937 1006
938 CreateZipWindows(join(DART_PATH, 1007 CreateZipWindows(join(DART_PATH,
939 utils.GetBuildRoot('win32', 'release', 'ia32'), 1008 utils.GetBuildRoot('win32', 'release', 'ia32'),
940 'dart-sdk'), sdk32_zip) 1009 'dart-sdk'), sdk32_zip)
941 CreateZipWindows(join(DART_PATH, 1010 CreateZipWindows(join(DART_PATH,
942 utils.GetBuildRoot('win32', 'release', 'x64'), 1011 utils.GetBuildRoot('win32', 'release', 'x64'),
943 'dart-sdk'), sdk64_zip) 1012 'dart-sdk'), sdk64_zip)
944 1013
945 UploadFile(sdk32_zip) 1014 UploadFile(sdk32_zip)
946 UploadFile(sdk64_zip) 1015 UploadFile(sdk64_zip)
947 1016
1017 DartArchiveUploadSDKs('win32', sdk32_zip, sdk64_zip)
1018
948 return sdk32_zip 1019 return sdk32_zip
949 1020
950 1021
951 def CallBuildScript(mode, arch, target): 1022 def CallBuildScript(mode, arch, target):
952 """invoke tools/build.py""" 1023 """invoke tools/build.py"""
953 buildScript = join(TOOLS_PATH, 'build.py') 1024 buildScript = join(TOOLS_PATH, 'build.py')
954 cmd = [sys.executable, buildScript, '--mode=%s' % mode, '--arch=%s' % arch, 1025 cmd = [sys.executable, buildScript, '--mode=%s' % mode, '--arch=%s' % arch,
955 target] 1026 target]
956 try: 1027 try:
957 ExecuteCommand(cmd, DART_PATH) 1028 ExecuteCommand(cmd, DART_PATH)
(...skipping 27 matching lines...) Expand all
985 FileDelete(targetFile) 1056 FileDelete(targetFile)
986 ExecuteCommand(['tar', 'czf', targetFile, os.path.basename(directory)], 1057 ExecuteCommand(['tar', 'czf', targetFile, os.path.basename(directory)],
987 os.path.dirname(directory)) 1058 os.path.dirname(directory))
988 1059
989 1060
990 def UploadFile(targetFile, createChecksum=True): 1061 def UploadFile(targetFile, createChecksum=True):
991 """Upload the given file to google storage.""" 1062 """Upload the given file to google storage."""
992 1063
993 if (NO_UPLOAD): 1064 if (NO_UPLOAD):
994 return 1065 return
995 1066
996 filePathRev = "%s/%s" % (GSU_PATH_REV, os.path.basename(targetFile)) 1067 filePathRev = "%s/%s" % (GSU_PATH_REV, os.path.basename(targetFile))
997 filePathLatest = "%s/%s" % (GSU_PATH_LATEST, os.path.basename(targetFile)) 1068 filePathLatest = "%s/%s" % (GSU_PATH_LATEST, os.path.basename(targetFile))
998 1069
999 if (createChecksum): 1070 if createChecksum:
1000 checksum = CreateChecksumFile(targetFile) 1071 checksum = bot_utils.CreateChecksumFile(targetFile)
1001 1072
1002 checksumRev = "%s/%s" % (GSU_PATH_REV, os.path.basename(checksum)) 1073 checksumRev = "%s/%s" % (GSU_PATH_REV, os.path.basename(checksum))
1003 checksumLatest = "%s/%s" % (GSU_PATH_LATEST, os.path.basename(checksum)) 1074 checksumLatest = "%s/%s" % (GSU_PATH_LATEST, os.path.basename(checksum))
1004 1075
1005 Gsutil(['cp', '-a', 'public-read', r'file://' + targetFile, filePathRev]) 1076 Gsutil(['cp', '-a', 'public-read', r'file://' + targetFile, filePathRev])
1006 1077
1007 if (createChecksum): 1078 if (createChecksum):
1008 Gsutil(['cp', '-a', 'public-read', r'file://' + checksum, checksumRev]) 1079 Gsutil(['cp', '-a', 'public-read', r'file://' + checksum, checksumRev])
1009 1080
1010 Gsutil(['cp', '-a', 'public-read', filePathRev, filePathLatest]) 1081 Gsutil(['cp', '-a', 'public-read', filePathRev, filePathLatest])
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
1066 """delete the given file - do not re-throw any exceptions that occur""" 1137 """delete the given file - do not re-throw any exceptions that occur"""
1067 if os.path.exists(f): 1138 if os.path.exists(f):
1068 try: 1139 try:
1069 os.remove(f) 1140 os.remove(f)
1070 except OSError: 1141 except OSError:
1071 print 'error deleting %s' % f 1142 print 'error deleting %s' % f
1072 1143
1073 1144
1074 if __name__ == '__main__': 1145 if __name__ == '__main__':
1075 sys.exit(main()) 1146 sys.exit(main())
OLDNEW
« no previous file with comments | « no previous file | dart/tools/bots/__init__.py » ('j') | dart/tools/bots/__init__.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698