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 if options.skip_compress_archive == '1': | |
214 compressed_file = os.path.join( | |
215 options.output_dir, options.output_name + COMPRESSED_ARCHIVE_SUFFIX) | |
216 if os.path.exists(compressed_file): | |
217 os.remove(compressed_file) | |
218 return options.output_name + ARCHIVE_SUFFIX | |
robertshield
2012/08/14 16:45:28
change this to os.path.basename(archive_file)
gab
2012/08/14 19:15:37
Done.
| |
219 | |
213 # If we are generating a patch, run bsdiff against previous build and | 220 # 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 | 221 # compress the resulting patch file. If this is not a patch just compress the |
215 # uncompressed archive file. | 222 # uncompressed archive file. |
216 patch_name_prefix = options.output_name + CHROME_PATCH_FILE_SUFFIX | 223 patch_name_prefix = options.output_name + CHROME_PATCH_FILE_SUFFIX |
217 if options.last_chrome_installer: | 224 if options.last_chrome_installer: |
218 prev_archive_file = os.path.join(options.last_chrome_installer, | 225 prev_archive_file = os.path.join(options.last_chrome_installer, |
219 options.output_name + ARCHIVE_SUFFIX) | 226 options.output_name + ARCHIVE_SUFFIX) |
220 patch_file = os.path.join(options.build_dir, patch_name_prefix + | 227 patch_file = os.path.join(options.build_dir, patch_name_prefix + |
221 PATCH_FILE_EXT) | 228 PATCH_FILE_EXT) |
222 GenerateDiffPatch(options, prev_archive_file, archive_file, patch_file) | 229 GenerateDiffPatch(options, prev_archive_file, archive_file, patch_file) |
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
558 '{BSDIFF|COURGETTE}.') | 565 '{BSDIFF|COURGETTE}.') |
559 parser.add_option('-n', '--output_name', default='chrome', | 566 parser.add_option('-n', '--output_name', default='chrome', |
560 help='Name used to prefix names of generated archives.') | 567 help='Name used to prefix names of generated archives.') |
561 parser.add_option('--enable_hidpi', default='0', | 568 parser.add_option('--enable_hidpi', default='0', |
562 help='Whether to include HiDPI resource files.') | 569 help='Whether to include HiDPI resource files.') |
563 parser.add_option('--enable_touch_ui', default='0', | 570 parser.add_option('--enable_touch_ui', default='0', |
564 help='Whether to include resource files from the "TOUCH" section of the ' | 571 help='Whether to include resource files from the "TOUCH" section of the ' |
565 'input file.') | 572 'input file.') |
566 parser.add_option('--component_build', default='0', | 573 parser.add_option('--component_build', default='0', |
567 help='Whether this archive is packaging a component build.') | 574 help='Whether this archive is packaging a component build.') |
575 parser.add_option('--skip_compress_archive', default='0', | |
576 help='Whether compressing chrome.7z into chrome.packed.7z should be ' | |
577 'skipped.') | |
robertshield
2012/08/14 16:45:28
Mention that this also deletes any existing chrome
gab
2012/08/14 19:15:37
Wrote an inspiring comment :)
| |
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 |