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 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
341 insert_before, ''.join(manifest_lines))) | 341 insert_before, ''.join(manifest_lines))) |
342 old = manifest_lines[insert_line] | 342 old = manifest_lines[insert_line] |
343 manifest_lines[insert_line] = (old[:insert_pos] + inserted_string + | 343 manifest_lines[insert_line] = (old[:insert_pos] + inserted_string + |
344 old[insert_pos:]) | 344 old[insert_pos:]) |
345 | 345 |
346 modified_manifest_file = open( | 346 modified_manifest_file = open( |
347 os.path.join(output_dir, manifest_name), 'w') | 347 os.path.join(output_dir, manifest_name), 'w') |
348 modified_manifest_file.write(''.join(manifest_lines)) | 348 modified_manifest_file.write(''.join(manifest_lines)) |
349 modified_manifest_file.close() | 349 modified_manifest_file.close() |
350 | 350 |
351 def AddVersionAssemblyManifest(staging_dir, current_version): | |
grt (UTC plus 2)
2013/11/05 03:08:36
nit: add a doc string
Cait (Slow)
2013/11/05 05:39:06
Done.
| |
352 # Get the required directories for the upcoming operations. | |
353 chrome_dir = os.path.join(staging_dir, CHROME_DIR) | |
354 version_dir = os.path.join(chrome_dir, current_version) | |
355 | |
356 version_manifest = ( | |
357 "<assembly\n" | |
358 " xmlns='urn:schemas-microsoft-com:asm.v1' manifestVersion='1.0'>\n" | |
359 " <assemblyIdentity name='{version}' version='{version}'\n" | |
360 " type='win32'/>\n" | |
361 " <file name='chrome_elf.dll'/>\n" | |
362 "</assembly>".format(version=current_version)) | |
363 | |
364 manifest_name = ("{version}.manifest".format(version=current_version)) | |
robertshield
2013/11/05 02:23:55
nit: don't need the outer ()
grt (UTC plus 2)
2013/11/05 03:08:36
feel free to ignore this nit:
"%s.manifest" % cu
Cait (Slow)
2013/11/05 05:39:06
Done.
| |
365 | |
366 version_manifest_file = open( | |
grt (UTC plus 2)
2013/11/05 03:08:36
with open(os.path.join(version_dir, manifest_name)
Cait (Slow)
2013/11/05 05:39:06
Done.
| |
367 os.path.join(version_dir, manifest_name), 'w') | |
368 version_manifest_file.write(version_manifest) | |
369 version_manifest_file.close() | |
370 | |
351 | 371 |
352 def CopyIfChanged(src, target_dir): | 372 def CopyIfChanged(src, target_dir): |
353 """Copy specified |src| file to |target_dir|, but only write to target if | 373 """Copy specified |src| file to |target_dir|, but only write to target if |
354 the file has changed. This avoids a problem during packaging where parts of | 374 the file has changed. This avoids a problem during packaging where parts of |
355 the build have not completed and have the runtime DLL locked when we try to | 375 the build have not completed and have the runtime DLL locked when we try to |
356 copy over it. See http://crbug.com/305877 for details.""" | 376 copy over it. See http://crbug.com/305877 for details.""" |
357 assert os.path.isdir(target_dir) | 377 assert os.path.isdir(target_dir) |
358 dest = os.path.join(target_dir, os.path.basename(src)) | 378 dest = os.path.join(target_dir, os.path.basename(src)) |
359 if os.path.exists(dest): | 379 if os.path.exists(dest): |
360 # We assume the files are OK to buffer fully into memory since we know | 380 # We assume the files are OK to buffer fully into memory since we know |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
550 | 570 |
551 # Now copy the remainder of the files from the build dir. | 571 # Now copy the remainder of the files from the build dir. |
552 CopyAllFilesToStagingDir(config, options.distribution, | 572 CopyAllFilesToStagingDir(config, options.distribution, |
553 staging_dir, options.build_dir, | 573 staging_dir, options.build_dir, |
554 options.enable_hidpi, options.enable_touch_ui) | 574 options.enable_hidpi, options.enable_touch_ui) |
555 | 575 |
556 if options.component_build == '1': | 576 if options.component_build == '1': |
557 DoComponentBuildTasks(staging_dir, options.build_dir, | 577 DoComponentBuildTasks(staging_dir, options.build_dir, |
558 options.target_arch, current_version) | 578 options.target_arch, current_version) |
559 | 579 |
580 AddVersionAssemblyManifest(staging_dir, current_version) | |
581 | |
560 version_numbers = current_version.split('.') | 582 version_numbers = current_version.split('.') |
561 current_build_number = version_numbers[2] + '.' + version_numbers[3] | 583 current_build_number = version_numbers[2] + '.' + version_numbers[3] |
562 prev_build_number = '' | 584 prev_build_number = '' |
563 if prev_version: | 585 if prev_version: |
564 version_numbers = prev_version.split('.') | 586 version_numbers = prev_version.split('.') |
565 prev_build_number = version_numbers[2] + '.' + version_numbers[3] | 587 prev_build_number = version_numbers[2] + '.' + version_numbers[3] |
566 | 588 |
567 # Name of the archive file built (for example - chrome.7z or | 589 # Name of the archive file built (for example - chrome.7z or |
568 # patch-<old_version>-<new_version>.7z or patch-<new_version>.7z | 590 # patch-<old_version>-<new_version>.7z or patch-<new_version>.7z |
569 archive_file = CreateArchiveFile(options, staging_dir, | 591 archive_file = CreateArchiveFile(options, staging_dir, |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
639 if not options.resource_file_path: | 661 if not options.resource_file_path: |
640 options.resource_file_path = os.path.join(options.build_dir, | 662 options.resource_file_path = os.path.join(options.build_dir, |
641 MINI_INSTALLER_INPUT_FILE) | 663 MINI_INSTALLER_INPUT_FILE) |
642 | 664 |
643 return options | 665 return options |
644 | 666 |
645 | 667 |
646 if '__main__' == __name__: | 668 if '__main__' == __name__: |
647 print sys.argv | 669 print sys.argv |
648 sys.exit(main(_ParseOptions())) | 670 sys.exit(main(_ParseOptions())) |
OLD | NEW |