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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 '--root', str(root), | 60 '--root', str(root), |
61 ] | 61 ] |
62 if gerrit_no_reset: | 62 if gerrit_no_reset: |
63 cmd.append('--gerrit_no_reset') | 63 cmd.append('--gerrit_no_reset') |
64 if gerrit_no_rebase_patch_ref: | 64 if gerrit_no_rebase_patch_ref: |
65 cmd.append('--gerrit_no_rebase_patch_ref') | 65 cmd.append('--gerrit_no_rebase_patch_ref') |
66 return self.m.python('apply_gerrit', apply_gerrit_path, cmd, **kwargs) | 66 return self.m.python('apply_gerrit', apply_gerrit_path, cmd, **kwargs) |
67 | 67 |
68 def ensure_checkout(self, gclient_config=None, suffix=None, | 68 def ensure_checkout(self, gclient_config=None, suffix=None, |
69 patch=True, update_presentation=True, | 69 patch=True, update_presentation=True, |
70 force=False, patch_root=None, no_shallow=False, | 70 patch_root=None, no_shallow=False, |
71 with_branch_heads=False, refs=None, | 71 with_branch_heads=False, refs=None, |
72 patch_oauth2=False, use_site_config_creds=True, | 72 patch_oauth2=False, use_site_config_creds=True, |
73 output_manifest=True, clobber=False, | 73 output_manifest=True, clobber=False, |
74 root_solution_revision=None, rietveld=None, issue=None, | 74 root_solution_revision=None, rietveld=None, issue=None, |
75 patchset=None, gerrit_no_reset=False, | 75 patchset=None, gerrit_no_reset=False, |
76 gerrit_no_rebase_patch_ref=False, **kwargs): | 76 gerrit_no_rebase_patch_ref=False, **kwargs): |
77 """ | 77 """ |
78 Args: | 78 Args: |
79 use_site_config_creds: If the oauth2 credentials are in the buildbot | 79 use_site_config_creds: If the oauth2 credentials are in the buildbot |
80 site_config. See crbug.com/624212 for more information. | 80 site_config. See crbug.com/624212 for more information. |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 # Add extra fetch refspecs. | 207 # Add extra fetch refspecs. |
208 for ref in refs: | 208 for ref in refs: |
209 flags.append(['--refs', ref]) | 209 flags.append(['--refs', ref]) |
210 | 210 |
211 # Filter out flags that are None. | 211 # Filter out flags that are None. |
212 cmd = [item for flag_set in flags | 212 cmd = [item for flag_set in flags |
213 for item in flag_set if flag_set[1] is not None] | 213 for item in flag_set if flag_set[1] is not None] |
214 | 214 |
215 if clobber: | 215 if clobber: |
216 cmd.append('--clobber') | 216 cmd.append('--clobber') |
217 if force: | |
218 cmd.append('--force') | |
219 if no_shallow: | 217 if no_shallow: |
220 cmd.append('--no_shallow') | 218 cmd.append('--no_shallow') |
221 if output_manifest: | 219 if output_manifest: |
222 cmd.append('--output_manifest') | 220 cmd.append('--output_manifest') |
223 if with_branch_heads or cfg.with_branch_heads: | 221 if with_branch_heads or cfg.with_branch_heads: |
224 cmd.append('--with_branch_heads') | 222 cmd.append('--with_branch_heads') |
225 if gerrit_no_reset: | 223 if gerrit_no_reset: |
226 cmd.append('--gerrit_no_reset') | 224 cmd.append('--gerrit_no_reset') |
227 if gerrit_no_rebase_patch_ref: | 225 if gerrit_no_rebase_patch_ref: |
228 cmd.append('--gerrit_no_rebase_patch_ref') | 226 cmd.append('--gerrit_no_rebase_patch_ref') |
229 | 227 |
230 # Inject Json output for testing. | 228 # Inject Json output for testing. |
231 first_sln = cfg.solutions[0].name | 229 first_sln = cfg.solutions[0].name |
232 step_test_data = lambda: self.test_api.output_json( | 230 step_test_data = lambda: self.test_api.output_json( |
233 master, builder, slave, root, first_sln, rev_map, force, | 231 master, builder, slave, root, first_sln, rev_map, self._fail_patch, |
234 self._fail_patch, | |
235 output_manifest=output_manifest, fixed_revisions=fixed_revisions) | 232 output_manifest=output_manifest, fixed_revisions=fixed_revisions) |
236 | 233 |
237 # Add suffixes to the step name, if specified. | 234 # Add suffixes to the step name, if specified. |
238 name = 'bot_update' | 235 name = 'bot_update' |
239 if not patch: | 236 if not patch: |
240 name += ' (without patch)' | 237 name += ' (without patch)' |
241 if suffix: | 238 if suffix: |
242 name += ' - %s' % suffix | 239 name += ' - %s' % suffix |
243 | 240 |
244 # Ah hah! Now that everything is in place, lets run bot_update! | 241 # Ah hah! Now that everything is in place, lets run bot_update! |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 | 296 |
300 # bot_update actually just sets root to be the folder name of the | 297 # bot_update actually just sets root to be the folder name of the |
301 # first solution. | 298 # first solution. |
302 if step_result.json.output['did_run']: | 299 if step_result.json.output['did_run']: |
303 co_root = step_result.json.output['root'] | 300 co_root = step_result.json.output['root'] |
304 cwd = kwargs.get('cwd', self.m.path['slave_build']) | 301 cwd = kwargs.get('cwd', self.m.path['slave_build']) |
305 if 'checkout' not in self.m.path: | 302 if 'checkout' not in self.m.path: |
306 self.m.path['checkout'] = cwd.join(*co_root.split(self.m.path.sep)) | 303 self.m.path['checkout'] = cwd.join(*co_root.split(self.m.path.sep)) |
307 | 304 |
308 return step_result | 305 return step_result |
OLD | NEW |