OLD | NEW |
---|---|
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' |
19 GSUTIL='/Users/dgrove/repo/dart-bleeding/dart/third_party/gsutil/20110627/gsutil ' | |
danrubel
2011/12/13 22:09:34
Should this 2nd GSUTIL assignment be removed?
dgrove
2011/12/13 22:38:41
Yes. this is what happens when I upload just befor
| |
16 GS_SITE = 'gs://' | 20 GS_SITE = 'gs://' |
17 GS_DIR = 'dart-dump-render-tree' | 21 GS_DIR = 'dart-dump-render-tree' |
18 LATEST = 'latest' | 22 GS_SDK_DIR = 'sdk' |
19 SDK = 'sdk' | |
20 | 23 |
21 def ExecuteCommand(cmd): | 24 def ExecuteCommand(cmd): |
22 """Execute a command in a subprocess. | 25 """Execute a command in a subprocess. |
23 """ | 26 """ |
24 print 'Executing: ' + ' '.join(cmd) | 27 print 'Executing: ' + ' '.join(cmd) |
25 pipe = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) | 28 pipe = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) |
26 output = pipe.communicate() | 29 output = pipe.communicate() |
27 if pipe.returncode != 0: | 30 if pipe.returncode != 0: |
28 print 'Execution failed: ' + str(output) | 31 print 'Execution failed: ' + str(output) |
29 return (pipe.returncode, output) | 32 return (pipe.returncode, output) |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
68 sys.stderr.write('Path not found: %s\n' % argv[1]) | 71 sys.stderr.write('Path not found: %s\n' % argv[1]) |
69 Usage(argv[0]) | 72 Usage(argv[0]) |
70 return 1 | 73 return 1 |
71 if not os.path.exists(GSUTIL): | 74 if not os.path.exists(GSUTIL): |
72 sys.stderr.write('cound not find {0}'.format(GSUTIL)) | 75 sys.stderr.write('cound not find {0}'.format(GSUTIL)) |
73 exit(0) | 76 exit(0) |
74 revision = GetSVNRevision() | 77 revision = GetSVNRevision() |
75 if revision is None: | 78 if revision is None: |
76 sys.stderr.write('Unable to find SVN revision.\n') | 79 sys.stderr.write('Unable to find SVN revision.\n') |
77 return 1 | 80 return 1 |
78 os.chdir(argv[1]) | 81 os.chdir(os.path.dirname(argv[1])) |
82 with open(os.path.join(os.path.basename(argv[1]), 'revision'), 'w') as f: | |
83 f.write(revision + '\n') | |
84 | |
79 # TODO(dgrove) - deal with architectures that are not ia32. | 85 # TODO(dgrove) - deal with architectures that are not ia32. |
80 sdk_name = 'dart-' + utils.GuessOS() + '-' + revision + '.zip' | 86 sdk_file = 'dart-%s-%s.zip' % (utils.GuessOS(), revision) |
81 sdk_file = '../' + sdk_name | 87 ExecuteCommand(['zip', '-yr', sdk_file, os.path.basename(argv[1])]) |
82 ExecuteCommand(['zip', '-yr', sdk_file, '.']) | 88 UploadArchive(sdk_file, |
83 UploadArchive(sdk_file, GS_SITE + os.path.join(gsdir, SDK, sdk_name)) | 89 GS_SITE + os.path.join(gsdir, GS_SDK_DIR, sdk_file)) |
84 latest_name = 'dart-' + utils.GuessOS() + '-latest' + '.zip' | 90 latest_name = 'dart-' + utils.GuessOS() + '-latest' + '.zip' |
85 UploadArchive(sdk_file, GS_SITE + os.path.join(gsdir, SDK, latest_name)) | 91 UploadArchive(sdk_file, |
92 GS_SITE + os.path.join(gsdir, GS_SDK_DIR, latest_name)) | |
86 | 93 |
87 | 94 |
88 if __name__ == '__main__': | 95 if __name__ == '__main__': |
89 sys.exit(main(sys.argv)) | 96 sys.exit(main(sys.argv)) |
90 | |
91 | |
OLD | NEW |