Chromium Code Reviews| 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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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): |
| 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 self.bucket = 'gs://dart-archive' |
|
kustermann
2014/03/06 09:20:36
I'd make a named parameter to the constructor to s
ricow1
2014/03/06 11:49:05
I am taking a optional parameter - internal - to s
| |
| 92 | 92 |
| 93 # Functions for quering complete gs:// filepaths | 93 # Functions for quering complete gs:// filepaths |
| 94 | 94 |
| 95 def version_filepath(self, revision): | 95 def version_filepath(self, revision): |
| 96 return '%s/channels/%s/%s/%s/VERSION' % (self.bucket, self.channel, | 96 return '%s/channels/%s/%s/%s/VERSION' % (self.bucket, self.channel, |
| 97 self.release_type, revision) | 97 self.release_type, revision) |
| 98 | 98 |
| 99 def editor_zipfilepath(self, revision, system, arch): | 99 def editor_zipfilepath(self, revision, system, arch): |
| 100 return '/'.join([self.editor_directory(revision), | 100 return '/'.join([self.editor_directory(revision), |
| 101 self.editor_zipfilename(system, arch)]) | 101 self.editor_zipfilename(system, arch)]) |
| 102 | 102 |
| 103 def editor_installer_filepath(self, revision, system, arch, extension): | 103 def editor_installer_filepath(self, revision, system, arch, extension): |
| 104 return '/'.join([self.editor_directory(revision), | 104 return '/'.join([self.editor_directory(revision), |
| 105 self.editor_installer_filename(system, arch, extension)]) | 105 self.editor_installer_filename(system, arch, extension)]) |
| 106 | 106 |
| 107 def sdk_zipfilepath(self, revision, system, arch, mode): | 107 def sdk_zipfilepath(self, revision, system, arch, mode): |
| 108 return '/'.join([self.sdk_directory(revision), | 108 return '/'.join([self.sdk_directory(revision), |
| 109 self.sdk_zipfilename(system, arch, mode)]) | 109 self.sdk_zipfilename(system, arch, mode)]) |
| 110 | 110 |
| 111 def dartium_variant_zipfilepath(self, revision, name, system, arch, mode): | 111 def dartium_variant_zipfilepath(self, revision, name, system, arch, mode): |
| 112 return '/'.join([self.dartium_directory(revision), | 112 return '/'.join([self.dartium_directory(revision), |
| 113 self.dartium_variant_zipfilename(name, system, arch, mode)]) | 113 self.dartium_variant_zipfilename(name, system, arch, mode)]) |
| 114 | 114 |
| 115 def apidocs_zipfilepath(self, revision): | 115 def apidocs_zipfilepath(self, revision): |
| 116 return '/'.join([self.apidocs_directory(revision), | 116 return '/'.join([self.apidocs_directory(revision), |
| 117 self.apidocs_zipfilename()]) | 117 self.apidocs_zipfilename()]) |
| 118 | 118 |
| 119 def dartium_android_apk_filepath(self, revision): | |
| 120 return '/'.join([self.dartium_android_directory(revision), | |
| 121 self.dartium_android_apk_filename()]) | |
| 122 | |
| 119 # Functions for querying gs:// directories | 123 # Functions for querying gs:// directories |
| 120 | 124 |
| 121 def dartium_directory(self, revision): | 125 def dartium_directory(self, revision): |
| 122 return self._variant_directory('dartium', revision) | 126 return self._variant_directory('dartium', revision) |
| 123 | 127 |
| 128 def dartium_android_directory(self, revision): | |
| 129 return self._variant_directory('dartium_android', revision) | |
| 130 | |
| 124 def sdk_directory(self, revision): | 131 def sdk_directory(self, revision): |
| 125 return self._variant_directory('sdk', revision) | 132 return self._variant_directory('sdk', revision) |
| 126 | 133 |
| 127 def editor_directory(self, revision): | 134 def editor_directory(self, revision): |
| 128 return self._variant_directory('editor', revision) | 135 return self._variant_directory('editor', revision) |
| 129 | 136 |
| 130 def editor_eclipse_update_directory(self, revision): | 137 def editor_eclipse_update_directory(self, revision): |
| 131 return self._variant_directory('editor-eclipse-update', revision) | 138 return self._variant_directory('editor-eclipse-update', revision) |
| 132 | 139 |
| 133 def apidocs_directory(self, revision): | 140 def apidocs_directory(self, revision): |
| 134 return self._variant_directory('api-docs', revision) | 141 return self._variant_directory('api-docs', revision) |
| 135 | 142 |
| 136 def misc_directory(self, revision): | 143 def misc_directory(self, revision): |
| 137 return self._variant_directory('misc', revision) | 144 return self._variant_directory('misc', revision) |
| 138 | 145 |
| 139 def _variant_directory(self, name, revision): | 146 def _variant_directory(self, name, revision): |
| 140 return '%s/channels/%s/%s/%s/%s' % (self.bucket, self.channel, | 147 return '%s/channels/%s/%s/%s/%s' % (self.bucket, self.channel, |
| 141 self.release_type, revision, name) | 148 self.release_type, revision, name) |
| 142 | 149 |
| 143 # Functions for quering filenames | 150 # Functions for quering filenames |
| 144 | 151 |
| 152 def dartium_android_apk_filename(self): | |
| 153 return 'Chrome.apk' | |
|
kustermann
2014/03/06 09:20:36
I'd prefer if we can differentiate between release
ricow1
2014/03/06 11:49:05
valid point, I will add that
| |
| 154 | |
| 145 def apidocs_zipfilename(self): | 155 def apidocs_zipfilename(self): |
| 146 return 'dart-api-docs.zip' | 156 return 'dart-api-docs.zip' |
| 147 | 157 |
| 148 def editor_zipfilename(self, system, arch): | 158 def editor_zipfilename(self, system, arch): |
| 149 return 'darteditor-%s-%s.zip' % ( | 159 return 'darteditor-%s-%s.zip' % ( |
| 150 SYSTEM_RENAMES[system], ARCH_RENAMES[arch]) | 160 SYSTEM_RENAMES[system], ARCH_RENAMES[arch]) |
| 151 | 161 |
| 152 def editor_installer_filename(self, system, arch, extension): | 162 def editor_installer_filename(self, system, arch, extension): |
| 153 assert extension in ['dmg', 'msi'] | 163 assert extension in ['dmg', 'msi'] |
| 154 return 'darteditor-installer-%s-%s.%s' % ( | 164 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://') | 252 assert remote_path.startswith('gs://') |
| 243 | 253 |
| 244 args = ['cp'] | 254 args = ['cp'] |
| 245 if public: | 255 if public: |
| 246 args += ['-a', 'public-read'] | 256 args += ['-a', 'public-read'] |
| 247 if recursive: | 257 if recursive: |
| 248 args += ['-R'] | 258 args += ['-R'] |
| 249 args += [local_path, remote_path] | 259 args += [local_path, remote_path] |
| 250 self.execute(args) | 260 self.execute(args) |
| 251 | 261 |
| 262 def setGroupReadACL(self, remote_path, group): | |
| 263 args = ['acl', 'ch', '-g', '%s:R' % group, remote_path] | |
| 264 self.execute(args) | |
| 265 | |
| 266 def setContentType(self, remote_path, content_type): | |
| 267 args = ['setmeta', '-h', 'Content-Type:%s' % content_type, remote_path] | |
| 268 self.execute(args) | |
| 269 | |
| 252 def remove(self, remote_path, recursive=False): | 270 def remove(self, remote_path, recursive=False): |
| 253 assert remote_path.startswith('gs://') | 271 assert remote_path.startswith('gs://') |
| 254 | 272 |
| 255 args = ['rm'] | 273 args = ['rm'] |
| 256 if recursive: | 274 if recursive: |
| 257 args += ['-R'] | 275 args += ['-R'] |
| 258 args += [remote_path] | 276 args += [remote_path] |
| 259 self.execute(args) | 277 self.execute(args) |
| 260 | 278 |
| 261 def CalculateChecksum(filename): | 279 def CalculateChecksum(filename): |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 276 if not mangled_filename: | 294 if not mangled_filename: |
| 277 mangled_filename = os.path.basename(filename) | 295 mangled_filename = os.path.basename(filename) |
| 278 | 296 |
| 279 checksum = CalculateChecksum(filename) | 297 checksum = CalculateChecksum(filename) |
| 280 checksum_filename = '%s.md5sum' % filename | 298 checksum_filename = '%s.md5sum' % filename |
| 281 | 299 |
| 282 with open(checksum_filename, 'w') as f: | 300 with open(checksum_filename, 'w') as f: |
| 283 f.write('%s *%s' % (checksum, mangled_filename)) | 301 f.write('%s *%s' % (checksum, mangled_filename)) |
| 284 | 302 |
| 285 return checksum_filename | 303 return checksum_filename |
| OLD | NEW |