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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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': | 88 if (root == 'TODO(TANDRII): REMOVE THIS TRANSITION TO patch_projects' or |
| 89 root is None): |
89 # This special condition is here for initial rollout of this code, | 90 # This special condition is here for initial rollout of this code, |
90 # because it's hard to test this change without rolling into build | 91 # because it's hard to test this change without rolling into build |
91 # repository. | 92 # repository. |
92 # After the switch to new code is complete, this special TODOstring will | 93 # After the switch to new code is complete, this special TODOstring will |
93 # be removed in favor of "root is None" | 94 # be removed in favor of "root is None" |
94 assert patch_project_roots is None | 95 assert patch_project_roots is None |
95 root = self.m.gclient.calculate_patch_root( | 96 root = self.m.gclient.calculate_patch_root( |
96 self.m.properties.get('patch_project'), cfg) | 97 self.m.properties.get('patch_project'), cfg) |
97 # TODO(tandrii): get rid the condition below after transition. | |
98 | |
99 if root is None: | |
100 root = cfg.solutions[0].name | |
101 additional = self.m.rietveld.calculate_issue_root(patch_project_roots) | |
102 if additional: | |
103 root = self.m.path.join(root, additional) | |
104 | 98 |
105 if patch: | 99 if patch: |
106 issue = issue or self._issue | 100 issue = issue or self._issue |
107 patchset = patchset or self._patchset | 101 patchset = patchset or self._patchset |
108 patch_url = self._patch_url | 102 patch_url = self._patch_url |
109 gerrit_repo = self._repository | 103 gerrit_repo = self._repository |
110 gerrit_ref = self._gerrit_ref | 104 gerrit_ref = self._gerrit_ref |
111 else: | 105 else: |
112 # The trybot recipe sometimes wants to de-apply the patch. In which case | 106 # The trybot recipe sometimes wants to de-apply the patch. In which case |
113 # we pretend the issue/patchset/patch_url never existed. | 107 # we pretend the issue/patchset/patch_url never existed. |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 | 281 |
288 # bot_update actually just sets root to be the folder name of the | 282 # bot_update actually just sets root to be the folder name of the |
289 # first solution. | 283 # first solution. |
290 if step_result.json.output['did_run']: | 284 if step_result.json.output['did_run']: |
291 co_root = step_result.json.output['root'] | 285 co_root = step_result.json.output['root'] |
292 cwd = kwargs.get('cwd', self.m.path['slave_build']) | 286 cwd = kwargs.get('cwd', self.m.path['slave_build']) |
293 if 'checkout' not in self.m.path: | 287 if 'checkout' not in self.m.path: |
294 self.m.path['checkout'] = cwd.join(*co_root.split(self.m.path.sep)) | 288 self.m.path['checkout'] = cwd.join(*co_root.split(self.m.path.sep)) |
295 | 289 |
296 return step_result | 290 return step_result |
OLD | NEW |