OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 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 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
318 raise gclient_utils.Error( | 318 raise gclient_utils.Error( |
319 'The same name "%s" appears multiple times in the deps section' % | 319 'The same name "%s" appears multiple times in the deps section' % |
320 self.name) | 320 self.name) |
321 if not self.should_process: | 321 if not self.should_process: |
322 # Return early, no need to set requirements. | 322 # Return early, no need to set requirements. |
323 return True | 323 return True |
324 | 324 |
325 # This require a full tree traversal with locks. | 325 # This require a full tree traversal with locks. |
326 siblings = [d for d in self.root.subtree(False) if d.name == self.name] | 326 siblings = [d for d in self.root.subtree(False) if d.name == self.name] |
327 for sibling in siblings: | 327 for sibling in siblings: |
328 if self.url != sibling.url: | 328 self_url = self.LateOverride(self.url) |
| 329 sibling_url = sibling.LateOverride(sibling.url) |
| 330 # Allow to have only one to be None or ''. |
| 331 if self_url != sibling_url and bool(self_url) == bool(sibling_url): |
329 raise gclient_utils.Error( | 332 raise gclient_utils.Error( |
330 'Dependency %s specified more than once:\n %s\nvs\n %s' % | 333 ('Dependency %s specified more than once:\n' |
331 (self.name, sibling.hierarchy(), self.hierarchy())) | 334 ' %s [%s]\n' |
| 335 'vs\n' |
| 336 ' %s [%s]') % ( |
| 337 self.name, |
| 338 sibling.hierarchy(), |
| 339 sibling_url, |
| 340 self.hierarchy(), |
| 341 self_url)) |
332 # In theory we could keep it as a shadow of the other one. In | 342 # In theory we could keep it as a shadow of the other one. In |
333 # practice, simply ignore it. | 343 # practice, simply ignore it. |
334 logging.warn('Won\'t process duplicate dependency %s' % sibling) | 344 logging.warn('Won\'t process duplicate dependency %s' % sibling) |
335 return False | 345 return False |
336 return True | 346 return True |
337 | 347 |
338 def LateOverride(self, url): | 348 def LateOverride(self, url): |
339 """Resolves the parsed url from url. | 349 """Resolves the parsed url from url. |
340 | 350 |
341 Manages From() keyword accordingly. Do not touch self.parsed_url nor | 351 Manages From() keyword accordingly. Do not touch self.parsed_url nor |
(...skipping 1281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1623 except (gclient_utils.Error, subprocess2.CalledProcessError), e: | 1633 except (gclient_utils.Error, subprocess2.CalledProcessError), e: |
1624 print >> sys.stderr, 'Error: %s' % str(e) | 1634 print >> sys.stderr, 'Error: %s' % str(e) |
1625 return 1 | 1635 return 1 |
1626 | 1636 |
1627 | 1637 |
1628 if '__main__' == __name__: | 1638 if '__main__' == __name__: |
1629 fix_encoding.fix_encoding() | 1639 fix_encoding.fix_encoding() |
1630 sys.exit(Main(sys.argv[1:])) | 1640 sys.exit(Main(sys.argv[1:])) |
1631 | 1641 |
1632 # vim: ts=2:sw=2:tw=80:et: | 1642 # vim: ts=2:sw=2:tw=80:et: |
OLD | NEW |