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