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 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
428 def DoComponentBuildTasks(staging_dir, build_dir, target_arch, current_version): | 428 def DoComponentBuildTasks(staging_dir, build_dir, target_arch, current_version): |
429 # Get the required directories for the upcoming operations. | 429 # Get the required directories for the upcoming operations. |
430 chrome_dir = os.path.join(staging_dir, CHROME_DIR) | 430 chrome_dir = os.path.join(staging_dir, CHROME_DIR) |
431 version_dir = os.path.join(chrome_dir, current_version) | 431 version_dir = os.path.join(chrome_dir, current_version) |
432 installer_dir = os.path.join(version_dir, 'Installer') | 432 installer_dir = os.path.join(version_dir, 'Installer') |
433 # |installer_dir| is technically only created post-install, but we need it | 433 # |installer_dir| is technically only created post-install, but we need it |
434 # now to add setup.exe's config and manifest to the archive. | 434 # now to add setup.exe's config and manifest to the archive. |
435 if not os.path.exists(installer_dir): | 435 if not os.path.exists(installer_dir): |
436 os.mkdir(installer_dir) | 436 os.mkdir(installer_dir) |
437 | 437 |
438 # Copy the VS CRT DLLs to |build_dir| and |installer_dir|. This must be done | 438 # Copy the VS CRT DLLs to |build_dir|. This must be done before the general |
439 # before the general copy step below to ensure the CRT DLLs are added to the | 439 # copy step below to ensure the CRT DLLs are added to the archive and marked |
440 # archive and marked as a dependency in the exe manifests generated below. | 440 # as a dependency in the exe manifests generated below. |
441 CopyVisualStudioRuntimeDLLs(target_arch, build_dir) | 441 CopyVisualStudioRuntimeDLLs(target_arch, build_dir) |
442 CopyVisualStudioRuntimeDLLs(target_arch, installer_dir) | |
443 | 442 |
444 # The set of component DLLs required by setup.exe (to be dropped in the | 443 # Explicitly list the component DLLs setup.exe depends on (this list may |
445 # archive in the |installer_dir|). | 444 # contain wildcards). These will be copied to |installer_dir| in the archive. |
446 setup_component_dll_names = { 'base.dll', | 445 setup_component_dll_globs = [ 'base.dll', |
447 'crcrypto.dll', | 446 'crcrypto.dll', |
448 'crnspr.dll', | 447 'crnspr.dll', |
449 'crnss.dll', | 448 'crnss.dll', |
450 'icui18n.dll', | 449 'icui18n.dll', |
451 'icuuc.dll', } | 450 'icuuc.dll', |
| 451 'msvc*.dll' ] |
| 452 for setup_component_dll_glob in setup_component_dll_globs: |
| 453 setup_component_dlls = glob.glob(os.path.join(build_dir, |
| 454 setup_component_dll_glob)) |
| 455 for setup_component_dll in setup_component_dlls: |
| 456 shutil.copy(setup_component_dll, installer_dir) |
452 | 457 |
453 # Stage all the component DLLs found in |build_dir|. These are all the DLLs | 458 # Stage all the component DLLs found in |build_dir| to the |version_dir| (for |
454 # which have not already been added to the staged |version_dir| by virtue of | 459 # the version assembly to be able to refer to them below and make sure |
455 # chrome.release. | 460 # chrome.exe can find them at runtime). The component DLLs are considered to |
| 461 # be all the DLLs which have not already been added to the |version_dir| by |
| 462 # virtue of chrome.release. |
456 build_dlls = glob.glob(os.path.join(build_dir, '*.dll')) | 463 build_dlls = glob.glob(os.path.join(build_dir, '*.dll')) |
457 staged_dll_basenames = [os.path.basename(staged_dll) for staged_dll in \ | 464 staged_dll_basenames = [os.path.basename(staged_dll) for staged_dll in \ |
458 glob.glob(os.path.join(version_dir, '*.dll'))] | 465 glob.glob(os.path.join(version_dir, '*.dll'))] |
459 component_dll_filenames = [] | 466 component_dll_filenames = [] |
460 for component_dll in [dll for dll in build_dlls if \ | 467 for component_dll in [dll for dll in build_dlls if \ |
461 os.path.basename(dll) not in staged_dll_basenames]: | 468 os.path.basename(dll) not in staged_dll_basenames]: |
462 component_dll_name = os.path.basename(component_dll) | 469 component_dll_name = os.path.basename(component_dll) |
463 # remoting_*.dll's don't belong in the archive (it doesn't depend on them | 470 # remoting_*.dll's don't belong in the archive (it doesn't depend on them |
464 # in gyp). Trying to copy them causes a build race when creating the | 471 # in gyp). Trying to copy them causes a build race when creating the |
465 # installer archive in component mode. See: crbug.com/180996 | 472 # installer archive in component mode. See: crbug.com/180996 |
466 if component_dll_name.startswith('remoting_'): | 473 if component_dll_name.startswith('remoting_'): |
467 continue | 474 continue |
468 component_dll_filenames.append(component_dll_name) | 475 component_dll_filenames.append(component_dll_name) |
469 # Copy each |component_dll| to the version_dir (for the version assembly to | |
470 # be able to refer to them below and make sure chrome.exe can find them at | |
471 # runtime). | |
472 shutil.copy(component_dll, version_dir) | 476 shutil.copy(component_dll, version_dir) |
473 # Also copy the ones listed in |setup_component_dll_names| directly to the | |
474 # Installer directory for the installed setup.exe to be able to run (as it | |
475 # doesn't statically link in component DLLs). | |
476 if component_dll_name in setup_component_dll_names: | |
477 shutil.copy(component_dll, installer_dir) | |
478 | 477 |
479 # Augment {version}.manifest to include all component DLLs as part of the | 478 # Augment {version}.manifest to include all component DLLs as part of the |
480 # assembly it constitutes, which will allow dependents of this assembly to | 479 # assembly it constitutes, which will allow dependents of this assembly to |
481 # find these DLLs. | 480 # find these DLLs. |
482 version_assembly_dll_additions = [] | 481 version_assembly_dll_additions = [] |
483 for dll_filename in component_dll_filenames: | 482 for dll_filename in component_dll_filenames: |
484 version_assembly_dll_additions.append(" <file name='%s'/>" % dll_filename) | 483 version_assembly_dll_additions.append(" <file name='%s'/>" % dll_filename) |
485 CopyAndAugmentManifest(build_dir, version_dir, | 484 CopyAndAugmentManifest(build_dir, version_dir, |
486 '%s.manifest' % current_version, | 485 '%s.manifest' % current_version, |
487 '\n'.join(version_assembly_dll_additions), | 486 '\n'.join(version_assembly_dll_additions), |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
598 if not options.resource_file_path: | 597 if not options.resource_file_path: |
599 options.resource_file_path = os.path.join(options.build_dir, | 598 options.resource_file_path = os.path.join(options.build_dir, |
600 MINI_INSTALLER_INPUT_FILE) | 599 MINI_INSTALLER_INPUT_FILE) |
601 | 600 |
602 return options | 601 return options |
603 | 602 |
604 | 603 |
605 if '__main__' == __name__: | 604 if '__main__' == __name__: |
606 print sys.argv | 605 print sys.argv |
607 sys.exit(main(_ParseOptions())) | 606 sys.exit(main(_ParseOptions())) |
OLD | NEW |