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

Side by Side Diff: tools/upload_sdk.py

Issue 10440040: tar.gz the SDK if we're not on windows (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: respect 80 chars Created 8 years, 6 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 | no next file » | 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/python 1 #!/usr/bin/python
2 2
3 # Copyright (c) 2011 The Chromium Authors. All rights reserved. 3 # Copyright (c) 2011 The Chromium Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be 4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 6
7 # This zips the SDK and uploads it to Google Storage when run on a buildbot. 7 # This zips the SDK and uploads it to Google Storage when run on a buildbot.
8 # 8 #
9 # Usage: upload_sdk.py path_to_sdk 9 # Usage: upload_sdk.py path_to_sdk
10 10
11 import os 11 import os
12 import os.path 12 import os.path
13 import platform 13 import platform
14 import subprocess 14 import subprocess
15 import sys 15 import sys
16 import utils 16 import utils
17 17
18 18
19 GSUTIL = '/b/build/scripts/slave/gsutil' 19 GSUTIL = '/b/build/scripts/slave/gsutil'
20 HAS_SHELL = False 20 HAS_SHELL = False
21 if platform.system() == 'Windows': 21 if platform.system() == 'Windows':
22 GSUTIL = 'e:\\\\b\\build\\scripts\\slave\\gsutil' 22 GSUTIL = 'e:\\\\b\\build\\scripts\\slave\\gsutil'
23 HAS_SHELL = True 23 HAS_SHELL = True
24 GS_SITE = 'gs://' 24 GS_SITE = 'gs://'
25 GS_DIR = 'dart-dump-render-tree' 25 GS_DIR = 'dart-dump-render-tree'
26 GS_SDK_DIR = 'sdk' 26 GS_SDK_DIR = 'sdk'
27 SDK_LOCAL_ZIP = "dart-sdk.zip" 27 SDK_LOCAL_ZIP = "dart-sdk.zip"
28 SDK_LOCAL_TARGZ = "dart-sdk.tar.gz"
28 29
29 def ExecuteCommand(cmd): 30 def ExecuteCommand(cmd):
30 """Execute a command in a subprocess. 31 """Execute a command in a subprocess.
31 """ 32 """
32 print 'Executing: ' + ' '.join(cmd) 33 print 'Executing: ' + ' '.join(cmd)
33 pipe = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, 34 pipe = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE,
34 shell=HAS_SHELL) 35 shell=HAS_SHELL)
35 output = pipe.communicate() 36 output = pipe.communicate()
36 if pipe.returncode != 0: 37 if pipe.returncode != 0:
37 print 'Execution failed: ' + str(output) 38 print 'Execution failed: ' + str(output)
(...skipping 23 matching lines...) Expand all
61 #allow local editor builds to deploy to a different bucket 62 #allow local editor builds to deploy to a different bucket
62 if os.environ.has_key('DART_LOCAL_BUILD'): 63 if os.environ.has_key('DART_LOCAL_BUILD'):
63 gsdir = os.environ['DART_LOCAL_BUILD'] 64 gsdir = os.environ['DART_LOCAL_BUILD']
64 else: 65 else:
65 gsdir = GS_DIR 66 gsdir = GS_DIR
66 67
67 if not os.path.exists(argv[1]): 68 if not os.path.exists(argv[1]):
68 sys.stderr.write('Path not found: %s\n' % argv[1]) 69 sys.stderr.write('Path not found: %s\n' % argv[1])
69 Usage(argv[0]) 70 Usage(argv[0])
70 return 1 71 return 1
72
71 if not os.path.exists(GSUTIL): 73 if not os.path.exists(GSUTIL):
72 #TODO: Determine where we are running, if we're running on a buildbot we 74 #TODO: Determine where we are running, if we're running on a buildbot we
73 #should fail with a message. 75 #should fail with a message.
74 #If we are not on a buildbot then fail silently. 76 #If we are not on a buildbot then fail silently.
75 utils.Touch(os.path.join(argv[1], 'upload.stamp')) 77 utils.Touch(os.path.join(argv[1], 'upload.stamp'))
76 exit(0) 78 exit(0)
79
77 revision = utils.GetSVNRevision() 80 revision = utils.GetSVNRevision()
78 if revision is None: 81 if revision is None:
79 sys.stderr.write('Unable to find SVN revision.\n') 82 sys.stderr.write('Unable to find SVN revision.\n')
80 return 1 83 return 1
84
81 os.chdir(os.path.dirname(argv[1])) 85 os.chdir(os.path.dirname(argv[1]))
82 86
83 if (os.path.basename(os.path.dirname(argv[1])) == 87 if (os.path.basename(os.path.dirname(argv[1])) ==
84 utils.GetBuildConf('release', 'ia32')): 88 utils.GetBuildConf('release', 'ia32')):
85 sdk_suffix = '' 89 sdk_suffix = ''
86 else: 90 else:
87 sdk_suffix = '-debug' 91 sdk_suffix = '-debug'
88 # TODO(dgrove) - deal with architectures that are not ia32. 92 # TODO(dgrove) - deal with architectures that are not ia32.
89 sdk_file = 'dart-%s-%s%s.zip' % (utils.GuessOS(), revision, sdk_suffix) 93 sdk_file_zip = 'dart-%s-%s%s.zip' % (utils.GuessOS(), revision, sdk_suffix)
94 sdk_file_targz = 'dart-%s-%s%s.tar.gz' % (utils.GuessOS(), revision,
95 sdk_suffix)
90 if (os.path.exists(SDK_LOCAL_ZIP)): 96 if (os.path.exists(SDK_LOCAL_ZIP)):
91 os.remove(SDK_LOCAL_ZIP) 97 os.remove(SDK_LOCAL_ZIP)
98 if (os.path.exists(SDK_LOCAL_TARGZ)):
99 os.remove(SDK_LOCAL_TARGZ)
92 if platform.system() == 'Windows': 100 if platform.system() == 'Windows':
93 # Windows does not have zip. We use the 7 zip utility in third party. 101 # Windows does not have zip. We use the 7 zip utility in third party.
94 ExecuteCommand([os.path.join('..', 'third_party', '7zip', '7za'), 'a', 102 ExecuteCommand([os.path.join('..', 'third_party', '7zip', '7za'), 'a',
95 '-tzip', SDK_LOCAL_ZIP, os.path.basename(argv[1])]) 103 '-tzip', SDK_LOCAL_ZIP, os.path.basename(argv[1])])
96 else: 104 else:
97 ExecuteCommand(['zip', '-yr', SDK_LOCAL_ZIP, os.path.basename(argv[1])]) 105 ExecuteCommand(['zip', '-yr', SDK_LOCAL_ZIP, os.path.basename(argv[1])])
106 ExecuteCommand(['tar', 'czf', SDK_LOCAL_TARGZ, os.path.basename(argv[1])])
98 UploadArchive(SDK_LOCAL_ZIP, 107 UploadArchive(SDK_LOCAL_ZIP,
99 GS_SITE + '/'.join([gsdir, GS_SDK_DIR, sdk_file])) 108 GS_SITE + '/'.join([gsdir, GS_SDK_DIR, sdk_file_zip]))
100 latest_name = 'dart-%s-latest%s.zip' % (utils.GuessOS(), sdk_suffix) 109 if (os.path.exists(SDK_LOCAL_TARGZ)):
110 UploadArchive(SDK_LOCAL_TARGZ,
111 GS_SITE + '/'.join([gsdir, GS_SDK_DIR, sdk_file_targz]))
112 latest_name_zip = 'dart-%s-latest%s.zip' % (utils.GuessOS(), sdk_suffix)
113 latest_name_targz = 'dart-%s-latest%s.tar.gz' % (utils.GuessOS(), sdk_suffix)
101 UploadArchive(SDK_LOCAL_ZIP, 114 UploadArchive(SDK_LOCAL_ZIP,
102 GS_SITE + '/'.join([gsdir, GS_SDK_DIR, latest_name])) 115 GS_SITE + '/'.join([gsdir, GS_SDK_DIR, latest_name_zip]))
116 if (os.path.exists(SDK_LOCAL_TARGZ)):
117 UploadArchive(SDK_LOCAL_TARGZ,
118 GS_SITE + '/'.join([gsdir, GS_SDK_DIR, latest_name_targz]))
103 utils.Touch('upload.stamp') 119 utils.Touch('upload.stamp')
104 120
105 121
106 if __name__ == '__main__': 122 if __name__ == '__main__':
107 sys.exit(main(sys.argv)) 123 sys.exit(main(sys.argv))
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698