OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 """Script to create Chrome Installer archive. | 6 """Script to create Chrome Installer archive. |
7 | 7 |
8 This script is used to create an archive of all the files required for a | 8 This script is used to create an archive of all the files required for a |
9 Chrome install in appropriate directory structure. It reads chrome.release | 9 Chrome install in appropriate directory structure. It reads chrome.release |
10 file as input, creates chrome.7z archive, compresses setup.exe and | 10 file as input, creates chrome.7z archive, compresses setup.exe and |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 '-mb0s1:2', | 83 '-mb0s1:2', |
84 '-mb0s2:3', | 84 '-mb0s2:3', |
85 compressed_file, | 85 compressed_file, |
86 input_file,] | 86 input_file,] |
87 if os.path.exists(compressed_file): | 87 if os.path.exists(compressed_file): |
88 os.remove(compressed_file) | 88 os.remove(compressed_file) |
89 RunSystemCommand(cmd) | 89 RunSystemCommand(cmd) |
90 | 90 |
91 | 91 |
92 def CopyAllFilesToStagingDir(config, distribution, staging_dir, build_dir, | 92 def CopyAllFilesToStagingDir(config, distribution, staging_dir, build_dir, |
93 enable_hidpi): | 93 enable_hidpi, enable_metro): |
94 """Copies the files required for installer archive. | 94 """Copies the files required for installer archive. |
95 Copies all common files required for various distributions of Chromium and | 95 Copies all common files required for various distributions of Chromium and |
96 also files for the specific Chromium build specified by distribution. | 96 also files for the specific Chromium build specified by distribution. |
97 """ | 97 """ |
98 CopySectionFilesToStagingDir(config, 'GENERAL', staging_dir, build_dir) | 98 CopySectionFilesToStagingDir(config, 'GENERAL', staging_dir, build_dir) |
99 if distribution: | 99 if distribution: |
100 if len(distribution) > 1 and distribution[0] == '_': | 100 if len(distribution) > 1 and distribution[0] == '_': |
101 distribution = distribution[1:] | 101 distribution = distribution[1:] |
102 CopySectionFilesToStagingDir(config, distribution.upper(), | 102 CopySectionFilesToStagingDir(config, distribution.upper(), |
103 staging_dir, build_dir) | 103 staging_dir, build_dir) |
104 if enable_hidpi == '1': | 104 if enable_hidpi == '1': |
105 CopySectionFilesToStagingDir(config, 'HIDPI', staging_dir, build_dir) | 105 CopySectionFilesToStagingDir(config, 'HIDPI', staging_dir, build_dir) |
| 106 if enable_metro == '1': |
| 107 CopySectionFilesToStagingDir(config, 'METRO', staging_dir, build_dir) |
106 | 108 |
107 | 109 |
108 def CopySectionFilesToStagingDir(config, section, staging_dir, build_dir): | 110 def CopySectionFilesToStagingDir(config, section, staging_dir, build_dir): |
109 """Copies installer archive files specified in section to staging dir. | 111 """Copies installer archive files specified in section to staging dir. |
110 This method copies reads section from config file and copies all the files | 112 This method copies reads section from config file and copies all the files |
111 specified to staging dir. | 113 specified to staging dir. |
112 """ | 114 """ |
113 for option in config.options(section): | 115 for option in config.options(section): |
114 if option.endswith('dir'): | 116 if option.endswith('dir'): |
115 continue | 117 continue |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
321 | 323 |
322 prev_version = GetPrevVersion(options.build_dir, temp_dir, | 324 prev_version = GetPrevVersion(options.build_dir, temp_dir, |
323 options.last_chrome_installer) | 325 options.last_chrome_installer) |
324 | 326 |
325 # Preferentially copy the files we can find from the output_dir, as | 327 # Preferentially copy the files we can find from the output_dir, as |
326 # this is where we'll find the Syzygy-optimized executables when | 328 # this is where we'll find the Syzygy-optimized executables when |
327 # building the optimized mini_installer. | 329 # building the optimized mini_installer. |
328 if options.build_dir != options.output_dir: | 330 if options.build_dir != options.output_dir: |
329 CopyAllFilesToStagingDir(config, options.distribution, | 331 CopyAllFilesToStagingDir(config, options.distribution, |
330 staging_dir, options.output_dir, | 332 staging_dir, options.output_dir, |
331 options.enable_hidpi) | 333 options.enable_hidpi, options.enable_metro) |
332 | 334 |
333 # Now copy the remainder of the files from the build dir. | 335 # Now copy the remainder of the files from the build dir. |
334 CopyAllFilesToStagingDir(config, options.distribution, | 336 CopyAllFilesToStagingDir(config, options.distribution, |
335 staging_dir, options.build_dir, | 337 staging_dir, options.build_dir, |
336 options.enable_hidpi) | 338 options.enable_hidpi, options.enable_metro) |
337 | 339 |
338 version_numbers = current_version.split('.') | 340 version_numbers = current_version.split('.') |
339 current_build_number = version_numbers[2] + '.' + version_numbers[3] | 341 current_build_number = version_numbers[2] + '.' + version_numbers[3] |
340 prev_build_number = '' | 342 prev_build_number = '' |
341 if prev_version: | 343 if prev_version: |
342 version_numbers = prev_version.split('.') | 344 version_numbers = prev_version.split('.') |
343 prev_build_number = version_numbers[2] + '.' + version_numbers[3] | 345 prev_build_number = version_numbers[2] + '.' + version_numbers[3] |
344 | 346 |
345 # Name of the archive file built (for example - chrome.7z or | 347 # Name of the archive file built (for example - chrome.7z or |
346 # patch-<old_version>-<new_version>.7z or patch-<new_version>.7z | 348 # patch-<old_version>-<new_version>.7z or patch-<new_version>.7z |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
380 '& chrome.7z.') | 382 '& chrome.7z.') |
381 parser.add_option('-f', '--setup_exe_format', default='COMPRESSED', | 383 parser.add_option('-f', '--setup_exe_format', default='COMPRESSED', |
382 help='How setup.exe should be included {COMPRESSED|DIFF|FULL}.') | 384 help='How setup.exe should be included {COMPRESSED|DIFF|FULL}.') |
383 parser.add_option('-a', '--diff_algorithm', default='BSDIFF', | 385 parser.add_option('-a', '--diff_algorithm', default='BSDIFF', |
384 help='Diff algorithm to use when generating differential patches ' | 386 help='Diff algorithm to use when generating differential patches ' |
385 '{BSDIFF|COURGETTE}.') | 387 '{BSDIFF|COURGETTE}.') |
386 parser.add_option('-n', '--output_name', default='chrome', | 388 parser.add_option('-n', '--output_name', default='chrome', |
387 help='Name used to prefix names of generated archives.') | 389 help='Name used to prefix names of generated archives.') |
388 parser.add_option('--enable_hidpi', default='0', | 390 parser.add_option('--enable_hidpi', default='0', |
389 help='Whether to include HiDPI resource files.') | 391 help='Whether to include HiDPI resource files.') |
| 392 parser.add_option('--enable_metro', default='0', |
| 393 help='Whether to include resource files from the "METRO" section of the ' |
| 394 'input file.') |
390 | 395 |
391 options, args = parser.parse_args() | 396 options, args = parser.parse_args() |
392 if not options.build_dir: | 397 if not options.build_dir: |
393 parser.error('You must provide a build dir.') | 398 parser.error('You must provide a build dir.') |
394 | 399 |
395 if not options.staging_dir: | 400 if not options.staging_dir: |
396 parser.error('You must provide a staging dir.') | 401 parser.error('You must provide a staging dir.') |
397 | 402 |
398 if not options.output_dir: | 403 if not options.output_dir: |
399 options.output_dir = options.build_dir | 404 options.output_dir = options.build_dir |
400 | 405 |
401 if not options.resource_file_path: | 406 if not options.resource_file_path: |
402 options.options.resource_file_path = os.path.join(options.build_dir, | 407 options.options.resource_file_path = os.path.join(options.build_dir, |
403 MINI_INSTALLER_INPUT_FILE) | 408 MINI_INSTALLER_INPUT_FILE) |
404 | 409 |
405 return options | 410 return options |
406 | 411 |
407 | 412 |
408 if '__main__' == __name__: | 413 if '__main__' == __name__: |
409 print sys.argv | 414 print sys.argv |
410 sys.exit(main(_ParseOptions())) | 415 sys.exit(main(_ParseOptions())) |
OLD | NEW |