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 platform | 10 import platform |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 GoogleCloudStorage bucket. It's structure is as follows: | 66 GoogleCloudStorage bucket. It's structure is as follows: |
67 | 67 |
68 For every (channel,revision,release-type) tuple we have a base path: | 68 For every (channel,revision,release-type) tuple we have a base path: |
69 | 69 |
70 gs://dart-archive/channels/{be,dev,stable,integration} | 70 gs://dart-archive/channels/{be,dev,stable,integration} |
71 /{raw,signed,release}/{revision,latest}/ | 71 /{raw,signed,release}/{revision,latest}/ |
72 | 72 |
73 Under every base path, the following structure is used: | 73 Under every base path, the following structure is used: |
74 - /VERSION | 74 - /VERSION |
75 - /api-docs/dartdocs-gen-api.zip | 75 - /api-docs/dartdocs-gen-api.zip |
76 - /dartium/{chromedriver,content_shell,dartium} | |
77 -{linux,macos,windows}-{ia32,x64}-release.zip | |
78 - /sdk/dartsdk-{linux,macos,windows}-{ia32,x64}-release.zip | 76 - /sdk/dartsdk-{linux,macos,windows}-{ia32,x64}-release.zip |
79 - /editor/darteditor-{linux,macos,windows}-{ia32,x64}.zip | 77 - /editor/darteditor-{linux,macos,windows}-{ia32,x64}.zip |
80 - /editor/darteditor-installer-macos-{ia32,x64}.dmg | 78 - /editor/darteditor-installer-macos-{ia32,x64}.dmg |
81 - /editor/darteditor-installer-windows-{ia32,x64}.msi | 79 - /editor/darteditor-installer-windows-{ia32,x64}.msi |
82 - /editor-eclipse-update | 80 - /editor-eclipse-update |
83 /{index.html,features/,plugins/,artifacts.jar,content.jar} | 81 /{index.html,features/,plugins/,artifacts.jar,content.jar} |
84 """ | 82 """ |
85 def __init__(self, channel=Channel.BLEEDING_EDGE, | 83 def __init__(self, channel=Channel.BLEEDING_EDGE, |
86 release_type=ReleaseType.RAW, internal=False): | 84 release_type=ReleaseType.RAW, internal=False): |
87 assert channel in Channel.ALL_CHANNELS | 85 assert channel in Channel.ALL_CHANNELS |
(...skipping 27 matching lines...) Expand all Loading... |
115 def sdk_zipfilepath(self, revision, system, arch, mode): | 113 def sdk_zipfilepath(self, revision, system, arch, mode): |
116 return '/'.join([self.sdk_directory(revision), | 114 return '/'.join([self.sdk_directory(revision), |
117 self.sdk_zipfilename(system, arch, mode)]) | 115 self.sdk_zipfilename(system, arch, mode)]) |
118 | 116 |
119 def unstripped_filepath(self, revision, system, arch): | 117 def unstripped_filepath(self, revision, system, arch): |
120 return '/'.join([self._variant_directory('unstripped', revision), | 118 return '/'.join([self._variant_directory('unstripped', revision), |
121 system, | 119 system, |
122 arch, | 120 arch, |
123 self.unstripped_filename(system)]) | 121 self.unstripped_filename(system)]) |
124 | 122 |
125 def dartium_variant_zipfilepath(self, revision, name, system, arch, mode): | |
126 return '/'.join([self.dartium_directory(revision), | |
127 self.dartium_variant_zipfilename(name, system, arch, mode)]) | |
128 | |
129 def apidocs_zipfilepath(self, revision): | 123 def apidocs_zipfilepath(self, revision): |
130 return '/'.join([self.apidocs_directory(revision), | 124 return '/'.join([self.apidocs_directory(revision), |
131 self.dartdocs_zipfilename()]) | 125 self.dartdocs_zipfilename()]) |
132 | 126 |
133 def dartium_android_apk_filepath(self, revision, name, arch, mode): | |
134 return '/'.join([self.dartium_android_directory(revision), | |
135 self.dartium_android_apk_filename(name, arch, mode)]) | |
136 | |
137 # Functions for querying gs:// directories | 127 # Functions for querying gs:// directories |
138 | 128 |
139 def dartium_directory(self, revision): | |
140 return self._variant_directory('dartium', revision) | |
141 | |
142 def dartium_android_directory(self, revision): | |
143 return self._variant_directory('dartium_android', revision) | |
144 | |
145 def sdk_directory(self, revision): | 129 def sdk_directory(self, revision): |
146 return self._variant_directory('sdk', revision) | 130 return self._variant_directory('sdk', revision) |
147 | 131 |
148 def linux_packages_directory(self, revision): | 132 def linux_packages_directory(self, revision): |
149 return '/'.join([self._variant_directory('linux_packages', revision)]) | 133 return '/'.join([self._variant_directory('linux_packages', revision)]) |
150 | 134 |
151 def src_directory(self, revision): | 135 def src_directory(self, revision): |
152 return self._variant_directory('src', revision) | 136 return self._variant_directory('src', revision) |
153 | 137 |
154 def editor_directory(self, revision): | 138 def editor_directory(self, revision): |
155 return self._variant_directory('editor', revision) | 139 return self._variant_directory('editor', revision) |
156 | 140 |
157 def editor_eclipse_update_directory(self, revision): | 141 def editor_eclipse_update_directory(self, revision): |
158 return self._variant_directory('editor-eclipse-update', revision) | 142 return self._variant_directory('editor-eclipse-update', revision) |
159 | 143 |
160 def apidocs_directory(self, revision): | 144 def apidocs_directory(self, revision): |
161 return self._variant_directory('api-docs', revision) | 145 return self._variant_directory('api-docs', revision) |
162 | 146 |
163 def misc_directory(self, revision): | 147 def misc_directory(self, revision): |
164 return self._variant_directory('misc', revision) | 148 return self._variant_directory('misc', revision) |
165 | 149 |
166 def _variant_directory(self, name, revision): | 150 def _variant_directory(self, name, revision): |
167 return '%s/channels/%s/%s/%s/%s' % (self.bucket, self.channel, | 151 return '%s/channels/%s/%s/%s/%s' % (self.bucket, self.channel, |
168 self.release_type, revision, name) | 152 self.release_type, revision, name) |
169 | 153 |
170 # Functions for quering filenames | 154 # Functions for quering filenames |
171 | 155 |
172 def dartium_android_apk_filename(self, name, arch, mode): | |
173 return '%s-%s-%s.apk' % (name, arch, mode) | |
174 | |
175 def dartdocs_zipfilename(self): | 156 def dartdocs_zipfilename(self): |
176 return 'dartdocs-gen-api.zip' | 157 return 'dartdocs-gen-api.zip' |
177 | 158 |
178 def editor_zipfilename(self, system, arch): | 159 def editor_zipfilename(self, system, arch): |
179 return 'darteditor-%s-%s.zip' % ( | 160 return 'darteditor-%s-%s.zip' % ( |
180 SYSTEM_RENAMES[system], ARCH_RENAMES[arch]) | 161 SYSTEM_RENAMES[system], ARCH_RENAMES[arch]) |
181 | 162 |
182 def editor_android_zipfilename(self): | 163 def editor_android_zipfilename(self): |
183 return 'android.zip' | 164 return 'android.zip' |
184 | 165 |
185 def editor_installer_filename(self, system, arch, extension): | 166 def editor_installer_filename(self, system, arch, extension): |
186 assert extension in ['dmg', 'msi'] | 167 assert extension in ['dmg', 'msi'] |
187 return 'darteditor-installer-%s-%s.%s' % ( | 168 return 'darteditor-installer-%s-%s.%s' % ( |
188 SYSTEM_RENAMES[system], ARCH_RENAMES[arch], extension) | 169 SYSTEM_RENAMES[system], ARCH_RENAMES[arch], extension) |
189 | 170 |
190 def sdk_zipfilename(self, system, arch, mode): | 171 def sdk_zipfilename(self, system, arch, mode): |
191 assert mode in Mode.ALL_MODES | 172 assert mode in Mode.ALL_MODES |
192 return 'dartsdk-%s-%s-%s.zip' % ( | 173 return 'dartsdk-%s-%s-%s.zip' % ( |
193 SYSTEM_RENAMES[system], ARCH_RENAMES[arch], mode) | 174 SYSTEM_RENAMES[system], ARCH_RENAMES[arch], mode) |
194 | 175 |
195 def unstripped_filename(self, system): | 176 def unstripped_filename(self, system): |
196 return 'dart.exe' if system.startswith('win') else 'dart' | 177 return 'dart.exe' if system.startswith('win') else 'dart' |
197 | 178 |
198 def dartium_variant_zipfilename(self, name, system, arch, mode): | |
199 assert name in ['chromedriver', 'dartium', 'content_shell'] | |
200 assert mode in Mode.ALL_MODES | |
201 return '%s-%s-%s-%s.zip' % ( | |
202 name, SYSTEM_RENAMES[system], ARCH_RENAMES[arch], mode) | |
203 | |
204 class GCSNamerApiDocs(object): | 179 class GCSNamerApiDocs(object): |
205 def __init__(self, channel=Channel.BLEEDING_EDGE): | 180 def __init__(self, channel=Channel.BLEEDING_EDGE): |
206 assert channel in Channel.ALL_CHANNELS | 181 assert channel in Channel.ALL_CHANNELS |
207 | 182 |
208 self.channel = channel | 183 self.channel = channel |
209 self.bucket = 'gs://dartlang-api-docs' | 184 self.bucket = 'gs://dartlang-api-docs' |
210 | 185 |
211 def dartdocs_dirpath(self, revision): | 186 def dartdocs_dirpath(self, revision): |
212 assert len('%s' % revision) > 0 | 187 assert len('%s' % revision) > 0 |
213 if self.channel == Channel.BLEEDING_EDGE: | 188 if self.channel == Channel.BLEEDING_EDGE: |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
376 if channel_name in Channel.ALL_CHANNELS: | 351 if channel_name in Channel.ALL_CHANNELS: |
377 return channel_name | 352 return channel_name |
378 return Channel.BLEEDING_EDGE | 353 return Channel.BLEEDING_EDGE |
379 | 354 |
380 def GetSystemFromName(name): | 355 def GetSystemFromName(name): |
381 """Get the system from the name.""" | 356 """Get the system from the name.""" |
382 for part in string.split(name, '-'): | 357 for part in string.split(name, '-'): |
383 if part in SYSTEM_RENAMES: return SYSTEM_RENAMES[part] | 358 if part in SYSTEM_RENAMES: return SYSTEM_RENAMES[part] |
384 | 359 |
385 raise ValueError("Bot name '{}' not have a system name in it.".format(name)) | 360 raise ValueError("Bot name '{}' not have a system name in it.".format(name)) |
OLD | NEW |