| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 """Meta checkout manager supporting both Subversion and GIT. | 6 """Meta checkout manager supporting both Subversion and GIT. |
| 7 | 7 |
| 8 Files | 8 Files |
| 9 .gclient : Current client configuration, written by 'config' command. | 9 .gclient : Current client configuration, written by 'config' command. |
| 10 Format is a Python script defining 'solutions', a list whose | 10 Format is a Python script defining 'solutions', a list whose |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 self.deps_parsed = False | 165 self.deps_parsed = False |
| 166 # This dependency should be processed, i.e. checked out | 166 # This dependency should be processed, i.e. checked out |
| 167 self.should_process = should_process | 167 self.should_process = should_process |
| 168 # This dependency has been processed, i.e. checked out | 168 # This dependency has been processed, i.e. checked out |
| 169 self.processed = False | 169 self.processed = False |
| 170 # This dependency had its hook run | 170 # This dependency had its hook run |
| 171 self.hooks_ran = False | 171 self.hooks_ran = False |
| 172 # Required dependencies to run before running this one: | 172 # Required dependencies to run before running this one: |
| 173 self.requirements = set() | 173 self.requirements = set() |
| 174 | 174 |
| 175 # Post process the url to remove trailing slashes. |
| 176 if isinstance(self.url, basestring): |
| 177 # urls are sometime incorrectly written as proto://host/path/@rev. Replace |
| 178 # it to proto://host/path@rev. |
| 179 if self.url.count('@') > 1: |
| 180 raise gclient_utils.Error('Invalid url "%s"' % self.url) |
| 181 self.url = self.url.replace('/@', '@') |
| 182 |
| 175 self._FindDependencies() | 183 self._FindDependencies() |
| 176 | 184 |
| 177 # Sanity checks | 185 # Sanity checks |
| 178 if not self.name and self.parent: | 186 if not self.name and self.parent: |
| 179 raise gclient_utils.Error('Dependency without name') | 187 raise gclient_utils.Error('Dependency without name') |
| 180 if not isinstance(self.url, | 188 if not isinstance(self.url, |
| 181 (basestring, self.FromImpl, self.FileImpl, None.__class__)): | 189 (basestring, self.FromImpl, self.FileImpl, None.__class__)): |
| 182 raise gclient_utils.Error('dependency url must be either a string, None, ' | 190 raise gclient_utils.Error('dependency url must be either a string, None, ' |
| 183 'File() or From() instead of %s' % | 191 'File() or From() instead of %s' % |
| 184 self.url.__class__.__name__) | 192 self.url.__class__.__name__) |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 # Make sure the referenced dependency DEPS file is loaded and file the | 264 # Make sure the referenced dependency DEPS file is loaded and file the |
| 257 # inner referenced dependency. | 265 # inner referenced dependency. |
| 258 ref.ParseDepsFile() | 266 ref.ParseDepsFile() |
| 259 found_dep = None | 267 found_dep = None |
| 260 for d in ref.dependencies: | 268 for d in ref.dependencies: |
| 261 if d.name == sub_target: | 269 if d.name == sub_target: |
| 262 found_dep = d | 270 found_dep = d |
| 263 break | 271 break |
| 264 if not found_dep: | 272 if not found_dep: |
| 265 raise gclient_utils.Error( | 273 raise gclient_utils.Error( |
| 266 'Couldn\'t find %s in %s, referenced by %s\n%s' % ( | 274 'Couldn\'t find %s in %s, referenced by %s (parent: %s)\n%s' % ( |
| 267 sub_target, ref.name, self.name, str(self.root_parent()))) | 275 sub_target, ref.name, self.name, self.parent.name, |
| 276 str(self.root_parent()))) |
| 277 |
| 268 # Call LateOverride() again. | 278 # Call LateOverride() again. |
| 269 parsed_url = found_dep.LateOverride(found_dep.url) | 279 parsed_url = found_dep.LateOverride(found_dep.url) |
| 270 logging.info('%s, %s to %s' % (self.name, url, parsed_url)) | 280 logging.info('%s, %s to %s' % (self.name, url, parsed_url)) |
| 271 return parsed_url | 281 return parsed_url |
| 272 elif isinstance(url, basestring): | 282 elif isinstance(url, basestring): |
| 273 parsed_url = urlparse.urlparse(url) | 283 parsed_url = urlparse.urlparse(url) |
| 274 if not parsed_url[0]: | 284 if not parsed_url[0]: |
| 275 # A relative url. Fetch the real base. | 285 # A relative url. Fetch the real base. |
| 276 path = parsed_url[2] | 286 path = parsed_url[2] |
| 277 if not path.startswith('/'): | 287 if not path.startswith('/'): |
| (...skipping 1069 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1347 except (gclient_utils.Error, subprocess2.CalledProcessError), e: | 1357 except (gclient_utils.Error, subprocess2.CalledProcessError), e: |
| 1348 print >> sys.stderr, 'Error: %s' % str(e) | 1358 print >> sys.stderr, 'Error: %s' % str(e) |
| 1349 return 1 | 1359 return 1 |
| 1350 | 1360 |
| 1351 | 1361 |
| 1352 if '__main__' == __name__: | 1362 if '__main__' == __name__: |
| 1353 fix_encoding.fix_encoding() | 1363 fix_encoding.fix_encoding() |
| 1354 sys.exit(Main(sys.argv[1:])) | 1364 sys.exit(Main(sys.argv[1:])) |
| 1355 | 1365 |
| 1356 # vim: ts=2:sw=2:tw=80:et: | 1366 # vim: ts=2:sw=2:tw=80:et: |
| OLD | NEW |