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 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 os.path.join(staging_dir, CHROME_DIR), | 203 os.path.join(staging_dir, CHROME_DIR), |
204 '-mx0',] | 204 '-mx0',] |
205 # There doesnt seem to be any way in 7za.exe to override existing file so | 205 # There doesnt seem to be any way in 7za.exe to override existing file so |
206 # we always delete before creating a new one. | 206 # we always delete before creating a new one. |
207 if not os.path.exists(archive_file): | 207 if not os.path.exists(archive_file): |
208 RunSystemCommand(cmd) | 208 RunSystemCommand(cmd) |
209 elif options.skip_rebuild_archive != "true": | 209 elif options.skip_rebuild_archive != "true": |
210 os.remove(archive_file) | 210 os.remove(archive_file) |
211 RunSystemCommand(cmd) | 211 RunSystemCommand(cmd) |
212 | 212 |
| 213 # Do not compress the archive in developer (component) builds. |
| 214 if options.component_build == '1': |
| 215 compressed_file = os.path.join( |
| 216 options.output_dir, options.output_name + COMPRESSED_ARCHIVE_SUFFIX) |
| 217 if os.path.exists(compressed_file): |
| 218 os.remove(compressed_file) |
| 219 return os.path.basename(archive_file) |
| 220 |
213 # If we are generating a patch, run bsdiff against previous build and | 221 # If we are generating a patch, run bsdiff against previous build and |
214 # compress the resulting patch file. If this is not a patch just compress the | 222 # compress the resulting patch file. If this is not a patch just compress the |
215 # uncompressed archive file. | 223 # uncompressed archive file. |
216 patch_name_prefix = options.output_name + CHROME_PATCH_FILE_SUFFIX | 224 patch_name_prefix = options.output_name + CHROME_PATCH_FILE_SUFFIX |
217 if options.last_chrome_installer: | 225 if options.last_chrome_installer: |
218 prev_archive_file = os.path.join(options.last_chrome_installer, | 226 prev_archive_file = os.path.join(options.last_chrome_installer, |
219 options.output_name + ARCHIVE_SUFFIX) | 227 options.output_name + ARCHIVE_SUFFIX) |
220 patch_file = os.path.join(options.build_dir, patch_name_prefix + | 228 patch_file = os.path.join(options.build_dir, patch_name_prefix + |
221 PATCH_FILE_EXT) | 229 PATCH_FILE_EXT) |
222 GenerateDiffPatch(options, prev_archive_file, archive_file, patch_file) | 230 GenerateDiffPatch(options, prev_archive_file, archive_file, patch_file) |
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
557 help='Diff algorithm to use when generating differential patches ' | 565 help='Diff algorithm to use when generating differential patches ' |
558 '{BSDIFF|COURGETTE}.') | 566 '{BSDIFF|COURGETTE}.') |
559 parser.add_option('-n', '--output_name', default='chrome', | 567 parser.add_option('-n', '--output_name', default='chrome', |
560 help='Name used to prefix names of generated archives.') | 568 help='Name used to prefix names of generated archives.') |
561 parser.add_option('--enable_hidpi', default='0', | 569 parser.add_option('--enable_hidpi', default='0', |
562 help='Whether to include HiDPI resource files.') | 570 help='Whether to include HiDPI resource files.') |
563 parser.add_option('--enable_touch_ui', default='0', | 571 parser.add_option('--enable_touch_ui', default='0', |
564 help='Whether to include resource files from the "TOUCH" section of the ' | 572 help='Whether to include resource files from the "TOUCH" section of the ' |
565 'input file.') | 573 'input file.') |
566 parser.add_option('--component_build', default='0', | 574 parser.add_option('--component_build', default='0', |
567 help='Whether this archive is packaging a component build.') | 575 help='Whether this archive is packaging a component build. This will ' |
| 576 'also turn off compression of chrome.7z into chrome.packed.7z and ' |
| 577 'helpfully delete any old chrome.packed.7z in |output_dir|.') |
568 | 578 |
569 options, _ = parser.parse_args() | 579 options, _ = parser.parse_args() |
570 if not options.build_dir: | 580 if not options.build_dir: |
571 parser.error('You must provide a build dir.') | 581 parser.error('You must provide a build dir.') |
572 | 582 |
573 options.build_dir = os.path.normpath(options.build_dir) | 583 options.build_dir = os.path.normpath(options.build_dir) |
574 | 584 |
575 if not options.staging_dir: | 585 if not options.staging_dir: |
576 parser.error('You must provide a staging dir.') | 586 parser.error('You must provide a staging dir.') |
577 | 587 |
578 if not options.input_file: | 588 if not options.input_file: |
579 parser.error('You must provide an input file') | 589 parser.error('You must provide an input file') |
580 | 590 |
581 if not options.output_dir: | 591 if not options.output_dir: |
582 options.output_dir = options.build_dir | 592 options.output_dir = options.build_dir |
583 | 593 |
584 if not options.resource_file_path: | 594 if not options.resource_file_path: |
585 options.resource_file_path = os.path.join(options.build_dir, | 595 options.resource_file_path = os.path.join(options.build_dir, |
586 MINI_INSTALLER_INPUT_FILE) | 596 MINI_INSTALLER_INPUT_FILE) |
587 | 597 |
588 return options | 598 return options |
589 | 599 |
590 | 600 |
591 if '__main__' == __name__: | 601 if '__main__' == __name__: |
592 print sys.argv | 602 print sys.argv |
593 sys.exit(main(_ParseOptions())) | 603 sys.exit(main(_ParseOptions())) |
OLD | NEW |