| 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 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 run([GSUTIL, 'setacl', 'public-read', bucket]) | 129 run([GSUTIL, 'setacl', 'public-read', bucket]) |
| 130 run([GSUTIL, 'setacl', 'public-read', bucket + '.md5sum']) | 130 run([GSUTIL, 'setacl', 'public-read', bucket + '.md5sum']) |
| 131 | 131 |
| 132 def download_from_new_location(channel, config, destination): | 132 def download_from_new_location(channel, config, destination): |
| 133 namer = bot_utils.GCSNamer(channel, | 133 namer = bot_utils.GCSNamer(channel, |
| 134 bot_utils.ReleaseType.RAW) | 134 bot_utils.ReleaseType.RAW) |
| 135 bucket = namer.editor_zipfilepath(config['revision'], config['system'], | 135 bucket = namer.editor_zipfilepath(config['revision'], config['system'], |
| 136 config['bits']) | 136 config['bits']) |
| 137 run([GSUTIL, 'cp', bucket, destination]) | 137 run([GSUTIL, 'cp', bucket, destination]) |
| 138 | 138 |
| 139 def download_msi_installer_from_new_location(channel, config, destination): |
| 140 namer = bot_utils.GCSNamer(channel, bot_utils.ReleaseType.RAW) |
| 141 bucket = namer.editor_installer_filepath( |
| 142 config['revision'], config['system'], config['bits'], 'msi') |
| 143 run([GSUTIL, 'cp', bucket, destination]) |
| 144 |
| 139 def upload_to_new_location(channel, config, source_zip): | 145 def upload_to_new_location(channel, config, source_zip): |
| 140 namer = bot_utils.GCSNamer(channel, | 146 namer = bot_utils.GCSNamer(channel, |
| 141 bot_utils.ReleaseType.SIGNED) | 147 bot_utils.ReleaseType.SIGNED) |
| 142 zipfilename = namer.editor_zipfilename(config['system'], config['bits']) | 148 zipfilename = namer.editor_zipfilename(config['system'], config['bits']) |
| 143 bucket = namer.editor_zipfilepath(config['revision'], config['system'], | 149 bucket = namer.editor_zipfilepath(config['revision'], config['system'], |
| 144 config['bits']) | 150 config['bits']) |
| 145 | 151 |
| 146 if not DRY_RUN: | 152 if not DRY_RUN: |
| 147 bot_utils.CreateChecksumFile(source_zip, mangled_filename=zipfilename) | 153 bot_utils.CreateChecksumFile(source_zip, mangled_filename=zipfilename) |
| 148 md5_zip_file = source_zip + '.md5sum' | 154 md5_zip_file = source_zip + '.md5sum' |
| 149 | 155 |
| 150 run([GSUTIL, 'cp', source_zip, bucket]) | 156 run([GSUTIL, 'cp', source_zip, bucket]) |
| 151 run([GSUTIL, 'cp', md5_zip_file, bucket + '.md5sum']) | 157 run([GSUTIL, 'cp', md5_zip_file, bucket + '.md5sum']) |
| 152 run([GSUTIL, 'setacl', 'public-read', bucket]) | 158 run([GSUTIL, 'setacl', 'public-read', bucket]) |
| 153 run([GSUTIL, 'setacl', 'public-read', bucket + '.md5sum']) | 159 run([GSUTIL, 'setacl', 'public-read', bucket + '.md5sum']) |
| 154 | 160 |
| 161 def upload_msi_installer_to_new_location(channel, config, signed_msi): |
| 162 namer = bot_utils.GCSNamer(channel, bot_utils.ReleaseType.SIGNED) |
| 163 bucket = namer.editor_installer_filepath( |
| 164 config['revision'], config['system'], config['bits'], 'msi') |
| 165 run([GSUTIL, 'cp', '-a', 'public-read', signed_msi, bucket]) |
| 166 |
| 155 def main(): | 167 def main(): |
| 156 if sys.platform != 'linux2': | 168 if sys.platform != 'linux2': |
| 157 print "This script was only tested on linux. Please run it on linux!" | 169 print "This script was only tested on linux. Please run it on linux!" |
| 158 sys.exit(1) | 170 sys.exit(1) |
| 159 | 171 |
| 160 parser = GetOptionsParser() | 172 parser = GetOptionsParser() |
| 161 (options, args) = parser.parse_args() | 173 (options, args) = parser.parse_args() |
| 162 | 174 |
| 163 if not options.scratch_dir: | 175 if not options.scratch_dir: |
| 164 die("No scratch directory given.") | 176 die("No scratch directory given.") |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 'content_shell_scratch' : 'ContentShell%(bits)s.app', | 217 'content_shell_scratch' : 'ContentShell%(bits)s.app', |
| 206 | 218 |
| 207 'zip' : True, | 219 'zip' : True, |
| 208 }, | 220 }, |
| 209 'win32' : { | 221 'win32' : { |
| 210 'editor' : os.path.join('dart', 'DartEditor.exe'), | 222 'editor' : os.path.join('dart', 'DartEditor.exe'), |
| 211 'chrome' : os.path.join('dart', 'chromium', 'chrome.exe'), | 223 'chrome' : os.path.join('dart', 'chromium', 'chrome.exe'), |
| 212 'content_shell' : os.path.join('dart', 'chromium', | 224 'content_shell' : os.path.join('dart', 'chromium', |
| 213 'content_shell.exe'), | 225 'content_shell.exe'), |
| 214 | 226 |
| 227 'msi_scratch' : 'darteditor-installer-windows-%(bits)s.exe', |
| 215 'editor_scratch' : 'DartEditor%(bits)s.exe', | 228 'editor_scratch' : 'DartEditor%(bits)s.exe', |
| 216 'chrome_scratch' : 'chromium%(bits)s.exe', | 229 'chrome_scratch' : 'chromium%(bits)s.exe', |
| 217 'content_shell_scratch' : 'content_shell%(bits)s.exe', | 230 'content_shell_scratch' : 'content_shell%(bits)s.exe', |
| 218 | 231 |
| 219 'zip' : False, | 232 'zip' : False, |
| 220 }, | 233 }, |
| 221 } | 234 } |
| 222 | 235 |
| 223 # Desitination of zip files we download | 236 # Desitination of zip files we download |
| 224 for system in ('macos', 'win32'): | 237 for system in ('macos', 'win32'): |
| (...skipping 23 matching lines...) Expand all Loading... |
| 248 from_path = os.path.join(destination_dir, locations[system][name]) | 261 from_path = os.path.join(destination_dir, locations[system][name]) |
| 249 to_path = os.path.join( | 262 to_path = os.path.join( |
| 250 presign_dir, locations[system]['%s_scratch' % name] % config) | 263 presign_dir, locations[system]['%s_scratch' % name] % config) |
| 251 | 264 |
| 252 if locations[system]['zip']: | 265 if locations[system]['zip']: |
| 253 # We copy a .app directory directory and zip it | 266 # We copy a .app directory directory and zip it |
| 254 copy_and_zip(from_path, to_path) | 267 copy_and_zip(from_path, to_path) |
| 255 else: | 268 else: |
| 256 # We copy an .exe file | 269 # We copy an .exe file |
| 257 copy_file(from_path, to_path) | 270 copy_file(from_path, to_path) |
| 271 |
| 272 # Download .*msi installer from GCS to presign directory |
| 273 if system == 'win32': |
| 274 presign_msi = os.path.join( |
| 275 presign_dir, locations[system]['msi_scratch'] % config) |
| 276 download_msi_installer_from_new_location( |
| 277 options.channel, config, presign_msi) |
| 258 elif options.deploy: | 278 elif options.deploy: |
| 259 copy_tree(destination_dir, deploy_dir) | 279 copy_tree(destination_dir, deploy_dir) |
| 260 | 280 |
| 261 for name in ['editor', 'chrome', 'content_shell']: | 281 for name in ['editor', 'chrome', 'content_shell']: |
| 262 from_path = os.path.join( | 282 from_path = os.path.join( |
| 263 postsign_dir, locations[system]['%s_scratch' % name] % config) | 283 postsign_dir, locations[system]['%s_scratch' % name] % config) |
| 264 to_path = os.path.join(deploy_dir, locations[system][name]) | 284 to_path = os.path.join(deploy_dir, locations[system][name]) |
| 265 | 285 |
| 266 if locations[system]['zip']: | 286 if locations[system]['zip']: |
| 267 # We unzip a zip file and copy the resulting signed .app directory | 287 # We unzip a zip file and copy the resulting signed .app directory |
| 268 unzip_and_copy(from_path, to_path) | 288 unzip_and_copy(from_path, to_path) |
| 269 else: | 289 else: |
| 270 # We copy the signed .exe file | 290 # We copy the signed .exe file |
| 271 copy_file(from_path, to_path) | 291 copy_file(from_path, to_path) |
| 272 | 292 |
| 273 deploy_zip_file = os.path.abspath(deploy) | 293 deploy_zip_file = os.path.abspath(deploy) |
| 274 with ChangedWorkingDirectory(deploy_dir): | 294 with ChangedWorkingDirectory(deploy_dir): |
| 275 run(['zip', '-r9', deploy_zip_file, 'dart']) | 295 run(['zip', '-r9', deploy_zip_file, 'dart']) |
| 276 | 296 |
| 277 # Upload *.zip/*.zip.md5sum and set 'public-read' ACL | 297 # Upload *.zip/*.zip.md5sum and set 'public-read' ACL |
| 278 if options.channel: | 298 if options.channel: |
| 279 upload_to_new_location(options.channel, config, deploy_zip_file) | 299 upload_to_new_location(options.channel, config, deploy_zip_file) |
| 280 else: | 300 else: |
| 281 upload_to_old_location(config, deploy_zip_file) | 301 upload_to_old_location(config, deploy_zip_file) |
| 282 | 302 |
| 303 # Upload *.msi installer and set 'public-read ACL |
| 304 if system == 'win32': |
| 305 postsign_msi = os.path.join( |
| 306 postsign_dir, locations[system]['msi_scratch'] % config) |
| 307 upload_msi_installer_to_new_location( |
| 308 options.channel, config, postsign_msi) |
| 309 |
| 283 if __name__ == '__main__': | 310 if __name__ == '__main__': |
| 284 main() | 311 main() |
| 285 | 312 |
| OLD | NEW |