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 return self.m.python(name, bot_update_path, cmd, **kwargs) | 50 return self.m.python(name, bot_update_path, cmd, **kwargs) |
51 | 51 |
52 @property | 52 @property |
53 def last_returned_properties(self): | 53 def last_returned_properties(self): |
54 return self._last_returned_properties | 54 return self._last_returned_properties |
55 | 55 |
56 def ensure_checkout(self, gclient_config=None, suffix=None, | 56 def ensure_checkout(self, gclient_config=None, suffix=None, |
57 patch=True, update_presentation=True, | 57 patch=True, update_presentation=True, |
58 force=False, patch_root=None, no_shallow=False, | 58 force=False, patch_root=None, no_shallow=False, |
59 with_branch_heads=False, refs=None, | 59 with_branch_heads=False, refs=None, |
60 patch_project_roots=None, patch_oauth2=False, | 60 patch_oauth2=False, |
61 output_manifest=True, clobber=False, | 61 output_manifest=True, clobber=False, |
62 root_solution_revision=None, rietveld=None, issue=None, | 62 root_solution_revision=None, rietveld=None, issue=None, |
63 patchset=None, gerrit_no_reset=False, **kwargs): | 63 patchset=None, gerrit_no_reset=False, **kwargs): |
64 """ | 64 """ |
65 Args: | 65 Args: |
66 gclient_config: The gclient configuration to use when running bot_update. | 66 gclient_config: The gclient configuration to use when running bot_update. |
67 If omitted, the current gclient configuration is used. | 67 If omitted, the current gclient configuration is used. |
68 rietveld: The rietveld server to use. If omitted, will infer from | 68 rietveld: The rietveld server to use. If omitted, will infer from |
69 the 'rietveld' property. | 69 the 'rietveld' property. |
70 issue: The rietveld issue number to use. If omitted, will infer from | 70 issue: The rietveld issue number to use. If omitted, will infer from |
71 the 'issue' property. | 71 the 'issue' property. |
72 patchset: The rietveld issue patchset to use. If omitted, will infer from | 72 patchset: The rietveld issue patchset to use. If omitted, will infer from |
73 the 'patchset' property. | 73 the 'patchset' property. |
74 """ | 74 """ |
75 refs = refs or [] | 75 refs = refs or [] |
76 # 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 |
77 # data bot_update needs is already configured into the gclient spec. | 77 # data bot_update needs is already configured into the gclient spec. |
78 cfg = gclient_config or self.m.gclient.c | 78 cfg = gclient_config or self.m.gclient.c |
79 | 79 |
80 # Used by bot_update to determine if we want to run or not. | 80 # Used by bot_update to determine if we want to run or not. |
81 master = self._mastername | 81 master = self._mastername |
82 builder = self._buildername | 82 builder = self._buildername |
83 slave = self._slavename | 83 slave = self._slavename |
84 | 84 |
85 # Construct our bot_update command. This basically be inclusive of | 85 # Construct our bot_update command. This basically be inclusive of |
86 # everything required for bot_update to know: | 86 # everything required for bot_update to know: |
87 root = patch_root | 87 root = patch_root |
88 if (root == 'TODO(TANDRII): REMOVE THIS TRANSITION TO patch_projects' or | 88 if root is None: |
89 root is None): | |
90 # This special condition is here for initial rollout of this code, | |
91 # because it's hard to test this change without rolling into build | |
92 # repository. | |
93 # After the switch to new code is complete, this special TODOstring will | |
94 # be removed in favor of "root is None" | |
95 assert patch_project_roots is None | |
96 root = self.m.gclient.calculate_patch_root( | 89 root = self.m.gclient.calculate_patch_root( |
97 self.m.properties.get('patch_project'), cfg) | 90 self.m.properties.get('patch_project'), cfg) |
98 | 91 |
99 if patch: | 92 if patch: |
100 issue = issue or self._issue | 93 issue = issue or self._issue |
101 patchset = patchset or self._patchset | 94 patchset = patchset or self._patchset |
102 patch_url = self._patch_url | 95 patch_url = self._patch_url |
103 gerrit_repo = self._repository | 96 gerrit_repo = self._repository |
104 gerrit_ref = self._gerrit_ref | 97 gerrit_ref = self._gerrit_ref |
105 else: | 98 else: |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 | 274 |
282 # bot_update actually just sets root to be the folder name of the | 275 # bot_update actually just sets root to be the folder name of the |
283 # first solution. | 276 # first solution. |
284 if step_result.json.output['did_run']: | 277 if step_result.json.output['did_run']: |
285 co_root = step_result.json.output['root'] | 278 co_root = step_result.json.output['root'] |
286 cwd = kwargs.get('cwd', self.m.path['slave_build']) | 279 cwd = kwargs.get('cwd', self.m.path['slave_build']) |
287 if 'checkout' not in self.m.path: | 280 if 'checkout' not in self.m.path: |
288 self.m.path['checkout'] = cwd.join(*co_root.split(self.m.path.sep)) | 281 self.m.path['checkout'] = cwd.join(*co_root.split(self.m.path.sep)) |
289 | 282 |
290 return step_result | 283 return step_result |
OLD | NEW |