| OLD | NEW |
| 1 # Copyright 2016 The Chromium Authors. All rights reserved. | 1 # Copyright 2016 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 from recipe_engine import recipe_api | 5 from recipe_engine import recipe_api |
| 6 | 6 |
| 7 | 7 |
| 8 class ChromiumCheckoutApi(recipe_api.RecipeApi): | 8 class ChromiumCheckoutApi(recipe_api.RecipeApi): |
| 9 def __init__(self, *args, **kwargs): | 9 def __init__(self, *args, **kwargs): |
| 10 super(ChromiumCheckoutApi, self).__init__(*args, **kwargs) | 10 super(ChromiumCheckoutApi, self).__init__(*args, **kwargs) |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 self.m.properties.get('patch_project')) | 47 self.m.properties.get('patch_project')) |
| 48 if not cwd and self.working_dir: | 48 if not cwd and self.working_dir: |
| 49 cwd = self.working_dir.join(patch_root) | 49 cwd = self.working_dir.join(patch_root) |
| 50 files = self.m.tryserver.get_files_affected_by_patch(patch_root, cwd=cwd) | 50 files = self.m.tryserver.get_files_affected_by_patch(patch_root, cwd=cwd) |
| 51 for i, path in enumerate(files): | 51 for i, path in enumerate(files): |
| 52 path = str(path) | 52 path = str(path) |
| 53 assert path.startswith(relative_to) | 53 assert path.startswith(relative_to) |
| 54 files[i] = path[len(relative_to):] | 54 files[i] = path[len(relative_to):] |
| 55 return files | 55 return files |
| 56 | 56 |
| 57 def ensure_checkout(self, bot_config, root_solution_revision=None, | 57 def ensure_checkout(self, bot_config, root_solution_revision=None): |
| 58 force=False): | |
| 59 """Wrapper for bot_update.ensure_checkout with chromium-specific additions. | 58 """Wrapper for bot_update.ensure_checkout with chromium-specific additions. |
| 60 """ | 59 """ |
| 61 if self.m.platform.is_win: | 60 if self.m.platform.is_win: |
| 62 self.m.chromium.taskkill() | 61 self.m.chromium.taskkill() |
| 63 | 62 |
| 64 kwargs = {} | 63 kwargs = {} |
| 65 self._working_dir = self.get_checkout_dir(bot_config) | 64 self._working_dir = self.get_checkout_dir(bot_config) |
| 66 if self._working_dir: | 65 if self._working_dir: |
| 67 kwargs['cwd'] = self._working_dir | 66 kwargs['cwd'] = self._working_dir |
| 68 | 67 |
| 69 if self.m.platform.is_linux: | 68 if self.m.platform.is_linux: |
| 70 kwargs['env'] = {'GCLIENT_KILL_GIT_FETCH_AFTER': '1200'} # 20 minutes. | 69 kwargs['env'] = {'GCLIENT_KILL_GIT_FETCH_AFTER': '1200'} # 20 minutes. |
| 71 | 70 |
| 72 # Bot Update re-uses the gclient configs. | 71 # Bot Update re-uses the gclient configs. |
| 73 update_step = self.m.bot_update.ensure_checkout( | 72 update_step = self.m.bot_update.ensure_checkout( |
| 74 patch_root=bot_config.get('patch_root'), | 73 patch_root=bot_config.get('patch_root'), |
| 75 root_solution_revision=root_solution_revision, | 74 root_solution_revision=root_solution_revision, |
| 76 clobber=bot_config.get('clobber', False), | 75 clobber=bot_config.get('clobber', False), |
| 77 force=force, **kwargs) | 76 **kwargs) |
| 78 assert update_step.json.output['did_run'] | 77 assert update_step.json.output['did_run'] |
| 79 # HACK(dnj): Remove after 'crbug.com/398105' has landed | 78 # HACK(dnj): Remove after 'crbug.com/398105' has landed |
| 80 self.m.chromium.set_build_properties(update_step.json.output['properties']) | 79 self.m.chromium.set_build_properties(update_step.json.output['properties']) |
| 81 | 80 |
| 82 return update_step | 81 return update_step |
| OLD | NEW |