bootstrap: Clean Chrome checkout on branch checkouts.
gclient can't handle moving Chrome checkouts between branches
reliably, so wipe the Chrome checkout on changes. This is what some
versions of cbuildbot already do, but not older branches.
Chrome is checked out into a subdirectory of .cache, but we don't want
to wipe all of .cache if we can help it, so just wipe
.cache/distfiles.
BUG=chromium:684907
TEST=Same as the rest of the CL stack.
Change-Id: Idf30214e1da28ec8658d0c5784d495c56b34da83
Reviewed-on: https://chromium-review.googlesource.com/447219
Commit-Ready: Don Garrett <dgarrett@chromium.org>
Tested-by: Don Garrett <dgarrett@chromium.org>
Reviewed-by: Ningning Xia <nxia@chromium.org>
diff --git a/scripts/bootstrap.py b/scripts/bootstrap.py
index 34a3aba..726c17b 100644
--- a/scripts/bootstrap.py
+++ b/scripts/bootstrap.py
@@ -83,11 +83,18 @@
# If we are changing branches, clobber the chroot. Note that this chroot
# clobber is unsafe if the chroot is in use, but since no build is in
# progress (and we don't use chroot the), this should be okay.
- logging.info('Unmatched buildroot state, wipe chroot: %s -> %s',
- old_state, new_state)
+ logging.info(
+ 'Unmatched buildroot state, wipe chroot/Chrome Checkout: %s -> %s',
+ old_state, new_state)
+
+ # Wipe chroot.
osutils.RmDir(os.path.join(buildroot, 'chroot'),
ignore_missing=True, sudo=True)
+ # Wipe Chrome build related files.
+ osutils.RmDir(os.path.join(buildroot, '.cache', 'distfiles'),
+ ignore_missing=True, sudo=True)
+
# Finished!
osutils.WriteFile(state_file, new_state)