Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright 2014 The Chromium Authors. All rights reserved. | 2 # Copyright 2014 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 # TODO(hinoka): Use logging. | 6 # TODO(hinoka): Use logging. |
| 7 | 7 |
| 8 import cStringIO | 8 import cStringIO |
| 9 import codecs | 9 import codecs |
| 10 import collections | 10 import collections |
| (...skipping 801 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 812 buildspec_path = 'releases' | 812 buildspec_path = 'releases' |
| 813 buildspec_version = m.group(1) | 813 buildspec_version = m.group(1) |
| 814 | 814 |
| 815 git_buildspec = get_git_buildspec(buildspec_path, buildspec_version) | 815 git_buildspec = get_git_buildspec(buildspec_path, buildspec_version) |
| 816 with open(deps_git_file, 'wb') as f: | 816 with open(deps_git_file, 'wb') as f: |
| 817 f.write(git_buildspec) | 817 f.write(git_buildspec) |
| 818 | 818 |
| 819 | 819 |
| 820 def ensure_deps2git(solution, shallow): | 820 def ensure_deps2git(solution, shallow): |
| 821 repo_base = path.join(os.getcwd(), solution['name']) | 821 repo_base = path.join(os.getcwd(), solution['name']) |
| 822 custom_vars = solution.get('custom_vars') | |
| 822 deps_file = path.join(repo_base, 'DEPS') | 823 deps_file = path.join(repo_base, 'DEPS') |
| 823 deps_git_file = path.join(repo_base, '.DEPS.git') | 824 deps_git_file = path.join(repo_base, '.DEPS.git') |
| 824 if not git('ls-files', 'DEPS', cwd=repo_base).strip(): | 825 if not git('ls-files', 'DEPS', cwd=repo_base).strip(): |
| 825 return | 826 return |
| 826 | 827 |
| 827 print 'Checking if %s is newer than %s' % (deps_file, deps_git_file) | 828 print 'Checking if %s is newer than %s' % (deps_file, deps_git_file) |
| 828 if not need_to_run_deps2git(repo_base, deps_file, deps_git_file): | 829 if not need_to_run_deps2git(repo_base, deps_file, deps_git_file): |
| 829 return | 830 return |
| 830 | 831 |
| 831 print '===DEPS file modified, need to run deps2git===' | 832 print '===DEPS file modified, need to run deps2git===' |
| 832 cmd = [sys.executable, DEPS2GIT_PATH, | 833 cmd = [sys.executable, DEPS2GIT_PATH, |
| 833 '--cache_dir', CACHE_DIR, | 834 '--cache_dir', CACHE_DIR, |
| 834 '--deps', deps_file, | 835 '--deps', deps_file, |
| 835 '--out', deps_git_file] | 836 '--out', deps_git_file] |
| 837 if custom_vars: | |
| 838 cmd.extend(['--var_overrides', json.dumps(custom_vars)]) | |
|
kjellander_chromium
2014/10/03 09:00:50
I doublechecked that an empty custom_vars dict doe
| |
| 836 if 'chrome-internal.googlesource' in solution['url']: | 839 if 'chrome-internal.googlesource' in solution['url']: |
| 837 cmd.extend(['--extra-rules', S2G_INTERNAL_PATH]) | 840 cmd.extend(['--extra-rules', S2G_INTERNAL_PATH]) |
| 838 if shallow: | 841 if shallow: |
| 839 cmd.append('--shallow') | 842 cmd.append('--shallow') |
| 840 call(*cmd) | 843 call(*cmd) |
| 841 | 844 |
| 842 | 845 |
| 843 def emit_log_lines(name, lines): | 846 def emit_log_lines(name, lines): |
| 844 for line in lines.splitlines(): | 847 for line in lines.splitlines(): |
| 845 print '@@@STEP_LOG_LINE@%s@%s@@@' % (name, line) | 848 print '@@@STEP_LOG_LINE@%s@%s@@@' % (name, line) |
| (...skipping 815 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1661 except Exception: | 1664 except Exception: |
| 1662 # Unexpected failure. | 1665 # Unexpected failure. |
| 1663 emit_flag(options.flag_file) | 1666 emit_flag(options.flag_file) |
| 1664 raise | 1667 raise |
| 1665 else: | 1668 else: |
| 1666 emit_flag(options.flag_file) | 1669 emit_flag(options.flag_file) |
| 1667 | 1670 |
| 1668 | 1671 |
| 1669 if __name__ == '__main__': | 1672 if __name__ == '__main__': |
| 1670 sys.exit(main()) | 1673 sys.exit(main()) |
| OLD | NEW |