aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabriel Marin <gmx@chromium.org>2018-05-16 11:31:07 -0700
committerchrome-bot <chrome-bot@chromium.org>2018-05-16 22:49:38 -0700
commite2a920a2de9c03553db50be9484ca802d0a80dae (patch)
tree3afe7756ca74f7bd3837a36f476d2c77f03a1106
parentea6935f966189c65a020b78d1d9921fcd95d6636 (diff)
downloadtoolchain-utils-e2a920a2de9c03553db50be9484ca802d0a80dae.tar.gz
toolchain-utils: Delete temporary chroot image after verification step.
When a local image is outside the chroot, it is temporarily copied into the chroot so that it can be mounted by chroot scripts. Changed the logic to delay the cleanup of the temporary copy until after the verification step. The image needs to be mounted once again during verification. Didn't catch this bug earlier, as the images were cached inside the chroot by previous failed runs. BUG=b:79376118 TEST=Tested with crosperf, two local images and a clean chroot without any cached images. Change-Id: I700f9aa0d9827aa349e75ef7b6b22618baf26fa9 Reviewed-on: https://chromium-review.googlesource.com/1062330 Commit-Ready: Gabriel Marin <gmx@chromium.org> Tested-by: Gabriel Marin <gmx@chromium.org> Reviewed-by: Gabriel Marin <gmx@chromium.org> Reviewed-by: Yunlian Jiang <yunlian@chromium.org>
-rwxr-xr-ximage_chromeos.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/image_chromeos.py b/image_chromeos.py
index 3d9c1809..aa8824b6 100755
--- a/image_chromeos.py
+++ b/image_chromeos.py
@@ -280,11 +280,6 @@ def DoImage(argv):
if log_level == 'average':
cmd_executer.SetLogLevel(log_level)
- if found == False:
- temp_dir = os.path.dirname(located_image)
- l.LogOutput('Deleting temp image dir: %s' % temp_dir)
- shutil.rmtree(temp_dir)
-
logger.GetLogger().LogFatalIf(ret, 'Image command failed')
# Unfortunately cros_image_to_target.py sometimes returns early when the
@@ -316,6 +311,11 @@ def DoImage(argv):
'Image verification failed!')
TryRemountPartitionAsRW(options.chromeos_root, options.remote,
log_level)
+
+ if found == False:
+ temp_dir = os.path.dirname(located_image)
+ l.LogOutput('Deleting temp image dir: %s' % temp_dir)
+ shutil.rmtree(temp_dir)
else:
l.LogOutput('Checksums match. Skipping reimage')
return ret