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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 | 50 |
51 def __init__(self, *args, **kwargs): | 51 def __init__(self, *args, **kwargs): |
52 self._properties = {} | 52 self._properties = {} |
53 super(BotUpdateApi, self).__init__(*args, **kwargs) | 53 super(BotUpdateApi, self).__init__(*args, **kwargs) |
54 | 54 |
55 def __call__(self, name, cmd, **kwargs): | 55 def __call__(self, name, cmd, **kwargs): |
56 """Wrapper for easy calling of bot_update.""" | 56 """Wrapper for easy calling of bot_update.""" |
57 assert isinstance(cmd, (list, tuple)) | 57 assert isinstance(cmd, (list, tuple)) |
58 bot_update_path = self.resource('bot_update.py') | 58 bot_update_path = self.resource('bot_update.py') |
59 kwargs.setdefault('infra_step', True) | 59 kwargs.setdefault('infra_step', True) |
| 60 kwargs.setdefault('env', {}) |
| 61 kwargs['env'].setdefault('PATH', '%(PATH)s') |
| 62 kwargs['env']['PATH'] = self.m.path.pathsep.join([ |
| 63 str(self._module.PACKAGE_DIRECTORY), kwargs['env']['PATH']]) |
60 return self.m.python(name, bot_update_path, cmd, **kwargs) | 64 return self.m.python(name, bot_update_path, cmd, **kwargs) |
61 | 65 |
62 @property | 66 @property |
63 def properties(self): | 67 def properties(self): |
64 return self._properties | 68 return self._properties |
65 | 69 |
66 def ensure_checkout(self, gclient_config=None, suffix=None, | 70 def ensure_checkout(self, gclient_config=None, suffix=None, |
67 patch=True, update_presentation=True, | 71 patch=True, update_presentation=True, |
68 force=False, patch_root=None, no_shallow=False, | 72 force=False, patch_root=None, no_shallow=False, |
69 with_branch_heads=False, refs=None, | 73 with_branch_heads=False, refs=None, |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 | 272 |
269 # bot_update actually just sets root to be the folder name of the | 273 # bot_update actually just sets root to be the folder name of the |
270 # first solution. | 274 # first solution. |
271 if step_result.json.output['did_run']: | 275 if step_result.json.output['did_run']: |
272 co_root = step_result.json.output['root'] | 276 co_root = step_result.json.output['root'] |
273 cwd = kwargs.get('cwd', self.m.path['slave_build']) | 277 cwd = kwargs.get('cwd', self.m.path['slave_build']) |
274 if 'checkout' not in self.m.path: | 278 if 'checkout' not in self.m.path: |
275 self.m.path['checkout'] = cwd.join(*co_root.split(self.m.path.sep)) | 279 self.m.path['checkout'] = cwd.join(*co_root.split(self.m.path.sep)) |
276 | 280 |
277 return step_result | 281 return step_result |
OLD | NEW |