| 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 SIGNED = 'signed' | 53 SIGNED = 'signed' |
| 54 RELEASE = 'release' | 54 RELEASE = 'release' |
| 55 ALL_TYPES = [RAW, SIGNED, RELEASE] | 55 ALL_TYPES = [RAW, SIGNED, RELEASE] |
| 56 | 56 |
| 57 class Mode(object): | 57 class Mode(object): |
| 58 RELEASE = 'release' | 58 RELEASE = 'release' |
| 59 DEBUG = 'debug' | 59 DEBUG = 'debug' |
| 60 ALL_MODES = [RELEASE, DEBUG] | 60 ALL_MODES = [RELEASE, DEBUG] |
| 61 | 61 |
| 62 class GCSNamer(object): | 62 class GCSNamer(object): |
| 63 """ |
| 64 This class is used for naming objects in our "gs://dart-archive/" |
| 65 GoogleCloudStorage bucket. It's structure is as follows: |
| 66 |
| 67 For every (channel,revision,release-type) tuple we have a base path: |
| 68 |
| 69 gs://dart-archive/channels/{be,dev,stable} |
| 70 /{raw,signed,release}/{revision,latest}/ |
| 71 |
| 72 Under every base path, the following structure is used: |
| 73 - /VERSION |
| 74 - /api-docs/dart-api-docs.zip |
| 75 - /dartium/{chromedriver,content_shell,dartium} |
| 76 -{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 |
| 79 - /editor-eclipse-update |
| 80 /{index.html,features/,plugins/,artifacts.jar,content.jar} |
| 81 """ |
| 63 def __init__(self, channel=Channel.BLEEDING_EDGE, | 82 def __init__(self, channel=Channel.BLEEDING_EDGE, |
| 64 release_type=ReleaseType.RAW): | 83 release_type=ReleaseType.RAW): |
| 65 assert channel in Channel.ALL_CHANNELS | 84 assert channel in Channel.ALL_CHANNELS |
| 66 assert release_type in ReleaseType.ALL_TYPES | 85 assert release_type in ReleaseType.ALL_TYPES |
| 67 | 86 |
| 68 self.channel = channel | 87 self.channel = channel |
| 69 self.release_type = release_type | 88 self.release_type = release_type |
| 70 self.bucket = 'gs://dart-archive' | 89 self.bucket = 'gs://dart-archive' |
| 71 | 90 |
| 72 # Functions for quering complete gs:// filepaths | 91 # Functions for quering complete gs:// filepaths |
| 73 | 92 |
| 74 def version_filepath(self, revision): | 93 def version_filepath(self, revision): |
| 75 return '%s/channels/%s/%s/%s/VERSION' % (self.bucket, self.channel, | 94 return '%s/channels/%s/%s/%s/VERSION' % (self.bucket, self.channel, |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 if not mangled_filename: | 245 if not mangled_filename: |
| 227 mangled_filename = os.path.basename(filename) | 246 mangled_filename = os.path.basename(filename) |
| 228 | 247 |
| 229 checksum = CalculateChecksum(filename) | 248 checksum = CalculateChecksum(filename) |
| 230 checksum_filename = '%s.md5sum' % filename | 249 checksum_filename = '%s.md5sum' % filename |
| 231 | 250 |
| 232 with open(checksum_filename, 'w') as f: | 251 with open(checksum_filename, 'w') as f: |
| 233 f.write('%s *%s' % (checksum, mangled_filename)) | 252 f.write('%s *%s' % (checksum, mangled_filename)) |
| 234 | 253 |
| 235 return checksum_filename | 254 return checksum_filename |
| OLD | NEW |