summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDon Garrett <dgarrett@google.com>2015-10-23 11:47:19 -0700
committerchrome-bot <chrome-bot@chromium.org>2015-10-23 14:46:04 -0700
commita0306baab48f3cc5d735f9825e78217dfa66eed0 (patch)
treefc67a18871591d2f3bf46c186e4cd8d9e4c4b1d1
parent737cadd19ccbe89494f954ce864405cd77d7ebc6 (diff)
downloadchromite-a0306baab48f3cc5d735f9825e78217dfa66eed0.tar.gz
commands: Only copy images if not present.
Images are being touched in the archive directory while being tarred. There is no clear explaination, but it's possible they are being copied into location more than once. This CL may/may not fix the referenced bug, but it shouldn't hurt anything. BUG=chromium:547055 TEST=cbuildbot/run_tests Change-Id: I6df9cf13b600b39f881e9ea275c9ce5ec5351235 Reviewed-on: https://chromium-review.googlesource.com/308550 Commit-Ready: Don Garrett <dgarrett@chromium.org> Tested-by: Don Garrett <dgarrett@chromium.org> Reviewed-by: Daniel Wang <wonderfly@google.com>
-rw-r--r--cbuildbot/commands.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/cbuildbot/commands.py b/cbuildbot/commands.py
index 2260a1b56..96f6b6480 100644
--- a/cbuildbot/commands.py
+++ b/cbuildbot/commands.py
@@ -1987,7 +1987,12 @@ def BuildStandaloneArchive(archive_dir, image_dir, artifact_info):
# Copy the file in 'paths' as is to the archive directory.
if len(artifact_info['paths']) > 1:
raise ValueError('default archive type does not support multiple inputs')
- shutil.copy(os.path.join(image_dir, artifact_info['paths'][0]), archive_dir)
+ src_image = os.path.join(image_dir, artifact_info['paths'][0])
+ tgt_image = os.path.join(archive_dir, artifact_info['paths'][0])
+ if not os.path.exists(tgt_image):
+ # The image may have already been copied into place. If so, overwriting it
+ # can affect parallel processes.
+ shutil.copy(src_image, tgt_image)
return artifact_info['paths']
inputs = artifact_info['paths']