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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 return self.m.python(name, bot_update_path, cmd, **kwargs) | 43 return self.m.python(name, bot_update_path, cmd, **kwargs) |
44 | 44 |
45 @property | 45 @property |
46 def last_returned_properties(self): | 46 def last_returned_properties(self): |
47 return self._last_returned_properties | 47 return self._last_returned_properties |
48 | 48 |
49 # DO NOT USE. | 49 # DO NOT USE. |
50 # The below method will be removed after there are no more callers of | 50 # The below method will be removed after there are no more callers of |
51 # tryserver.maybe_apply_issue (skbug.com/5588). | 51 # tryserver.maybe_apply_issue (skbug.com/5588). |
52 def apply_gerrit_ref(self, root, gerrit_no_reset=False, | 52 def apply_gerrit_ref(self, root, gerrit_no_reset=False, |
53 gerrit_no_rebase_patch_ref=False, | 53 gerrit_no_rebase_patch_ref=False, **kwargs): |
54 gerrit_rebase_patch_ref=True, **kwargs): | |
55 apply_gerrit_path = self.resource('apply_gerrit.py') | 54 apply_gerrit_path = self.resource('apply_gerrit.py') |
56 kwargs.setdefault('infra_step', True) | 55 kwargs.setdefault('infra_step', True) |
57 kwargs.setdefault('env', {}).setdefault('PATH', '%(PATH)s') | 56 kwargs.setdefault('env', {}).setdefault('PATH', '%(PATH)s') |
58 kwargs['env']['PATH'] = self.m.path.pathsep.join([ | 57 kwargs['env']['PATH'] = self.m.path.pathsep.join([ |
59 kwargs['env']['PATH'], str(self._module.PACKAGE_REPO_ROOT)]) | 58 kwargs['env']['PATH'], str(self._module.PACKAGE_REPO_ROOT)]) |
60 cmd = [ | 59 cmd = [ |
61 '--gerrit_repo', self._repository, | 60 '--gerrit_repo', self._repository, |
62 '--gerrit_ref', self._gerrit_ref or '', | 61 '--gerrit_ref', self._gerrit_ref or '', |
63 '--root', str(root), | 62 '--root', str(root), |
64 ] | 63 ] |
65 if gerrit_no_reset: | 64 if gerrit_no_reset: |
66 cmd.append('--gerrit_no_reset') | 65 cmd.append('--gerrit_no_reset') |
67 if gerrit_no_rebase_patch_ref or not gerrit_rebase_patch_ref: | 66 if gerrit_no_rebase_patch_ref: |
68 cmd.append('--gerrit_no_rebase_patch_ref') | 67 cmd.append('--gerrit_no_rebase_patch_ref') |
69 return self.m.python('apply_gerrit', apply_gerrit_path, cmd, **kwargs) | 68 return self.m.python('apply_gerrit', apply_gerrit_path, cmd, **kwargs) |
70 | 69 |
71 def ensure_checkout(self, gclient_config=None, suffix=None, | 70 def ensure_checkout(self, gclient_config=None, suffix=None, |
72 patch=True, update_presentation=True, | 71 patch=True, update_presentation=True, |
73 force=False, patch_root=None, no_shallow=False, | 72 force=False, patch_root=None, no_shallow=False, |
74 with_branch_heads=False, refs=None, | 73 with_branch_heads=False, refs=None, |
75 patch_oauth2=False, use_site_config_creds=True, | 74 patch_oauth2=False, use_site_config_creds=True, |
76 output_manifest=True, clobber=False, | 75 output_manifest=True, clobber=False, |
77 root_solution_revision=None, rietveld=None, issue=None, | 76 root_solution_revision=None, rietveld=None, issue=None, |
78 patchset=None, gerrit_no_reset=False, | 77 patchset=None, gerrit_no_reset=False, |
79 gerrit_no_rebase_patch_ref=False, | 78 gerrit_no_rebase_patch_ref=False, **kwargs): |
80 gerrit_rebase_patch_ref=True, **kwargs): | |
81 """ | 79 """ |
82 Args: | 80 Args: |
83 use_site_config_creds: If the oauth2 credentials are in the buildbot | 81 use_site_config_creds: If the oauth2 credentials are in the buildbot |
84 site_config. See crbug.com/624212 for more information. | 82 site_config. See crbug.com/624212 for more information. |
85 gclient_config: The gclient configuration to use when running bot_update. | 83 gclient_config: The gclient configuration to use when running bot_update. |
86 If omitted, the current gclient configuration is used. | 84 If omitted, the current gclient configuration is used. |
87 rietveld: The rietveld server to use. If omitted, will infer from | 85 rietveld: The rietveld server to use. If omitted, will infer from |
88 the 'rietveld' property. | 86 the 'rietveld' property. |
89 issue: The rietveld issue number to use. If omitted, will infer from | 87 issue: The rietveld issue number to use. If omitted, will infer from |
90 the 'issue' property. | 88 the 'issue' property. |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 if force: | 224 if force: |
227 cmd.append('--force') | 225 cmd.append('--force') |
228 if no_shallow: | 226 if no_shallow: |
229 cmd.append('--no_shallow') | 227 cmd.append('--no_shallow') |
230 if output_manifest: | 228 if output_manifest: |
231 cmd.append('--output_manifest') | 229 cmd.append('--output_manifest') |
232 if with_branch_heads or cfg.with_branch_heads: | 230 if with_branch_heads or cfg.with_branch_heads: |
233 cmd.append('--with_branch_heads') | 231 cmd.append('--with_branch_heads') |
234 if gerrit_no_reset: | 232 if gerrit_no_reset: |
235 cmd.append('--gerrit_no_reset') | 233 cmd.append('--gerrit_no_reset') |
236 if gerrit_no_rebase_patch_ref or not gerrit_rebase_patch_ref: | 234 if gerrit_no_rebase_patch_ref: |
237 cmd.append('--gerrit_no_rebase_patch_ref') | 235 cmd.append('--gerrit_no_rebase_patch_ref') |
238 | 236 |
239 # Inject Json output for testing. | 237 # Inject Json output for testing. |
240 first_sln = cfg.solutions[0].name | 238 first_sln = cfg.solutions[0].name |
241 step_test_data = lambda: self.test_api.output_json( | 239 step_test_data = lambda: self.test_api.output_json( |
242 master, builder, slave, root, first_sln, rev_map, force, | 240 master, builder, slave, root, first_sln, rev_map, force, |
243 self._fail_patch, | 241 self._fail_patch, |
244 output_manifest=output_manifest, fixed_revisions=fixed_revisions) | 242 output_manifest=output_manifest, fixed_revisions=fixed_revisions) |
245 | 243 |
246 # Add suffixes to the step name, if specified. | 244 # Add suffixes to the step name, if specified. |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
308 | 306 |
309 # bot_update actually just sets root to be the folder name of the | 307 # bot_update actually just sets root to be the folder name of the |
310 # first solution. | 308 # first solution. |
311 if step_result.json.output['did_run']: | 309 if step_result.json.output['did_run']: |
312 co_root = step_result.json.output['root'] | 310 co_root = step_result.json.output['root'] |
313 cwd = kwargs.get('cwd', self.m.path['slave_build']) | 311 cwd = kwargs.get('cwd', self.m.path['slave_build']) |
314 if 'checkout' not in self.m.path: | 312 if 'checkout' not in self.m.path: |
315 self.m.path['checkout'] = cwd.join(*co_root.split(self.m.path.sep)) | 313 self.m.path['checkout'] = cwd.join(*co_root.split(self.m.path.sep)) |
316 | 314 |
317 return step_result | 315 return step_result |
OLD | NEW |