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 # Files | 7 # Files |
8 # .gclient : Current client configuration, written by 'config' command. | 8 # .gclient : Current client configuration, written by 'config' command. |
9 # Format is a Python script defining 'solutions', a list whose | 9 # Format is a Python script defining 'solutions', a list whose |
10 # entries each are maps binding the strings "name" and "url" | 10 # entries each are maps binding the strings "name" and "url" |
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
371 # recursedeps is a mutable value that selectively overrides the default | 371 # recursedeps is a mutable value that selectively overrides the default |
372 # 'no recursion' setting on a dep-by-dep basis. It will replace | 372 # 'no recursion' setting on a dep-by-dep basis. It will replace |
373 # recursion_override. | 373 # recursion_override. |
374 # | 374 # |
375 # It will be a dictionary of {deps_name: {"deps_file": depfile_name}} or | 375 # It will be a dictionary of {deps_name: {"deps_file": depfile_name}} or |
376 # None. | 376 # None. |
377 self.recursedeps = None | 377 self.recursedeps = None |
378 # This is inherited from WorkItem. We want the URL to be a resource. | 378 # This is inherited from WorkItem. We want the URL to be a resource. |
379 if url and isinstance(url, basestring): | 379 if url and isinstance(url, basestring): |
380 # The url is usually given to gclient either as https://blah@123 | 380 # The url is usually given to gclient either as https://blah@123 |
381 # or just https://blah. The @123 portion is irrelevent. | 381 # or just https://blah. The @123 portion is irrelevant. |
382 self.resources.append(url.split('@')[0]) | 382 self.resources.append(url.split('@')[0]) |
383 | 383 |
384 if not self.name and self.parent: | 384 if not self.name and self.parent: |
385 raise gclient_utils.Error('Dependency without name') | 385 raise gclient_utils.Error('Dependency without name') |
386 | 386 |
387 @property | 387 @property |
388 def requirements(self): | 388 def requirements(self): |
389 """Calculate the list of requirements.""" | 389 """Calculate the list of requirements.""" |
390 requirements = set() | 390 requirements = set() |
391 # self.parent is implicitly a requirement. This will be recursive by | 391 # self.parent is implicitly a requirement. This will be recursive by |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
562 for the_target_os in target_os_list: | 562 for the_target_os in target_os_list: |
563 the_target_os_deps = deps_os.get(the_target_os, {}) | 563 the_target_os_deps = deps_os.get(the_target_os, {}) |
564 for os_dep_key, os_dep_value in the_target_os_deps.iteritems(): | 564 for os_dep_key, os_dep_value in the_target_os_deps.iteritems(): |
565 overrides = os_overrides.setdefault(os_dep_key, []) | 565 overrides = os_overrides.setdefault(os_dep_key, []) |
566 overrides.append((the_target_os, os_dep_value)) | 566 overrides.append((the_target_os, os_dep_value)) |
567 | 567 |
568 # If any os didn't specify a value (we have fewer value entries | 568 # If any os didn't specify a value (we have fewer value entries |
569 # than in the os list), then it wants to use the default value. | 569 # than in the os list), then it wants to use the default value. |
570 for os_dep_key, os_dep_value in os_overrides.iteritems(): | 570 for os_dep_key, os_dep_value in os_overrides.iteritems(): |
571 if len(os_dep_value) != len(target_os_list): | 571 if len(os_dep_value) != len(target_os_list): |
572 # Record the default value too so that we don't accidently | 572 # Record the default value too so that we don't accidentally |
573 # set it to None or miss a conflicting DEPS. | 573 # set it to None or miss a conflicting DEPS. |
574 if os_dep_key in deps: | 574 if os_dep_key in deps: |
575 os_dep_value.append(('default', deps[os_dep_key])) | 575 os_dep_value.append(('default', deps[os_dep_key])) |
576 | 576 |
577 target_os_deps = {} | 577 target_os_deps = {} |
578 for os_dep_key, os_dep_value in os_overrides.iteritems(): | 578 for os_dep_key, os_dep_value in os_overrides.iteritems(): |
579 # os_dep_value is a list of (os, value) pairs. | 579 # os_dep_value is a list of (os, value) pairs. |
580 possible_values = set(x[1] for x in os_dep_value if x[1] is not None) | 580 possible_values = set(x[1] for x in os_dep_value if x[1] is not None) |
581 if not possible_values: | 581 if not possible_values: |
582 target_os_deps[os_dep_key] = None | 582 target_os_deps[os_dep_key] = None |
(...skipping 1192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1775 if options.verbose: | 1775 if options.verbose: |
1776 client.PrintLocationAndContents() | 1776 client.PrintLocationAndContents() |
1777 return client.RunOnDeps('cleanup', args) | 1777 return client.RunOnDeps('cleanup', args) |
1778 | 1778 |
1779 | 1779 |
1780 @subcommand.usage('[command] [args ...]') | 1780 @subcommand.usage('[command] [args ...]') |
1781 def CMDrecurse(parser, args): | 1781 def CMDrecurse(parser, args): |
1782 """Operates [command args ...] on all the dependencies. | 1782 """Operates [command args ...] on all the dependencies. |
1783 | 1783 |
1784 Runs a shell command on all entries. | 1784 Runs a shell command on all entries. |
1785 Sets GCLIENT_DEP_PATH enviroment variable as the dep's relative location to | 1785 Sets GCLIENT_DEP_PATH environment variable as the dep's relative location to |
1786 root directory of the checkout. | 1786 root directory of the checkout. |
1787 """ | 1787 """ |
1788 # Stop parsing at the first non-arg so that these go through to the command | 1788 # Stop parsing at the first non-arg so that these go through to the command |
1789 parser.disable_interspersed_args() | 1789 parser.disable_interspersed_args() |
1790 parser.add_option('-s', '--scm', action='append', default=[], | 1790 parser.add_option('-s', '--scm', action='append', default=[], |
1791 help='Choose scm types to operate upon.') | 1791 help='Choose scm types to operate upon.') |
1792 parser.add_option('-i', '--ignore', action='store_true', | 1792 parser.add_option('-i', '--ignore', action='store_true', |
1793 help='Ignore non-zero return codes from subcommands.') | 1793 help='Ignore non-zero return codes from subcommands.') |
1794 parser.add_option('--prepend-dir', action='store_true', | 1794 parser.add_option('--prepend-dir', action='store_true', |
1795 help='Prepend relative dir for use with git <cmd> --null.') | 1795 help='Prepend relative dir for use with git <cmd> --null.') |
(...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2356 | 2356 |
2357 | 2357 |
2358 if '__main__' == __name__: | 2358 if '__main__' == __name__: |
2359 try: | 2359 try: |
2360 sys.exit(main(sys.argv[1:])) | 2360 sys.exit(main(sys.argv[1:])) |
2361 except KeyboardInterrupt: | 2361 except KeyboardInterrupt: |
2362 sys.stderr.write('interrupted\n') | 2362 sys.stderr.write('interrupted\n') |
2363 sys.exit(1) | 2363 sys.exit(1) |
2364 | 2364 |
2365 # vim: ts=2:sw=2:tw=80:et: | 2365 # vim: ts=2:sw=2:tw=80:et: |
OLD | NEW |