| OLD | NEW |
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 | 5 |
| 6 """Recipe module to ensure a checkout is consistant on a bot.""" | 6 """Recipe module to ensure a checkout is consistant on a bot.""" |
| 7 | 7 |
| 8 from recipe_engine import recipe_api | 8 from recipe_engine import recipe_api |
| 9 | 9 |
| 10 | 10 |
| (...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 # This is used by the Chromium module to figure out where to look for | 269 # This is used by the Chromium module to figure out where to look for |
| 270 # the checkout. | 270 # the checkout. |
| 271 # If there is a patch failure, emit another step that said things | 271 # If there is a patch failure, emit another step that said things |
| 272 # failed. | 272 # failed. |
| 273 if step_result.json.output.get('patch_failure'): | 273 if step_result.json.output.get('patch_failure'): |
| 274 return_code = step_result.json.output.get('patch_apply_return_code') | 274 return_code = step_result.json.output.get('patch_apply_return_code') |
| 275 if return_code == 3: | 275 if return_code == 3: |
| 276 # This is download failure, hence an infra failure. | 276 # This is download failure, hence an infra failure. |
| 277 # Sadly, python.failing_step doesn't support kwargs. | 277 # Sadly, python.failing_step doesn't support kwargs. |
| 278 self.m.python.inline( | 278 self.m.python.inline( |
| 279 'Patch failure', | 279 'Patch failure - Try Rebasing', |
| 280 ('import sys;' | 280 ('import sys;' |
| 281 'print "Patch download failed. See bot_update step for' | 281 'print "Patch download failed. See bot_update step for' |
| 282 ' details";sys.exit(1)'), | 282 ' details";sys.exit(1)'), |
| 283 infra_step=True, | 283 infra_step=True, |
| 284 step_test_data=lambda: self.m.raw_io.test_api.output( | 284 step_test_data=lambda: self.m.raw_io.test_api.output( |
| 285 'Patch download failed. See bot_update step for details', | 285 'Patch download failed. See bot_update step for details', |
| 286 retcode=1) | 286 retcode=1) |
| 287 ) | 287 ) |
| 288 else: | 288 else: |
| 289 # This is actual patch failure. | 289 # This is actual patch failure. |
| 290 self.m.tryserver.set_patch_failure_tryjob_result() | 290 self.m.tryserver.set_patch_failure_tryjob_result() |
| 291 self.m.python.failing_step( | 291 self.m.python.failing_step( |
| 292 'Patch failure', 'Check the bot_update step for details') | 292 'Patch failure', 'Check the bot_update step for details') |
| 293 | 293 |
| 294 # bot_update actually just sets root to be the folder name of the | 294 # bot_update actually just sets root to be the folder name of the |
| 295 # first solution. | 295 # first solution. |
| 296 if step_result.json.output['did_run']: | 296 if step_result.json.output['did_run']: |
| 297 co_root = step_result.json.output['root'] | 297 co_root = step_result.json.output['root'] |
| 298 cwd = kwargs.get('cwd', self.m.path['slave_build']) | 298 cwd = kwargs.get('cwd', self.m.path['slave_build']) |
| 299 if 'checkout' not in self.m.path: | 299 if 'checkout' not in self.m.path: |
| 300 self.m.path['checkout'] = cwd.join(*co_root.split(self.m.path.sep)) | 300 self.m.path['checkout'] = cwd.join(*co_root.split(self.m.path.sep)) |
| 301 | 301 |
| 302 return step_result | 302 return step_result |
| OLD | NEW |