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']]) | |
64 return self.m.python(name, bot_update_path, cmd, **kwargs) | 60 return self.m.python(name, bot_update_path, cmd, **kwargs) |
65 | 61 |
66 @property | 62 @property |
67 def properties(self): | 63 def properties(self): |
68 return self._properties | 64 return self._properties |
69 | 65 |
70 def ensure_checkout(self, gclient_config=None, suffix=None, | 66 def ensure_checkout(self, gclient_config=None, suffix=None, |
71 patch=True, update_presentation=True, | 67 patch=True, update_presentation=True, |
72 force=False, patch_root=None, no_shallow=False, | 68 force=False, patch_root=None, no_shallow=False, |
73 with_branch_heads=False, refs=None, | 69 with_branch_heads=False, refs=None, |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 | 268 |
273 # bot_update actually just sets root to be the folder name of the | 269 # bot_update actually just sets root to be the folder name of the |
274 # first solution. | 270 # first solution. |
275 if step_result.json.output['did_run']: | 271 if step_result.json.output['did_run']: |
276 co_root = step_result.json.output['root'] | 272 co_root = step_result.json.output['root'] |
277 cwd = kwargs.get('cwd', self.m.path['slave_build']) | 273 cwd = kwargs.get('cwd', self.m.path['slave_build']) |
278 if 'checkout' not in self.m.path: | 274 if 'checkout' not in self.m.path: |
279 self.m.path['checkout'] = cwd.join(*co_root.split(self.m.path.sep)) | 275 self.m.path['checkout'] = cwd.join(*co_root.split(self.m.path.sep)) |
280 | 276 |
281 return step_result | 277 return step_result |
OLD | NEW |