diff options
author | scottmg@chromium.org <scottmg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-10-10 22:23:26 +0000 |
---|---|---|
committer | scottmg@chromium.org <scottmg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-10-10 22:23:26 +0000 |
commit | 8d84c14eaf11aa8bfab91b6f2f3961a93aec31ce (patch) | |
tree | 017f9cb1df280ca511483230b279600c382ea7bd /chrome/tools | |
parent | 2dd083d266b01a6f2dfd47699bd2b2750b740b98 (diff) | |
download | chromium_src-8d84c14eaf11aa8bfab91b6f2f3961a93aec31ce.zip chromium_src-8d84c14eaf11aa8bfab91b6f2f3961a93aec31ce.tar.gz chromium_src-8d84c14eaf11aa8bfab91b6f2f3961a93aec31ce.tar.bz2 |
Copy runtime DLLs only if the contents have changed
This is an attempt to avoid sharing violations during
create_installer_archive.py on the Win x64 bots. See linked bug for the
nitty-gritty.
R=gab@chromium.org
BUG=305877
Review URL: https://codereview.chromium.org/26897002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@228028 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/tools')
-rwxr-xr-x | chrome/tools/build/win/create_installer_archive.py | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/chrome/tools/build/win/create_installer_archive.py b/chrome/tools/build/win/create_installer_archive.py index 77f0078..f5a9998 100755 --- a/chrome/tools/build/win/create_installer_archive.py +++ b/chrome/tools/build/win/create_installer_archive.py @@ -349,6 +349,29 @@ def CopyAndAugmentManifest(build_dir, output_dir, manifest_name, modified_manifest_file.close() +def CopyIfChanged(src, target_dir): + """Copy specified |src| file to |target_dir|, but only write to target if + the file has changed. This avoids a problem during packaging where parts of + the build have not completed and have the runtime DLL locked when we try to + copy over it. See http://crbug.com/305877 for details.""" + assert os.path.isdir(target_dir) + dest = os.path.join(target_dir, os.path.basename(src)) + if os.path.exists(dest): + # We assume the files are OK to buffer fully into memory since we know + # they're only 1-2M. + with open(src, 'rb') as fsrc: + src_data = fsrc.read() + with open(dest, 'rb') as fdest: + dest_data = fdest.read() + if src_data != dest_data: + # This may still raise if we get here, but this really should almost + # never happen (it would mean that the contents of e.g. msvcr100d.dll + # had been changed). + shutil.copyfile(src, dest) + else: + shutil.copyfile(src, dest) + + # Copy the relevant CRT DLLs to |build_dir|. We copy DLLs from all versions # of VS installed to make sure we have the correct CRT version, unused DLLs # should not conflict with the others anyways. @@ -399,7 +422,7 @@ def CopyVisualStudioRuntimeDLLs(build_dir, target_arch): "may not run on a system that doesn't have those DLLs.") for dll in crt_dlls: - shutil.copy(dll, build_dir) + CopyIfChanged(dll, build_dir) # Copies component build DLLs and generates required config files and manifests |