OLD | NEW |
1 # Copyright 2013 The Chromium Authors. All rights reserved. | 1 # Copyright 2013 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 from recipe_engine import recipe_api | 5 from recipe_engine import recipe_api |
6 | 6 |
7 | 7 |
8 class RevisionResolver(object): | 8 class RevisionResolver(object): |
9 """Resolves the revision based on build properties.""" | 9 """Resolves the revision based on build properties.""" |
10 | 10 |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 def spec_alias(self, name): | 127 def spec_alias(self, name): |
128 self._spec_alias = name | 128 self._spec_alias = name |
129 | 129 |
130 @spec_alias.deleter | 130 @spec_alias.deleter |
131 def spec_alias(self): | 131 def spec_alias(self): |
132 self._spec_alias = None | 132 self._spec_alias = None |
133 | 133 |
134 def get_config_defaults(self): | 134 def get_config_defaults(self): |
135 return { | 135 return { |
136 'USE_MIRROR': self.use_mirror, | 136 'USE_MIRROR': self.use_mirror, |
137 'CACHE_DIR': self.m.path['git_cache'], | 137 'CACHE_DIR': self.m.infra_paths['git_cache'], |
138 } | 138 } |
139 | 139 |
140 @staticmethod | 140 @staticmethod |
141 def config_to_pythonish(cfg): | 141 def config_to_pythonish(cfg): |
142 return jsonish_to_python(cfg.as_jsonish(), True) | 142 return jsonish_to_python(cfg.as_jsonish(), True) |
143 | 143 |
144 def resolve_revision(self, revision): | 144 def resolve_revision(self, revision): |
145 if hasattr(revision, 'resolve'): | 145 if hasattr(revision, 'resolve'): |
146 return revision.resolve(self.m.properties) | 146 return revision.resolve(self.m.properties) |
147 return revision | 147 return revision |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 | 268 |
269 cfg_cmds = [ | 269 cfg_cmds = [ |
270 ('user.name', 'local_bot'), | 270 ('user.name', 'local_bot'), |
271 ('user.email', 'local_bot@example.com'), | 271 ('user.email', 'local_bot@example.com'), |
272 ] | 272 ] |
273 for var, val in cfg_cmds: | 273 for var, val in cfg_cmds: |
274 name = 'recurse (git config %s)' % var | 274 name = 'recurse (git config %s)' % var |
275 self(name, ['recurse', 'git', 'config', var, val], **kwargs) | 275 self(name, ['recurse', 'git', 'config', var, val], **kwargs) |
276 | 276 |
277 finally: | 277 finally: |
278 cwd = kwargs.get('cwd', self.m.path['slave_build']) | 278 cwd = kwargs.get('cwd', self.m.infra_paths['slave_build']) |
279 if 'checkout' not in self.m.path: | 279 if 'checkout' not in self.m.path: |
280 self.m.path['checkout'] = cwd.join( | 280 self.m.path['checkout'] = cwd.join( |
281 *cfg.solutions[0].name.split(self.m.path.sep)) | 281 *cfg.solutions[0].name.split(self.m.path.sep)) |
282 | 282 |
283 return sync_step | 283 return sync_step |
284 | 284 |
285 def revert(self, **kwargs): | 285 def revert(self, **kwargs): |
286 """Return a gclient_safe_revert step.""" | 286 """Return a gclient_safe_revert step.""" |
287 # Not directly calling gclient, so don't use self(). | 287 # Not directly calling gclient, so don't use self(). |
288 alias = self.spec_alias | 288 alias = self.spec_alias |
289 prefix = '%sgclient ' % (('[spec: %s] ' % alias) if alias else '') | 289 prefix = '%sgclient ' % (('[spec: %s] ' % alias) if alias else '') |
290 | 290 |
291 return self.m.python(prefix + 'revert', | 291 return self.m.python(prefix + 'revert', |
292 self.m.path['build'].join('scripts', 'slave', 'gclient_safe_revert.py'), | 292 self.m.infra_paths['build'].join( |
293 ['.', self.m.path['depot_tools'].join('gclient', | 293 'scripts', 'slave', 'gclient_safe_revert.py'), |
294 platform_ext={'win': '.bat'})], | 294 [ |
| 295 '.', |
| 296 self.m.infra_paths['depot_tools'].join( |
| 297 'gclient', platform_ext={'win': '.bat'}) |
| 298 ], |
295 infra_step=True, | 299 infra_step=True, |
296 **kwargs | 300 **kwargs |
297 ) | 301 ) |
298 | 302 |
299 def runhooks(self, args=None, name='runhooks', **kwargs): | 303 def runhooks(self, args=None, name='runhooks', **kwargs): |
300 args = args or [] | 304 args = args or [] |
301 assert isinstance(args, (list, tuple)) | 305 assert isinstance(args, (list, tuple)) |
302 return self( | 306 return self( |
303 name, ['runhooks'] + list(args), infra_step=False, **kwargs) | 307 name, ['runhooks'] + list(args), infra_step=False, **kwargs) |
304 | 308 |
(...skipping 21 matching lines...) Expand all Loading... |
326 | 330 |
327 build_path = sys.argv[1] | 331 build_path = sys.argv[1] |
328 if os.path.exists(build_path): | 332 if os.path.exists(build_path): |
329 for (path, dir, files) in os.walk(build_path): | 333 for (path, dir, files) in os.walk(build_path): |
330 for cur_file in files: | 334 for cur_file in files: |
331 if cur_file.endswith('index.lock'): | 335 if cur_file.endswith('index.lock'): |
332 path_to_file = os.path.join(path, cur_file) | 336 path_to_file = os.path.join(path, cur_file) |
333 print 'deleting %s' % path_to_file | 337 print 'deleting %s' % path_to_file |
334 os.remove(path_to_file) | 338 os.remove(path_to_file) |
335 """, | 339 """, |
336 args=[self.m.path['slave_build']], | 340 args=[self.m.infra_paths['slave_build']], |
337 infra_step=True, | 341 infra_step=True, |
338 ) | 342 ) |
OLD | NEW |