| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # | 2 # |
| 3 # Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 3 # Copyright (c) 2013, 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 imp | 7 import imp |
| 8 import optparse | 8 import optparse |
| 9 import os | 9 import os |
| 10 import subprocess | 10 import subprocess |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 clean_directory(uploads_dir) | 202 clean_directory(uploads_dir) |
| 203 elif options.deploy: | 203 elif options.deploy: |
| 204 clean_directory(uploads_dir) | 204 clean_directory(uploads_dir) |
| 205 | 205 |
| 206 # These are the locations where we can find the *.app folders and *.exe files | 206 # These are the locations where we can find the *.app folders and *.exe files |
| 207 # and the names we use inside the scratch directory. | 207 # and the names we use inside the scratch directory. |
| 208 locations = { | 208 locations = { |
| 209 'macos' : { | 209 'macos' : { |
| 210 'editor' : os.path.join('dart', 'DartEditor.app'), | 210 'editor' : os.path.join('dart', 'DartEditor.app'), |
| 211 'chrome' : os.path.join('dart', 'chromium', 'Chromium.app'), | 211 'chrome' : os.path.join('dart', 'chromium', 'Chromium.app'), |
| 212 'content_shell' : os.path.join('dart', 'chromium', | |
| 213 'Content Shell.app'), | |
| 214 | 212 |
| 215 'editor_scratch' : 'DartEditor%(bits)s.app', | 213 'editor_scratch' : 'DartEditor%(bits)s.app', |
| 216 'chrome_scratch' : 'Chromium%(bits)s.app', | 214 'chrome_scratch' : 'Chromium%(bits)s.app', |
| 217 'content_shell_scratch' : 'ContentShell%(bits)s.app', | |
| 218 | 215 |
| 219 'zip' : True, | 216 'zip' : True, |
| 220 }, | 217 }, |
| 221 'win32' : { | 218 'win32' : { |
| 222 'editor' : os.path.join('dart', 'DartEditor.exe'), | 219 'editor' : os.path.join('dart', 'DartEditor.exe'), |
| 223 'chrome' : os.path.join('dart', 'chromium', 'chrome.exe'), | 220 'chrome' : os.path.join('dart', 'chromium', 'chrome.exe'), |
| 224 'content_shell' : os.path.join('dart', 'chromium', | |
| 225 'content_shell.exe'), | |
| 226 | 221 |
| 227 'msi_scratch' : 'darteditor-installer-windows-%(bits)s.msi', | 222 'msi_scratch' : 'darteditor-installer-windows-%(bits)s.msi', |
| 228 'editor_scratch' : 'DartEditor%(bits)s.exe', | 223 'editor_scratch' : 'DartEditor%(bits)s.exe', |
| 229 'chrome_scratch' : 'chromium%(bits)s.exe', | 224 'chrome_scratch' : 'chromium%(bits)s.exe', |
| 230 'content_shell_scratch' : 'content_shell%(bits)s.exe', | |
| 231 | 225 |
| 232 'zip' : False, | 226 'zip' : False, |
| 233 }, | 227 }, |
| 234 } | 228 } |
| 235 | 229 |
| 236 # Desitination of zip files we download | 230 # Desitination of zip files we download |
| 237 for system in ('macos', 'win32'): | 231 for system in ('macos', 'win32'): |
| 238 for bits in ('32', '64'): | 232 for bits in ('32', '64'): |
| 239 config = { | 233 config = { |
| 240 'revision' : options.revision, | 234 'revision' : options.revision, |
| 241 'system' : system, | 235 'system' : system, |
| 242 'bits' : bits, | 236 'bits' : bits, |
| 243 } | 237 } |
| 244 | 238 |
| 245 destination = os.path.join(downloads_dir, FILENAME_PATTERN % config) | 239 destination = os.path.join(downloads_dir, FILENAME_PATTERN % config) |
| 246 destination_dir = os.path.join(downloads_dir, BASENAME_PATTERN % config) | 240 destination_dir = os.path.join(downloads_dir, BASENAME_PATTERN % config) |
| 247 | 241 |
| 248 deploy = os.path.join(uploads_dir, FILENAME_PATTERN % config) | 242 deploy = os.path.join(uploads_dir, FILENAME_PATTERN % config) |
| 249 deploy_dir = os.path.join(uploads_dir, BASENAME_PATTERN % config) | 243 deploy_dir = os.path.join(uploads_dir, BASENAME_PATTERN % config) |
| 250 | 244 |
| 251 if options.prepare: | 245 if options.prepare: |
| 252 # Download *.zip files from GCS buckets | 246 # Download *.zip files from GCS buckets |
| 253 if options.channel: | 247 if options.channel: |
| 254 download_from_new_location(options.channel, config, destination) | 248 download_from_new_location(options.channel, config, destination) |
| 255 else: | 249 else: |
| 256 download_from_old_location(config, destination) | 250 download_from_old_location(config, destination) |
| 257 | 251 |
| 258 run(['unzip', destination, '-d', destination_dir]) | 252 run(['unzip', destination, '-d', destination_dir]) |
| 259 | 253 |
| 260 for name in ['editor', 'chrome', 'content_shell']: | 254 for name in ['editor', 'chrome']: |
| 261 from_path = os.path.join(destination_dir, locations[system][name]) | 255 from_path = os.path.join(destination_dir, locations[system][name]) |
| 262 to_path = os.path.join( | 256 to_path = os.path.join( |
| 263 presign_dir, locations[system]['%s_scratch' % name] % config) | 257 presign_dir, locations[system]['%s_scratch' % name] % config) |
| 264 | 258 |
| 265 if locations[system]['zip']: | 259 if locations[system]['zip']: |
| 266 # We copy a .app directory directory and zip it | 260 # We copy a .app directory directory and zip it |
| 267 copy_and_zip(from_path, to_path) | 261 copy_and_zip(from_path, to_path) |
| 268 else: | 262 else: |
| 269 # We copy an .exe file | 263 # We copy an .exe file |
| 270 copy_file(from_path, to_path) | 264 copy_file(from_path, to_path) |
| 271 | 265 |
| 272 # Download .*msi installer from GCS to presign directory | 266 # Download .*msi installer from GCS to presign directory |
| 273 if system == 'win32': | 267 if system == 'win32': |
| 274 presign_msi = os.path.join( | 268 presign_msi = os.path.join( |
| 275 presign_dir, locations[system]['msi_scratch'] % config) | 269 presign_dir, locations[system]['msi_scratch'] % config) |
| 276 download_msi_installer_from_new_location( | 270 download_msi_installer_from_new_location( |
| 277 options.channel, config, presign_msi) | 271 options.channel, config, presign_msi) |
| 278 elif options.deploy: | 272 elif options.deploy: |
| 279 copy_tree(destination_dir, deploy_dir) | 273 copy_tree(destination_dir, deploy_dir) |
| 280 | 274 |
| 281 for name in ['editor', 'chrome', 'content_shell']: | 275 for name in ['editor', 'chrome']: |
| 282 from_path = os.path.join( | 276 from_path = os.path.join( |
| 283 postsign_dir, locations[system]['%s_scratch' % name] % config) | 277 postsign_dir, locations[system]['%s_scratch' % name] % config) |
| 284 to_path = os.path.join(deploy_dir, locations[system][name]) | 278 to_path = os.path.join(deploy_dir, locations[system][name]) |
| 285 | 279 |
| 286 if locations[system]['zip']: | 280 if locations[system]['zip']: |
| 287 # We unzip a zip file and copy the resulting signed .app directory | 281 # We unzip a zip file and copy the resulting signed .app directory |
| 288 unzip_and_copy(from_path, to_path) | 282 unzip_and_copy(from_path, to_path) |
| 289 else: | 283 else: |
| 290 # We copy the signed .exe file | 284 # We copy the signed .exe file |
| 291 copy_file(from_path, to_path) | 285 copy_file(from_path, to_path) |
| (...skipping 11 matching lines...) Expand all Loading... |
| 303 # Upload *.msi installer and set 'public-read ACL | 297 # Upload *.msi installer and set 'public-read ACL |
| 304 if system == 'win32': | 298 if system == 'win32': |
| 305 postsign_msi = os.path.join( | 299 postsign_msi = os.path.join( |
| 306 postsign_dir, locations[system]['msi_scratch'] % config) | 300 postsign_dir, locations[system]['msi_scratch'] % config) |
| 307 upload_msi_installer_to_new_location( | 301 upload_msi_installer_to_new_location( |
| 308 options.channel, config, postsign_msi) | 302 options.channel, config, postsign_msi) |
| 309 | 303 |
| 310 if __name__ == '__main__': | 304 if __name__ == '__main__': |
| 311 main() | 305 main() |
| 312 | 306 |
| OLD | NEW |