Add more protection to CleanStage from bad manifests.
Have CleanStage catch most exceptions generated by parsing the
manifest instead of just EnvironmentError.
BUG=chromium-os:23277
TEST=Verified manifest parse error leads to buildroot clobber.
Change-Id: I90679e8a8fae62d8bb9601ad9cc6c9d9e42bdaee
Reviewed-on: https://gerrit.chromium.org/gerrit/31927
Reviewed-by: Brian Harring <ferringb@chromium.org>
Commit-Ready: Ryan Cui <rcui@chromium.org>
Tested-by: Ryan Cui <rcui@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/32875
Reviewed-by: David James <davidjames@chromium.org>
diff --git a/buildbot/cbuildbot_stages.py b/buildbot/cbuildbot_stages.py
index fe063e0..63f9372 100644
--- a/buildbot/cbuildbot_stages.py
+++ b/buildbot/cbuildbot_stages.py
@@ -116,10 +116,16 @@
try:
manifest = cros_build_lib.ManifestCheckout.Cached(self._build_root,
search=False)
- except EnvironmentError:
- # Either there is no repo there, or the manifest isn't usable; either
- # way, clean it up.
- pass
+ except (KeyboardInterrupt, MemoryError, SystemExit):
+ raise
+ except Exception, e:
+ # Either there is no repo there, or the manifest isn't usable. If the
+ # directory exists, log the exception for debugging reasons. Either
+ # way, the checkout needs to be wiped since it's in an unknown
+ # state.
+ if os.path.exists(self._build_root):
+ cros_build_lib.Warning("ManifestCheckout at %s is unusable: %s",
+ self._build_root, e)
if manifest is None:
self._DeleteChroot()