| OLD | NEW |
| 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 hashlib | 7 import hashlib |
| 8 import imp | 8 import imp |
| 9 import os | 9 import os |
| 10 import subprocess | 10 import subprocess |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 - /dartium/{chromedriver,content_shell,dartium} | 75 - /dartium/{chromedriver,content_shell,dartium} |
| 76 -{linux,macos,windows}-{ia32,x64}-release.zip | 76 -{linux,macos,windows}-{ia32,x64}-release.zip |
| 77 - /sdk/dartsdk-{linux,macos,windows}-{ia32,x64}-release.zip | 77 - /sdk/dartsdk-{linux,macos,windows}-{ia32,x64}-release.zip |
| 78 - /editor/darteditor-{linux,macos,windows}-{ia32,x64}.zip | 78 - /editor/darteditor-{linux,macos,windows}-{ia32,x64}.zip |
| 79 - /editor/darteditor-installer-macos-{ia32,x64}.dmg | 79 - /editor/darteditor-installer-macos-{ia32,x64}.dmg |
| 80 - /editor/darteditor-installer-windows-{ia32,x64}.msi | 80 - /editor/darteditor-installer-windows-{ia32,x64}.msi |
| 81 - /editor-eclipse-update | 81 - /editor-eclipse-update |
| 82 /{index.html,features/,plugins/,artifacts.jar,content.jar} | 82 /{index.html,features/,plugins/,artifacts.jar,content.jar} |
| 83 """ | 83 """ |
| 84 def __init__(self, channel=Channel.BLEEDING_EDGE, | 84 def __init__(self, channel=Channel.BLEEDING_EDGE, |
| 85 release_type=ReleaseType.RAW): | 85 release_type=ReleaseType.RAW, internal=False): |
| 86 assert channel in Channel.ALL_CHANNELS | 86 assert channel in Channel.ALL_CHANNELS |
| 87 assert release_type in ReleaseType.ALL_TYPES | 87 assert release_type in ReleaseType.ALL_TYPES |
| 88 | 88 |
| 89 self.channel = channel | 89 self.channel = channel |
| 90 self.release_type = release_type | 90 self.release_type = release_type |
| 91 self.bucket = 'gs://dart-archive' | 91 if internal: |
| 92 self.bucket = 'gs://dart-archive-internal' |
| 93 else: |
| 94 self.bucket = 'gs://dart-archive' |
| 92 | 95 |
| 93 # Functions for quering complete gs:// filepaths | 96 # Functions for quering complete gs:// filepaths |
| 94 | 97 |
| 95 def version_filepath(self, revision): | 98 def version_filepath(self, revision): |
| 96 return '%s/channels/%s/%s/%s/VERSION' % (self.bucket, self.channel, | 99 return '%s/channels/%s/%s/%s/VERSION' % (self.bucket, self.channel, |
| 97 self.release_type, revision) | 100 self.release_type, revision) |
| 98 | 101 |
| 99 def editor_zipfilepath(self, revision, system, arch): | 102 def editor_zipfilepath(self, revision, system, arch): |
| 100 return '/'.join([self.editor_directory(revision), | 103 return '/'.join([self.editor_directory(revision), |
| 101 self.editor_zipfilename(system, arch)]) | 104 self.editor_zipfilename(system, arch)]) |
| 102 | 105 |
| 103 def editor_installer_filepath(self, revision, system, arch, extension): | 106 def editor_installer_filepath(self, revision, system, arch, extension): |
| 104 return '/'.join([self.editor_directory(revision), | 107 return '/'.join([self.editor_directory(revision), |
| 105 self.editor_installer_filename(system, arch, extension)]) | 108 self.editor_installer_filename(system, arch, extension)]) |
| 106 | 109 |
| 107 def sdk_zipfilepath(self, revision, system, arch, mode): | 110 def sdk_zipfilepath(self, revision, system, arch, mode): |
| 108 return '/'.join([self.sdk_directory(revision), | 111 return '/'.join([self.sdk_directory(revision), |
| 109 self.sdk_zipfilename(system, arch, mode)]) | 112 self.sdk_zipfilename(system, arch, mode)]) |
| 110 | 113 |
| 111 def dartium_variant_zipfilepath(self, revision, name, system, arch, mode): | 114 def dartium_variant_zipfilepath(self, revision, name, system, arch, mode): |
| 112 return '/'.join([self.dartium_directory(revision), | 115 return '/'.join([self.dartium_directory(revision), |
| 113 self.dartium_variant_zipfilename(name, system, arch, mode)]) | 116 self.dartium_variant_zipfilename(name, system, arch, mode)]) |
| 114 | 117 |
| 115 def apidocs_zipfilepath(self, revision): | 118 def apidocs_zipfilepath(self, revision): |
| 116 return '/'.join([self.apidocs_directory(revision), | 119 return '/'.join([self.apidocs_directory(revision), |
| 117 self.apidocs_zipfilename()]) | 120 self.apidocs_zipfilename()]) |
| 118 | 121 |
| 122 def dartium_android_apk_filepath(self, revision, name, arch, mode): |
| 123 return '/'.join([self.dartium_android_directory(revision), |
| 124 self.dartium_android_apk_filename(name, arch, mode)]) |
| 125 |
| 119 # Functions for querying gs:// directories | 126 # Functions for querying gs:// directories |
| 120 | 127 |
| 121 def dartium_directory(self, revision): | 128 def dartium_directory(self, revision): |
| 122 return self._variant_directory('dartium', revision) | 129 return self._variant_directory('dartium', revision) |
| 123 | 130 |
| 131 def dartium_android_directory(self, revision): |
| 132 return self._variant_directory('dartium_android', revision) |
| 133 |
| 124 def sdk_directory(self, revision): | 134 def sdk_directory(self, revision): |
| 125 return self._variant_directory('sdk', revision) | 135 return self._variant_directory('sdk', revision) |
| 126 | 136 |
| 127 def editor_directory(self, revision): | 137 def editor_directory(self, revision): |
| 128 return self._variant_directory('editor', revision) | 138 return self._variant_directory('editor', revision) |
| 129 | 139 |
| 130 def editor_eclipse_update_directory(self, revision): | 140 def editor_eclipse_update_directory(self, revision): |
| 131 return self._variant_directory('editor-eclipse-update', revision) | 141 return self._variant_directory('editor-eclipse-update', revision) |
| 132 | 142 |
| 133 def apidocs_directory(self, revision): | 143 def apidocs_directory(self, revision): |
| 134 return self._variant_directory('api-docs', revision) | 144 return self._variant_directory('api-docs', revision) |
| 135 | 145 |
| 136 def misc_directory(self, revision): | 146 def misc_directory(self, revision): |
| 137 return self._variant_directory('misc', revision) | 147 return self._variant_directory('misc', revision) |
| 138 | 148 |
| 139 def _variant_directory(self, name, revision): | 149 def _variant_directory(self, name, revision): |
| 140 return '%s/channels/%s/%s/%s/%s' % (self.bucket, self.channel, | 150 return '%s/channels/%s/%s/%s/%s' % (self.bucket, self.channel, |
| 141 self.release_type, revision, name) | 151 self.release_type, revision, name) |
| 142 | 152 |
| 143 # Functions for quering filenames | 153 # Functions for quering filenames |
| 144 | 154 |
| 155 def dartium_android_apk_filename(self, name, arch, mode): |
| 156 return '%s-%s-%s.apk' % (name, arch, mode) |
| 157 |
| 145 def apidocs_zipfilename(self): | 158 def apidocs_zipfilename(self): |
| 146 return 'dart-api-docs.zip' | 159 return 'dart-api-docs.zip' |
| 147 | 160 |
| 148 def editor_zipfilename(self, system, arch): | 161 def editor_zipfilename(self, system, arch): |
| 149 return 'darteditor-%s-%s.zip' % ( | 162 return 'darteditor-%s-%s.zip' % ( |
| 150 SYSTEM_RENAMES[system], ARCH_RENAMES[arch]) | 163 SYSTEM_RENAMES[system], ARCH_RENAMES[arch]) |
| 151 | 164 |
| 152 def editor_installer_filename(self, system, arch, extension): | 165 def editor_installer_filename(self, system, arch, extension): |
| 153 assert extension in ['dmg', 'msi'] | 166 assert extension in ['dmg', 'msi'] |
| 154 return 'darteditor-installer-%s-%s.%s' % ( | 167 return 'darteditor-installer-%s-%s.%s' % ( |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 assert remote_path.startswith('gs://') | 255 assert remote_path.startswith('gs://') |
| 243 | 256 |
| 244 args = ['cp'] | 257 args = ['cp'] |
| 245 if public: | 258 if public: |
| 246 args += ['-a', 'public-read'] | 259 args += ['-a', 'public-read'] |
| 247 if recursive: | 260 if recursive: |
| 248 args += ['-R'] | 261 args += ['-R'] |
| 249 args += [local_path, remote_path] | 262 args += [local_path, remote_path] |
| 250 self.execute(args) | 263 self.execute(args) |
| 251 | 264 |
| 265 def setGroupReadACL(self, remote_path, group): |
| 266 args = ['acl', 'ch', '-g', '%s:R' % group, remote_path] |
| 267 self.execute(args) |
| 268 |
| 269 def setContentType(self, remote_path, content_type): |
| 270 args = ['setmeta', '-h', 'Content-Type:%s' % content_type, remote_path] |
| 271 self.execute(args) |
| 272 |
| 252 def remove(self, remote_path, recursive=False): | 273 def remove(self, remote_path, recursive=False): |
| 253 assert remote_path.startswith('gs://') | 274 assert remote_path.startswith('gs://') |
| 254 | 275 |
| 255 args = ['rm'] | 276 args = ['rm'] |
| 256 if recursive: | 277 if recursive: |
| 257 args += ['-R'] | 278 args += ['-R'] |
| 258 args += [remote_path] | 279 args += [remote_path] |
| 259 self.execute(args) | 280 self.execute(args) |
| 260 | 281 |
| 261 def CalculateChecksum(filename): | 282 def CalculateChecksum(filename): |
| (...skipping 14 matching lines...) Expand all Loading... |
| 276 if not mangled_filename: | 297 if not mangled_filename: |
| 277 mangled_filename = os.path.basename(filename) | 298 mangled_filename = os.path.basename(filename) |
| 278 | 299 |
| 279 checksum = CalculateChecksum(filename) | 300 checksum = CalculateChecksum(filename) |
| 280 checksum_filename = '%s.md5sum' % filename | 301 checksum_filename = '%s.md5sum' % filename |
| 281 | 302 |
| 282 with open(checksum_filename, 'w') as f: | 303 with open(checksum_filename, 'w') as f: |
| 283 f.write('%s *%s' % (checksum, mangled_filename)) | 304 f.write('%s *%s' % (checksum, mangled_filename)) |
| 284 | 305 |
| 285 return checksum_filename | 306 return checksum_filename |
| OLD | NEW |