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 # | 8 # |
9 # Usage: upload_sdk.py path_to_sdk | 9 # Usage: upload_sdk.py path_to_sdk |
10 | 10 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 gsdir = GS_DIR | 65 gsdir = GS_DIR |
66 | 66 |
67 if not os.path.exists(argv[1]): | 67 if not os.path.exists(argv[1]): |
68 sys.stderr.write('Path not found: %s\n' % argv[1]) | 68 sys.stderr.write('Path not found: %s\n' % argv[1]) |
69 Usage(argv[0]) | 69 Usage(argv[0]) |
70 return 1 | 70 return 1 |
71 if not os.path.exists(GSUTIL): | 71 if not os.path.exists(GSUTIL): |
72 #TODO: Determine where we are running, if we're running on a buildbot we | 72 #TODO: Determine where we are running, if we're running on a buildbot we |
73 #should fail with a message. | 73 #should fail with a message. |
74 #If we are not on a buildbot then fail silently. | 74 #If we are not on a buildbot then fail silently. |
| 75 utils.Touch(os.path.join(argv[1], 'upload.stamp')) |
75 exit(0) | 76 exit(0) |
76 revision = utils.GetSVNRevision() | 77 revision = utils.GetSVNRevision() |
77 if revision is None: | 78 if revision is None: |
78 sys.stderr.write('Unable to find SVN revision.\n') | 79 sys.stderr.write('Unable to find SVN revision.\n') |
79 return 1 | 80 return 1 |
80 os.chdir(os.path.dirname(argv[1])) | 81 os.chdir(os.path.dirname(argv[1])) |
81 | 82 |
82 if (os.path.basename(os.path.dirname(argv[1])) == | 83 if (os.path.basename(os.path.dirname(argv[1])) == |
83 utils.GetBuildConf('release', 'ia32')): | 84 utils.GetBuildConf('release', 'ia32')): |
84 sdk_suffix = '' | 85 sdk_suffix = '' |
85 else: | 86 else: |
86 sdk_suffix = '-debug' | 87 sdk_suffix = '-debug' |
87 # TODO(dgrove) - deal with architectures that are not ia32. | 88 # TODO(dgrove) - deal with architectures that are not ia32. |
88 sdk_file = 'dart-%s-%s%s.zip' % (utils.GuessOS(), revision, sdk_suffix) | 89 sdk_file = 'dart-%s-%s%s.zip' % (utils.GuessOS(), revision, sdk_suffix) |
89 if (os.path.exists(SDK_LOCAL_ZIP)): | 90 if (os.path.exists(SDK_LOCAL_ZIP)): |
90 os.remove(SDK_LOCAL_ZIP) | 91 os.remove(SDK_LOCAL_ZIP) |
91 if platform.system() == 'Windows': | 92 if platform.system() == 'Windows': |
92 # Windows does not have zip. We use the 7 zip utility in third party. | 93 # Windows does not have zip. We use the 7 zip utility in third party. |
93 ExecuteCommand([os.path.join('..', 'third_party', '7zip', '7za'), 'a', | 94 ExecuteCommand([os.path.join('..', 'third_party', '7zip', '7za'), 'a', |
94 '-tzip', SDK_LOCAL_ZIP, os.path.basename(argv[1])]) | 95 '-tzip', SDK_LOCAL_ZIP, os.path.basename(argv[1])]) |
95 else: | 96 else: |
96 ExecuteCommand(['zip', '-yr', SDK_LOCAL_ZIP, os.path.basename(argv[1])]) | 97 ExecuteCommand(['zip', '-yr', SDK_LOCAL_ZIP, os.path.basename(argv[1])]) |
97 UploadArchive(SDK_LOCAL_ZIP, | 98 UploadArchive(SDK_LOCAL_ZIP, |
98 GS_SITE + '/'.join([gsdir, GS_SDK_DIR, sdk_file])) | 99 GS_SITE + '/'.join([gsdir, GS_SDK_DIR, sdk_file])) |
99 latest_name = 'dart-%s-latest%s.zip' % (utils.GuessOS(), sdk_suffix) | 100 latest_name = 'dart-%s-latest%s.zip' % (utils.GuessOS(), sdk_suffix) |
100 UploadArchive(SDK_LOCAL_ZIP, | 101 UploadArchive(SDK_LOCAL_ZIP, |
101 GS_SITE + '/'.join([gsdir, GS_SDK_DIR, latest_name])) | 102 GS_SITE + '/'.join([gsdir, GS_SDK_DIR, latest_name])) |
| 103 utils.Touch('upload.stamp') |
102 | 104 |
103 | 105 |
104 if __name__ == '__main__': | 106 if __name__ == '__main__': |
105 sys.exit(main(sys.argv)) | 107 sys.exit(main(sys.argv)) |
OLD | NEW |