Index: scripts/slave/recipe_modules/bot_update/api.py |
diff --git a/scripts/slave/recipe_modules/bot_update/api.py b/scripts/slave/recipe_modules/bot_update/api.py |
index 17add359bb5ed1c2bf0014f9ff93322e6b925705..f114fa27ca1e75e8aac1038973bae9769b078d16 100644 |
--- a/scripts/slave/recipe_modules/bot_update/api.py |
+++ b/scripts/slave/recipe_modules/bot_update/api.py |
@@ -208,8 +208,10 @@ class BotUpdateApi(recipe_api.RecipeApi): |
# Ah hah! Now that everything is in place, lets run bot_update! |
try: |
- # 88 is the 'patch failure' return code. |
- self(name, cmd, step_test_data=step_test_data, ok_ret=(0, 88), **kwargs) |
+ # 87 and 88 are the 'patch failure' codes for patch download and patch |
+ # apply, respectively. |
+ self(name, cmd, step_test_data=step_test_data, |
+ ok_ret=(0, 87, 88), **kwargs) |
finally: |
step_result = self.m.step.active_result |
self._properties = step_result.json.output.get('properties', {}) |
@@ -232,10 +234,13 @@ class BotUpdateApi(recipe_api.RecipeApi): |
# the checkout. |
# If there is a patch failure, emit another step that said things failed. |
if step_result.json.output.get('patch_failure'): |
- # TODO(phajdan.jr): Differentiate between failure to download the patch |
- # and failure to apply it. The first is an infra failure, the latter |
- # a definite patch failure. |
- self.m.tryserver.set_patch_failure_tryjob_result() |
+ return_code = step_result.json.output.get('patch_apply_return_code') |
+ if return_code == 3: |
+ # This is download failure, hence an infra failure. |
+ self.m.step.InfraFailure('Failed to download the patch') |
+ else: |
+ # This is actual patch failure. |
+ self.m.tryserver.set_patch_failure_tryjob_result() |
self.m.python.failing_step( |
'Patch failure', 'Check the bot_update step for details') |