Chromium Code Reviews| 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 |
| 11 # This is just for testing, to indicate if a master is using a Git scheduler | 11 # This is just for testing, to indicate if a master is using a Git scheduler |
| 12 # or not. | 12 # or not. |
| 13 SVN_MASTERS = ( | 13 SVN_MASTERS = ( |
| 14 'experimental.svn', | 14 'experimental.svn', |
| 15 ) | 15 ) |
| 16 | 16 |
| 17 | 17 |
| 18 class BotUpdateApi(recipe_api.RecipeApi): | 18 class BotUpdateApi(recipe_api.RecipeApi): |
| 19 | 19 |
| 20 def __init__(self, mastername, buildername, slavename, issue, patchset, | 20 def __init__(self, mastername, buildername, slavename, issue, patchset, |
| 21 patch_url, repository, gerrit_ref, rietveld, revision, | 21 patch_url, repository, gerrit_ref, rietveld, revision, |
| 22 parent_got_revision, deps_revision_overrides, fail_patch, | 22 parent_got_revision, deps_revision_overrides, fail_patch, |
| 23 *args, **kwargs): | 23 lite, *args, **kwargs): |
| 24 self._mastername = mastername | 24 self._mastername = mastername |
| 25 self._buildername = buildername | 25 self._buildername = buildername |
| 26 self._slavename = slavename | 26 self._slavename = slavename |
| 27 self._issue = issue | 27 self._issue = issue |
| 28 self._patchset = patchset | 28 self._patchset = patchset |
| 29 self._patch_url = patch_url | 29 self._patch_url = patch_url |
| 30 self._repository = repository | 30 self._repository = repository |
| 31 self._gerrit_ref = gerrit_ref | 31 self._gerrit_ref = gerrit_ref |
| 32 self._rietveld = rietveld | 32 self._rietveld = rietveld |
| 33 self._revision = revision | 33 self._revision = revision |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 128 | 128 |
| 129 # Allow patch_project's revision if necessary. | 129 # Allow patch_project's revision if necessary. |
| 130 # This is important for projects which are checked out as DEPS of the | 130 # This is important for projects which are checked out as DEPS of the |
| 131 # gclient solution. | 131 # gclient solution. |
| 132 self.m.gclient.set_patch_project_revision( | 132 self.m.gclient.set_patch_project_revision( |
| 133 self.m.properties.get('patch_project'), cfg) | 133 self.m.properties.get('patch_project'), cfg) |
| 134 | 134 |
| 135 rev_map = cfg.got_revision_mapping.as_jsonish() | 135 rev_map = cfg.got_revision_mapping.as_jsonish() |
| 136 | 136 |
| 137 flags = [ | 137 flags = [ |
| 138 # 1. Do we want to run? (master/builder/slave). | 138 # 1. What do we want to check out (spec/root/rev/rev_map). |
| 139 ['--master', master], | |
| 140 ['--builder', builder], | |
| 141 ['--slave', slave], | |
| 142 | |
| 143 # 2. What do we want to check out (spec/root/rev/rev_map). | |
| 144 ['--spec', self.m.gclient.config_to_pythonish(cfg)], | 139 ['--spec', self.m.gclient.config_to_pythonish(cfg)], |
| 145 ['--root', root], | 140 ['--root', root], |
| 146 ['--revision_mapping_file', self.m.json.input(rev_map)], | 141 ['--revision_mapping_file', self.m.json.input(rev_map)], |
| 147 ['--git-cache-dir', cfg.cache_dir], | 142 ['--git-cache-dir', cfg.cache_dir], |
| 148 | 143 |
| 149 # 3. How to find the patch, if any (issue/patchset/patch_url). | 144 # 2. How to find the patch, if any (issue/patchset/patch_url). |
| 150 ['--issue', issue], | 145 ['--issue', issue], |
| 151 ['--patchset', patchset], | 146 ['--patchset', patchset], |
| 152 ['--patch_url', patch_url], | 147 ['--patch_url', patch_url], |
| 153 ['--rietveld_server', rietveld or self._rietveld], | 148 ['--rietveld_server', rietveld or self._rietveld], |
| 154 ['--gerrit_repo', gerrit_repo], | 149 ['--gerrit_repo', gerrit_repo], |
| 155 ['--gerrit_ref', gerrit_ref], | 150 ['--gerrit_ref', gerrit_ref], |
| 156 ['--apply_issue_email_file', email_file], | 151 ['--apply_issue_email_file', email_file], |
| 157 ['--apply_issue_key_file', key_file], | 152 ['--apply_issue_key_file', key_file], |
| 158 | 153 |
| 159 # 4. Hookups to JSON output back into recipes. | 154 # 3. Hookups to JSON output back into recipes. |
| 160 ['--output_json', self.m.json.output()],] | 155 ['--output_json', self.m.json.output()],] |
| 161 | 156 |
| 162 | 157 |
| 163 # Collect all fixed revisions to simulate them in the json output. | 158 # Collect all fixed revisions to simulate them in the json output. |
| 164 # Fixed revision are the explicit input revisions of bot_update.py, i.e. | 159 # Fixed revision are the explicit input revisions of bot_update.py, i.e. |
| 165 # every command line parameter "--revision name@value". | 160 # every command line parameter "--revision name@value". |
| 166 fixed_revisions = {} | 161 fixed_revisions = {} |
| 167 | 162 |
| 168 revisions = {} | 163 revisions = {} |
| 169 for solution in cfg.solutions: | 164 for solution in cfg.solutions: |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 189 # Add extra fetch refspecs. | 184 # Add extra fetch refspecs. |
| 190 for ref in refs: | 185 for ref in refs: |
| 191 flags.append(['--refs', ref]) | 186 flags.append(['--refs', ref]) |
| 192 | 187 |
| 193 # Filter out flags that are None. | 188 # Filter out flags that are None. |
| 194 cmd = [item for flag_set in flags | 189 cmd = [item for flag_set in flags |
| 195 for item in flag_set if flag_set[1] is not None] | 190 for item in flag_set if flag_set[1] is not None] |
| 196 | 191 |
| 197 if clobber: | 192 if clobber: |
| 198 cmd.append('--clobber') | 193 cmd.append('--clobber') |
| 199 if force: | 194 if force and not self._lite: |
|
nodir
2016/05/27 21:09:18
let's remove force and lite properties
hinoka
2016/05/27 21:13:43
Done. Good catch
| |
| 200 cmd.append('--force') | 195 cmd.append('--force') |
| 201 if no_shallow: | 196 if no_shallow: |
| 202 cmd.append('--no_shallow') | 197 cmd.append('--no_shallow') |
| 203 if output_manifest: | 198 if output_manifest: |
| 204 cmd.append('--output_manifest') | 199 cmd.append('--output_manifest') |
| 205 if with_branch_heads or cfg.with_branch_heads: | 200 if with_branch_heads or cfg.with_branch_heads: |
| 206 cmd.append('--with_branch_heads') | 201 cmd.append('--with_branch_heads') |
| 207 if gerrit_no_reset: | 202 if gerrit_no_reset: |
| 208 cmd.append('--gerrit_no_reset') | 203 cmd.append('--gerrit_no_reset') |
| 209 | 204 |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 274 | 269 |
| 275 # bot_update actually just sets root to be the folder name of the | 270 # bot_update actually just sets root to be the folder name of the |
| 276 # first solution. | 271 # first solution. |
| 277 if step_result.json.output['did_run']: | 272 if step_result.json.output['did_run']: |
| 278 co_root = step_result.json.output['root'] | 273 co_root = step_result.json.output['root'] |
| 279 cwd = kwargs.get('cwd', self.m.path['slave_build']) | 274 cwd = kwargs.get('cwd', self.m.path['slave_build']) |
| 280 if 'checkout' not in self.m.path: | 275 if 'checkout' not in self.m.path: |
| 281 self.m.path['checkout'] = cwd.join(*co_root.split(self.m.path.sep)) | 276 self.m.path['checkout'] = cwd.join(*co_root.split(self.m.path.sep)) |
| 282 | 277 |
| 283 return step_result | 278 return step_result |
| OLD | NEW |