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) 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 |
11 generates packed_files.txt for mini_installer project. | 11 generates packed_files.txt for mini_installer project. |
12 | 12 |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 '-mb0:1', | 82 '-mb0:1', |
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): | |
94 """Copies the files required for installer archive. | 93 """Copies the files required for installer archive. |
95 Copies all common files required for various distributions of Chromium and | 94 Copies all common files required for various distributions of Chromium and |
96 also files for the specific Chromium build specified by distribution. | 95 also files for the specific Chromium build specified by distribution. |
97 """ | 96 """ |
98 CopySectionFilesToStagingDir(config, 'GENERAL', staging_dir, build_dir) | 97 CopySectionFilesToStagingDir(config, 'GENERAL', staging_dir, build_dir) |
99 if distribution: | 98 if distribution: |
100 if len(distribution) > 1 and distribution[0] == '_': | 99 if len(distribution) > 1 and distribution[0] == '_': |
101 distribution = distribution[1:] | 100 distribution = distribution[1:] |
102 CopySectionFilesToStagingDir(config, distribution.upper(), | 101 CopySectionFilesToStagingDir(config, distribution.upper(), |
103 staging_dir, build_dir) | 102 staging_dir, build_dir) |
104 if enable_hidpi == '1': | |
105 CopySectionFilesToStagingDir(config, 'HIDPI', staging_dir, build_dir) | |
106 | 103 |
107 | 104 |
108 def CopySectionFilesToStagingDir(config, section, staging_dir, build_dir): | 105 def CopySectionFilesToStagingDir(config, section, staging_dir, build_dir): |
109 """Copies installer archive files specified in section to staging dir. | 106 """Copies installer archive files specified in section to staging dir. |
110 This method copies reads section from config file and copies all the files | 107 This method copies reads section from config file and copies all the files |
111 specified to staging dir. | 108 specified to staging dir. |
112 """ | 109 """ |
113 for option in config.options(section): | 110 for option in config.options(section): |
114 if option.endswith('dir'): | 111 if option.endswith('dir'): |
115 continue | 112 continue |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
320 (staging_dir, temp_dir) = MakeStagingDirectories(options.staging_dir) | 317 (staging_dir, temp_dir) = MakeStagingDirectories(options.staging_dir) |
321 | 318 |
322 prev_version = GetPrevVersion(options.build_dir, temp_dir, | 319 prev_version = GetPrevVersion(options.build_dir, temp_dir, |
323 options.last_chrome_installer) | 320 options.last_chrome_installer) |
324 | 321 |
325 # Preferentially copy the files we can find from the output_dir, as | 322 # Preferentially copy the files we can find from the output_dir, as |
326 # this is where we'll find the Syzygy-optimized executables when | 323 # this is where we'll find the Syzygy-optimized executables when |
327 # building the optimized mini_installer. | 324 # building the optimized mini_installer. |
328 if options.build_dir != options.output_dir: | 325 if options.build_dir != options.output_dir: |
329 CopyAllFilesToStagingDir(config, options.distribution, | 326 CopyAllFilesToStagingDir(config, options.distribution, |
330 staging_dir, options.output_dir, | 327 staging_dir, options.output_dir) |
331 options.enable_hidpi) | |
332 | 328 |
333 # Now copy the remainder of the files from the build dir. | 329 # Now copy the remainder of the files from the build dir. |
334 CopyAllFilesToStagingDir(config, options.distribution, | 330 CopyAllFilesToStagingDir(config, options.distribution, |
335 staging_dir, options.build_dir, | 331 staging_dir, options.build_dir) |
336 options.enable_hidpi) | |
337 | 332 |
338 version_numbers = current_version.split('.') | 333 version_numbers = current_version.split('.') |
339 current_build_number = version_numbers[2] + '.' + version_numbers[3] | 334 current_build_number = version_numbers[2] + '.' + version_numbers[3] |
340 prev_build_number = '' | 335 prev_build_number = '' |
341 if prev_version: | 336 if prev_version: |
342 version_numbers = prev_version.split('.') | 337 version_numbers = prev_version.split('.') |
343 prev_build_number = version_numbers[2] + '.' + version_numbers[3] | 338 prev_build_number = version_numbers[2] + '.' + version_numbers[3] |
344 | 339 |
345 # Name of the archive file built (for example - chrome.7z or | 340 # Name of the archive file built (for example - chrome.7z or |
346 # patch-<old_version>-<new_version>.7z or patch-<new_version>.7z | 341 # patch-<old_version>-<new_version>.7z or patch-<new_version>.7z |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
378 'specifies the directory that contains base versions of ' | 373 'specifies the directory that contains base versions of ' |
379 'setup.exe, courgette.exe (if --diff_algorithm is COURGETTE) ' | 374 'setup.exe, courgette.exe (if --diff_algorithm is COURGETTE) ' |
380 '& chrome.7z.') | 375 '& chrome.7z.') |
381 parser.add_option('-f', '--setup_exe_format', default='COMPRESSED', | 376 parser.add_option('-f', '--setup_exe_format', default='COMPRESSED', |
382 help='How setup.exe should be included {COMPRESSED|DIFF|FULL}.') | 377 help='How setup.exe should be included {COMPRESSED|DIFF|FULL}.') |
383 parser.add_option('-a', '--diff_algorithm', default='BSDIFF', | 378 parser.add_option('-a', '--diff_algorithm', default='BSDIFF', |
384 help='Diff algorithm to use when generating differential patches ' | 379 help='Diff algorithm to use when generating differential patches ' |
385 '{BSDIFF|COURGETTE}.') | 380 '{BSDIFF|COURGETTE}.') |
386 parser.add_option('-n', '--output_name', default='chrome', | 381 parser.add_option('-n', '--output_name', default='chrome', |
387 help='Name used to prefix names of generated archives.') | 382 help='Name used to prefix names of generated archives.') |
388 parser.add_option('--enable_hidpi', default='0', | |
389 help='Whether to include HiDPI resource files.') | |
390 | 383 |
391 options, args = parser.parse_args() | 384 options, args = parser.parse_args() |
392 if not options.build_dir: | 385 if not options.build_dir: |
393 parser.error('You must provide a build dir.') | 386 parser.error('You must provide a build dir.') |
394 | 387 |
395 if not options.staging_dir: | 388 if not options.staging_dir: |
396 parser.error('You must provide a staging dir.') | 389 parser.error('You must provide a staging dir.') |
397 | 390 |
398 if not options.output_dir: | 391 if not options.output_dir: |
399 options.output_dir = options.build_dir | 392 options.output_dir = options.build_dir |
400 | 393 |
401 if not options.resource_file_path: | 394 if not options.resource_file_path: |
402 options.options.resource_file_path = os.path.join(options.build_dir, | 395 options.options.resource_file_path = os.path.join(options.build_dir, |
403 MINI_INSTALLER_INPUT_FILE) | 396 MINI_INSTALLER_INPUT_FILE) |
404 | 397 |
405 return options | 398 return options |
406 | 399 |
407 | 400 |
408 if '__main__' == __name__: | 401 if '__main__' == __name__: |
409 print sys.argv | 402 print sys.argv |
410 sys.exit(main(_ParseOptions())) | 403 sys.exit(main(_ParseOptions())) |
OLD | NEW |