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 | 8 |
9 from slave import recipe_api | 9 from slave import recipe_api |
10 from slave import recipe_util | 10 from slave import recipe_util |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 return self.m.python(name, bot_update_path, cmd, **kwargs) | 63 return self.m.python(name, bot_update_path, cmd, **kwargs) |
64 | 64 |
65 @property | 65 @property |
66 def properties(self): | 66 def properties(self): |
67 return self._properties | 67 return self._properties |
68 | 68 |
69 def ensure_checkout(self, gclient_config=None, suffix=None, | 69 def ensure_checkout(self, gclient_config=None, suffix=None, |
70 patch=True, update_presentation=True, | 70 patch=True, update_presentation=True, |
71 force=False, patch_root=None, no_shallow=False, | 71 force=False, patch_root=None, no_shallow=False, |
72 with_branch_heads=False, refs=None, | 72 with_branch_heads=False, refs=None, |
73 patch_project_roots=None, patch_oauth2=False, **kwargs): | 73 patch_project_roots=None, patch_oauth2=False, |
| 74 output_manifest=False, **kwargs): |
74 refs = refs or [] | 75 refs = refs or [] |
75 # We can re-use the gclient spec from the gclient module, since all the | 76 # We can re-use the gclient spec from the gclient module, since all the |
76 # data bot_update needs is already configured into the gclient spec. | 77 # data bot_update needs is already configured into the gclient spec. |
77 cfg = gclient_config or self.m.gclient.c | 78 cfg = gclient_config or self.m.gclient.c |
78 spec_string = jsonish_to_python(cfg.as_jsonish(), True) | 79 spec_string = jsonish_to_python(cfg.as_jsonish(), True) |
79 | 80 |
80 # Used by bot_update to determine if we want to run or not. | 81 # Used by bot_update to determine if we want to run or not. |
81 master = self.m.properties['mastername'] | 82 master = self.m.properties['mastername'] |
82 builder = self.m.properties['buildername'] | 83 builder = self.m.properties['buildername'] |
83 slave = self.m.properties['slavename'] | 84 slave = self.m.properties['slavename'] |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 flags.append(['--refs', ref]) | 167 flags.append(['--refs', ref]) |
167 | 168 |
168 # Filter out flags that are None. | 169 # Filter out flags that are None. |
169 cmd = [item for flag_set in flags | 170 cmd = [item for flag_set in flags |
170 for item in flag_set if flag_set[1] is not None] | 171 for item in flag_set if flag_set[1] is not None] |
171 | 172 |
172 if force: | 173 if force: |
173 cmd.append('--force') | 174 cmd.append('--force') |
174 if no_shallow: | 175 if no_shallow: |
175 cmd.append('--no_shallow') | 176 cmd.append('--no_shallow') |
| 177 if output_manifest: |
| 178 cmd.append('--output_manifest') |
176 if with_branch_heads: | 179 if with_branch_heads: |
177 cmd.append('--with_branch_heads') | 180 cmd.append('--with_branch_heads') |
178 | 181 |
179 # Inject Json output for testing. | 182 # Inject Json output for testing. |
180 git_mode = self.m.properties.get('mastername') not in SVN_MASTERS | 183 git_mode = self.m.properties.get('mastername') not in SVN_MASTERS |
181 first_sln = cfg.solutions[0].name | 184 first_sln = cfg.solutions[0].name |
182 step_test_data = lambda: self.test_api.output_json( | 185 step_test_data = lambda: self.test_api.output_json( |
183 master, builder, slave, root, first_sln, rev_map, git_mode, force, | 186 master, builder, slave, root, first_sln, rev_map, git_mode, force, |
184 self.m.properties.get('fail_patch', False)) | 187 self.m.properties.get('fail_patch', False), |
| 188 output_manifest=output_manifest) |
185 | 189 |
186 # Add suffixes to the step name, if specified. | 190 # Add suffixes to the step name, if specified. |
187 name = 'bot_update' | 191 name = 'bot_update' |
188 if not patch: | 192 if not patch: |
189 name += ' (without patch)' | 193 name += ' (without patch)' |
190 if suffix: | 194 if suffix: |
191 name += ' - %s' % suffix | 195 name += ' - %s' % suffix |
192 | 196 |
193 # Ah hah! Now that everything is in place, lets run bot_update! | 197 # Ah hah! Now that everything is in place, lets run bot_update! |
194 try: | 198 try: |
(...skipping 30 matching lines...) Expand all Loading... |
225 | 229 |
226 # bot_update actually just sets root to be the folder name of the | 230 # bot_update actually just sets root to be the folder name of the |
227 # first solution. | 231 # first solution. |
228 if step_result.json.output['did_run']: | 232 if step_result.json.output['did_run']: |
229 co_root = step_result.json.output['root'] | 233 co_root = step_result.json.output['root'] |
230 cwd = kwargs.get('cwd', self.m.path['slave_build']) | 234 cwd = kwargs.get('cwd', self.m.path['slave_build']) |
231 if 'checkout' not in self.m.path: | 235 if 'checkout' not in self.m.path: |
232 self.m.path['checkout'] = cwd.join(*co_root.split(self.m.path.sep)) | 236 self.m.path['checkout'] = cwd.join(*co_root.split(self.m.path.sep)) |
233 | 237 |
234 return step_result | 238 return step_result |
OLD | NEW |