| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 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, enable_metro): | 93 enable_hidpi, enable_touch_ui): |
| 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': | 106 if enable_touch_ui == '1': |
| 107 CopySectionFilesToStagingDir(config, 'METRO', staging_dir, build_dir) | 107 CopySectionFilesToStagingDir(config, 'TOUCH', staging_dir, build_dir) |
| 108 | 108 |
| 109 | 109 |
| 110 def CopySectionFilesToStagingDir(config, section, staging_dir, src_dir): | 110 def CopySectionFilesToStagingDir(config, section, staging_dir, src_dir): |
| 111 """Copies installer archive files specified in section from src_dir to | 111 """Copies installer archive files specified in section from src_dir to |
| 112 staging_dir. This method reads section from config and copies all the | 112 staging_dir. This method reads section from config and copies all the |
| 113 files specified from src_dir to staging dir. | 113 files specified from src_dir to staging dir. |
| 114 """ | 114 """ |
| 115 for option in config.options(section): | 115 for option in config.options(section): |
| 116 if option.endswith('dir'): | 116 if option.endswith('dir'): |
| 117 continue | 117 continue |
| (...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 486 prev_version = GetPrevVersion(options.build_dir, temp_dir, | 486 prev_version = GetPrevVersion(options.build_dir, temp_dir, |
| 487 options.last_chrome_installer, | 487 options.last_chrome_installer, |
| 488 options.output_name) | 488 options.output_name) |
| 489 | 489 |
| 490 # Preferentially copy the files we can find from the output_dir, as | 490 # Preferentially copy the files we can find from the output_dir, as |
| 491 # this is where we'll find the Syzygy-optimized executables when | 491 # this is where we'll find the Syzygy-optimized executables when |
| 492 # building the optimized mini_installer. | 492 # building the optimized mini_installer. |
| 493 if options.build_dir != options.output_dir: | 493 if options.build_dir != options.output_dir: |
| 494 CopyAllFilesToStagingDir(config, options.distribution, | 494 CopyAllFilesToStagingDir(config, options.distribution, |
| 495 staging_dir, options.output_dir, | 495 staging_dir, options.output_dir, |
| 496 options.enable_hidpi, options.enable_metro) | 496 options.enable_hidpi, options.enable_touch_ui) |
| 497 | 497 |
| 498 # Now copy the remainder of the files from the build dir. | 498 # Now copy the remainder of the files from the build dir. |
| 499 CopyAllFilesToStagingDir(config, options.distribution, | 499 CopyAllFilesToStagingDir(config, options.distribution, |
| 500 staging_dir, options.build_dir, | 500 staging_dir, options.build_dir, |
| 501 options.enable_hidpi, options.enable_metro) | 501 options.enable_hidpi, options.enable_touch_ui) |
| 502 | 502 |
| 503 if options.component_build == '1': | 503 if options.component_build == '1': |
| 504 DoComponentBuildTasks(staging_dir, options.build_dir, current_version) | 504 DoComponentBuildTasks(staging_dir, options.build_dir, current_version) |
| 505 | 505 |
| 506 version_numbers = current_version.split('.') | 506 version_numbers = current_version.split('.') |
| 507 current_build_number = version_numbers[2] + '.' + version_numbers[3] | 507 current_build_number = version_numbers[2] + '.' + version_numbers[3] |
| 508 prev_build_number = '' | 508 prev_build_number = '' |
| 509 if prev_version: | 509 if prev_version: |
| 510 version_numbers = prev_version.split('.') | 510 version_numbers = prev_version.split('.') |
| 511 prev_build_number = version_numbers[2] + '.' + version_numbers[3] | 511 prev_build_number = version_numbers[2] + '.' + version_numbers[3] |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 548 '& chrome.7z.') | 548 '& chrome.7z.') |
| 549 parser.add_option('-f', '--setup_exe_format', default='COMPRESSED', | 549 parser.add_option('-f', '--setup_exe_format', default='COMPRESSED', |
| 550 help='How setup.exe should be included {COMPRESSED|DIFF|FULL}.') | 550 help='How setup.exe should be included {COMPRESSED|DIFF|FULL}.') |
| 551 parser.add_option('-a', '--diff_algorithm', default='BSDIFF', | 551 parser.add_option('-a', '--diff_algorithm', default='BSDIFF', |
| 552 help='Diff algorithm to use when generating differential patches ' | 552 help='Diff algorithm to use when generating differential patches ' |
| 553 '{BSDIFF|COURGETTE}.') | 553 '{BSDIFF|COURGETTE}.') |
| 554 parser.add_option('-n', '--output_name', default='chrome', | 554 parser.add_option('-n', '--output_name', default='chrome', |
| 555 help='Name used to prefix names of generated archives.') | 555 help='Name used to prefix names of generated archives.') |
| 556 parser.add_option('--enable_hidpi', default='0', | 556 parser.add_option('--enable_hidpi', default='0', |
| 557 help='Whether to include HiDPI resource files.') | 557 help='Whether to include HiDPI resource files.') |
| 558 parser.add_option('--enable_metro', default='0', | 558 parser.add_option('--enable_touch_ui', default='0', |
| 559 help='Whether to include resource files from the "METRO" section of the ' | 559 help='Whether to include resource files from the "TOUCH" section of the ' |
| 560 'input file.') | 560 'input file.') |
| 561 parser.add_option('--component_build', default='0', | 561 parser.add_option('--component_build', default='0', |
| 562 help='Whether this archive is packaging a component build.') | 562 help='Whether this archive is packaging a component build.') |
| 563 | 563 |
| 564 options, _ = parser.parse_args() | 564 options, _ = parser.parse_args() |
| 565 if not options.build_dir: | 565 if not options.build_dir: |
| 566 parser.error('You must provide a build dir.') | 566 parser.error('You must provide a build dir.') |
| 567 | 567 |
| 568 options.build_dir = os.path.normpath(options.build_dir) | 568 options.build_dir = os.path.normpath(options.build_dir) |
| 569 | 569 |
| 570 if not options.staging_dir: | 570 if not options.staging_dir: |
| 571 parser.error('You must provide a staging dir.') | 571 parser.error('You must provide a staging dir.') |
| 572 | 572 |
| 573 if not options.input_file: | 573 if not options.input_file: |
| 574 parser.error('You must provide an input file') | 574 parser.error('You must provide an input file') |
| 575 | 575 |
| 576 if not options.output_dir: | 576 if not options.output_dir: |
| 577 options.output_dir = options.build_dir | 577 options.output_dir = options.build_dir |
| 578 | 578 |
| 579 if not options.resource_file_path: | 579 if not options.resource_file_path: |
| 580 options.resource_file_path = os.path.join(options.build_dir, | 580 options.resource_file_path = os.path.join(options.build_dir, |
| 581 MINI_INSTALLER_INPUT_FILE) | 581 MINI_INSTALLER_INPUT_FILE) |
| 582 | 582 |
| 583 return options | 583 return options |
| 584 | 584 |
| 585 | 585 |
| 586 if '__main__' == __name__: | 586 if '__main__' == __name__: |
| 587 print sys.argv | 587 print sys.argv |
| 588 sys.exit(main(_ParseOptions())) | 588 sys.exit(main(_ParseOptions())) |
| OLD | NEW |