deploy: delay dlc cleanup to run once
We don't need to run this logic multiple times, just once at the end.
This speeds up overall deploy with multiple DLC packages.
BUG=chromium:1175691
TEST=`cros deploy` multiple DLC packages works
Change-Id: I92147cd69eb380d7f2b6d1ee9bb70ac9e4ec9aeb
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/chromite/+/2678900
Commit-Queue: Mike Frysinger <vapier@chromium.org>
Commit-Queue: Andrew Moylan <amoylan@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
Auto-Submit: Mike Frysinger <vapier@chromium.org>
Reviewed-by: Andrew Moylan <amoylan@chromium.org>
diff --git a/cli/deploy.py b/cli/deploy.py
index 1cac9df..058bcfa 100644
--- a/cli/deploy.py
+++ b/cli/deploy.py
@@ -1000,10 +1000,12 @@
if dlc_id and dlc_package:
_DeployDLCImage(device, sysroot, board, dlc_id, dlc_package)
dlc_deployed = True
- # Clean up empty directories created by emerging DLCs.
- device.run(['test', '-d', '/build/rootfs', '&&', 'rmdir',
- '--ignore-fail-on-non-empty', '/build/rootfs', '/build'],
- check=False)
+
+ if dlc_deployed:
+ # Clean up empty directories created by emerging DLCs.
+ device.run(['test', '-d', '/build/rootfs', '&&', 'rmdir',
+ '--ignore-fail-on-non-empty', '/build/rootfs', '/build'],
+ check=False)
if enforced:
device.run(['setenforce', '1'])