Index: chrome/tools/build/win/create_installer_archive.py |
diff --git a/chrome/tools/build/win/create_installer_archive.py b/chrome/tools/build/win/create_installer_archive.py |
index 4a4f08072c95d622b239b66d006637c58f5a827a..1d280430af380d6f66fd7d3c22c17ccedb3b3cf8 100755 |
--- a/chrome/tools/build/win/create_installer_archive.py |
+++ b/chrome/tools/build/win/create_installer_archive.py |
@@ -302,6 +302,19 @@ def CreateArchiveFile(options, staging_dir, current_version, prev_version): |
return compressed_archive_file |
+def CompressUsingMakecab(input_file, output_dir, verbose=False): |
+ """ Compress |input_file| with makecab.exe and put the compressed file in |
+ |output_dir|, returns the basename of this file. |
+ """ |
+ cmd = ['makecab.exe', |
+ '/D', 'CompressionType=LZX', |
+ '/V1', |
+ '/L', output_dir, |
+ input_file,] |
+ RunSystemCommand(cmd, verbose) |
+ return os.path.basename(input_file)[:-1] + "_" |
+ |
+ |
def PrepareSetupExec(options, current_version, prev_version): |
"""Prepares setup.exe for bundling in mini_installer based on options.""" |
if options.setup_exe_format == "FULL": |
@@ -321,13 +334,10 @@ def PrepareSetupExec(options, current_version, prev_version): |
CompressUsingLZMA(options.build_dir, setup_file_path, patch_file, |
options.verbose) |
else: |
- cmd = ['makecab.exe', |
- '/D', 'CompressionType=LZX', |
- '/V1', |
- '/L', options.output_dir, |
- os.path.join(options.build_dir, SETUP_EXEC),] |
- RunSystemCommand(cmd, options.verbose) |
- setup_file = SETUP_EXEC[:-1] + "_" |
+ setup_file = CompressUsingMakecab( |
+ os.path.join(options.build_dir, SETUP_EXEC), |
grt (UTC plus 2)
2017/04/20 09:30:50
in my checkout, i find that this is compressing th
|
+ options.output_dir, |
+ options.verbose) |
return setup_file |
@@ -366,11 +376,13 @@ def CreateResourceInputFile( |
os.path.join(output_dir, archive_file))) |
# Include all files needed to run setup.exe (these are copied into the |
# 'Installer' dir by DoComponentBuildTasks). |
- if component_build: |
- installer_dir = os.path.join(staging_dir, CHROME_DIR, current_version, |
- 'Installer') |
- for file in os.listdir(installer_dir): |
+ installer_dir = os.path.join(staging_dir, CHROME_DIR, current_version, |
+ 'Installer') |
+ for file in os.listdir(installer_dir): |
+ if component_build: |
resources.append((file, 'BN', os.path.join(installer_dir, file))) |
+ else: |
+ resources.append((file, 'BL', os.path.join(installer_dir, file))) |
with open(resource_file_path, 'w') as f: |
f.write(_RESOURCE_FILE_HEADER) |
@@ -468,6 +480,26 @@ def ParseDLLsFromDeps(build_dir, runtime_deps_file): |
build_dlls.add(os.path.join(build_dir, l)) |
return build_dlls |
+ |
+def CopySetupRuntimeDeps(build_dir, setup_runtime_deps, version_dir, |
+ component_build): |
+ """Copy the setup.exe runtime dependencies to the installer's directory.""" |
+ installer_dir = os.path.join(version_dir, 'Installer') |
+ # |installer_dir| is technically only created post-install, but we need it |
+ # now to add setup.exe's config and manifest to the archive. |
+ if not os.path.exists(installer_dir): |
+ os.mkdir(installer_dir) |
+ |
+ setup_component_dlls = ParseDLLsFromDeps(build_dir, setup_runtime_deps) |
+ for setup_component_dll in setup_component_dlls: |
+ if component_build: |
+ input_name = setup_component_dll |
+ shutil.copy(input_name, installer_dir) |
+ else: |
+ input_name = CompressUsingMakecab(setup_component_dll, installer_dir) |
+ g_archive_inputs.append(input_name) |
+ |
+ |
# Copies component build DLLs and generates required config files and manifests |
# in order for chrome.exe and setup.exe to be able to find those DLLs at |
# run-time. |
@@ -479,17 +511,8 @@ def DoComponentBuildTasks(staging_dir, build_dir, target_arch, |
# Get the required directories for the upcoming operations. |
chrome_dir = os.path.join(staging_dir, CHROME_DIR) |
version_dir = os.path.join(chrome_dir, current_version) |
- installer_dir = os.path.join(version_dir, 'Installer') |
- # |installer_dir| is technically only created post-install, but we need it |
- # now to add setup.exe's config and manifest to the archive. |
- if not os.path.exists(installer_dir): |
- os.mkdir(installer_dir) |
- setup_component_dlls = ParseDLLsFromDeps(build_dir, setup_runtime_deps) |
- |
- for setup_component_dll in setup_component_dlls: |
- g_archive_inputs.append(setup_component_dll) |
- shutil.copy(setup_component_dll, installer_dir) |
+ CopySetupRuntimeDeps(build_dir, setup_runtime_deps, version_dir, True) |
# Stage all the component DLLs to the |version_dir| (for |
# the version assembly to be able to refer to them below and make sure |
@@ -549,6 +572,10 @@ def main(options): |
DoComponentBuildTasks(staging_dir, options.build_dir, |
options.target_arch, options.setup_runtime_deps, |
options.chrome_runtime_deps, current_version) |
+ elif options.setup_runtime_deps: |
+ CopySetupRuntimeDeps(options.build_dir, options.setup_runtime_deps, |
+ os.path.join(staging_dir, CHROME_DIR, current_version), |
+ options.component_build=='1') |
version_numbers = current_version.split('.') |
current_build_number = version_numbers[2] + '.' + version_numbers[3] |