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

Side by Side Diff: tools/upload_sdk.py

Issue 8935008: Create the SDK in dart-sdk directory. The sdk zip file's contents (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 9 years 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 | « dart.gyp ('k') | 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 #
9 # Usage: upload_sdk.py path_to_sdk
8 10
9 import os 11 import os
12 import os.path
10 import subprocess 13 import subprocess
11 import sys 14 import sys
12 import utils 15 import utils
13 16
14 17
15 GSUTIL = '/b/build/scripts/slave/gsutil' 18 GSUTIL = '/b/build/scripts/slave/gsutil'
16 GS_SITE = 'gs://' 19 GS_SITE = 'gs://'
17 GS_DIR = 'dart-dump-render-tree' 20 GS_DIR = 'dart-dump-render-tree'
18 LATEST = 'latest' 21 GS_SDK_DIR = 'sdk'
19 SDK = 'sdk'
20 22
21 def ExecuteCommand(cmd): 23 def ExecuteCommand(cmd):
22 """Execute a command in a subprocess. 24 """Execute a command in a subprocess.
23 """ 25 """
24 print 'Executing: ' + ' '.join(cmd) 26 print 'Executing: ' + ' '.join(cmd)
25 pipe = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) 27 pipe = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
26 output = pipe.communicate() 28 output = pipe.communicate()
27 if pipe.returncode != 0: 29 if pipe.returncode != 0:
28 print 'Execution failed: ' + str(output) 30 print 'Execution failed: ' + str(output)
29 return (pipe.returncode, output) 31 return (pipe.returncode, output)
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 return 1 72 return 1
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 exit(0) 77 exit(0)
76 revision = GetSVNRevision() 78 revision = GetSVNRevision()
77 if revision is None: 79 if revision is None:
78 sys.stderr.write('Unable to find SVN revision.\n') 80 sys.stderr.write('Unable to find SVN revision.\n')
79 return 1 81 return 1
80 os.chdir(argv[1]) 82 os.chdir(os.path.dirname(argv[1]))
83 with open(os.path.join(os.path.basename(argv[1]), 'revision'), 'w') as f:
84 f.write(revision + '\n')
85
81 # TODO(dgrove) - deal with architectures that are not ia32. 86 # TODO(dgrove) - deal with architectures that are not ia32.
82 sdk_name = 'dart-' + utils.GuessOS() + '-' + revision + '.zip' 87 sdk_file = 'dart-%s-%s.zip' % (utils.GuessOS(), revision)
83 sdk_file = '../' + sdk_name 88 ExecuteCommand(['zip', '-yr', sdk_file, os.path.basename(argv[1])])
84 ExecuteCommand(['zip', '-yr', sdk_file, '.']) 89 UploadArchive(sdk_file,
85 UploadArchive(sdk_file, GS_SITE + os.path.join(gsdir, SDK, sdk_name)) 90 GS_SITE + os.path.join(gsdir, GS_SDK_DIR, sdk_file))
86 latest_name = 'dart-' + utils.GuessOS() + '-latest' + '.zip' 91 latest_name = 'dart-' + utils.GuessOS() + '-latest' + '.zip'
87 UploadArchive(sdk_file, GS_SITE + os.path.join(gsdir, SDK, latest_name)) 92 UploadArchive(sdk_file,
93 GS_SITE + os.path.join(gsdir, GS_SDK_DIR, latest_name))
88 94
89 95
90 if __name__ == '__main__': 96 if __name__ == '__main__':
91 sys.exit(main(sys.argv)) 97 sys.exit(main(sys.argv))
92
93
OLDNEW
« no previous file with comments | « dart.gyp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698