OLD | NEW |
1 # Copyright 2015 The Chromium Authors. All rights reserved. | 1 # Copyright 2015 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 import logging | 5 import logging |
6 | 6 |
7 from common import chrome_dependency_fetcher | 7 from common import chrome_dependency_fetcher |
8 from common import git_repository | |
9 from common.http_client_appengine import HttpClientAppengine | 8 from common.http_client_appengine import HttpClientAppengine |
10 from common.pipeline_wrapper import BasePipeline | 9 from common.pipeline_wrapper import BasePipeline |
| 10 from lib.gitiles import gitiles_repository |
11 | 11 |
12 | 12 |
13 def _GetOSPlatformName(master_name, builder_name): # pragma: no cover | 13 def _GetOSPlatformName(master_name, builder_name): # pragma: no cover |
14 """Returns the OS platform name based on the master and builder.""" | 14 """Returns the OS platform name based on the master and builder.""" |
15 # TODO: make buildbot yield OS platform name as a build property and use it. | 15 # TODO: make buildbot yield OS platform name as a build property and use it. |
16 # The code below is just a workaround. | 16 # The code below is just a workaround. |
17 builder_name = builder_name.lower() | 17 builder_name = builder_name.lower() |
18 if master_name == 'chromium.win': | 18 if master_name == 'chromium.win': |
19 return 'win' | 19 return 'win' |
20 elif master_name == 'chromium.linux': | 20 elif master_name == 'chromium.linux': |
(...skipping 19 matching lines...) Expand all Loading... |
40 | 40 |
41 logging.warn('Failed to detect the OS platform of builder "%s".', | 41 logging.warn('Failed to detect the OS platform of builder "%s".', |
42 builder_name) | 42 builder_name) |
43 return 'all' # Default to all platform. | 43 return 'all' # Default to all platform. |
44 | 44 |
45 | 45 |
46 def _GetDependencies(chromium_revision, os_platform): | 46 def _GetDependencies(chromium_revision, os_platform): |
47 """Returns the dependencies used by the specified chromium revision.""" | 47 """Returns the dependencies used by the specified chromium revision.""" |
48 deps = {} | 48 deps = {} |
49 dep_fetcher=chrome_dependency_fetcher.ChromeDependencyFetcher( | 49 dep_fetcher=chrome_dependency_fetcher.ChromeDependencyFetcher( |
50 git_repository.GitRepository(http_client=HttpClientAppengine())) | 50 gitiles_repository.GitilesRepository(http_client=HttpClientAppengine())) |
51 for path, dependency in dep_fetcher.GetDependency( | 51 for path, dependency in dep_fetcher.GetDependency( |
52 chromium_revision, os_platform).iteritems(): | 52 chromium_revision, os_platform).iteritems(): |
53 deps[path] = { | 53 deps[path] = { |
54 'repo_url': dependency.repo_url, | 54 'repo_url': dependency.repo_url, |
55 'revision': dependency.revision, | 55 'revision': dependency.revision, |
56 } | 56 } |
57 | 57 |
58 return deps | 58 return deps |
59 | 59 |
60 | 60 |
(...skipping 13 matching lines...) Expand all Loading... |
74 'new_revision': 'git_hash1', | 74 'new_revision': 'git_hash1', |
75 'old_revision': 'git_hash2', | 75 'old_revision': 'git_hash2', |
76 }, | 76 }, |
77 ... | 77 ... |
78 ], | 78 ], |
79 ... | 79 ... |
80 } | 80 } |
81 """ | 81 """ |
82 deps_rolls = {} | 82 deps_rolls = {} |
83 dep_fetcher=chrome_dependency_fetcher.ChromeDependencyFetcher( | 83 dep_fetcher=chrome_dependency_fetcher.ChromeDependencyFetcher( |
84 git_repository.GitRepository(http_client=HttpClientAppengine())) | 84 gitiles_repository.GitilesRepository(http_client=HttpClientAppengine())) |
85 for revision, change_log in change_logs.iteritems(): | 85 for revision, change_log in change_logs.iteritems(): |
86 # Check DEPS roll only if the chromium DEPS file is changed by the CL. | 86 # Check DEPS roll only if the chromium DEPS file is changed by the CL. |
87 for touched_file in change_log['touched_files']: | 87 for touched_file in change_log['touched_files']: |
88 if touched_file['new_path'] == 'DEPS': | 88 if touched_file['new_path'] == 'DEPS': |
89 # In git, r^ refers to the previous revision of r. | 89 # In git, r^ refers to the previous revision of r. |
90 old_revision = '%s^' % revision | 90 old_revision = '%s^' % revision |
91 rolls = dep_fetcher.GetDependencyRolls( | 91 rolls = dep_fetcher.GetDependencyRolls( |
92 old_revision, revision, os_platform) | 92 old_revision, revision, os_platform) |
93 deps_rolls[revision] = [roll.ToDict() for roll in rolls] | 93 deps_rolls[revision] = [roll.ToDict() for roll in rolls] |
94 break | 94 break |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 return {'deps': {}, 'deps_rolls': {}} | 135 return {'deps': {}, 'deps_rolls': {}} |
136 | 136 |
137 chromium_revision = failure_info['chromium_revision'] | 137 chromium_revision = failure_info['chromium_revision'] |
138 os_platform = _GetOSPlatformName( | 138 os_platform = _GetOSPlatformName( |
139 failure_info['master_name'], failure_info['builder_name']) | 139 failure_info['master_name'], failure_info['builder_name']) |
140 | 140 |
141 return { | 141 return { |
142 'deps': _GetDependencies(chromium_revision, os_platform), | 142 'deps': _GetDependencies(chromium_revision, os_platform), |
143 'deps_rolls': _DetectDependencyRolls(change_logs, os_platform) | 143 'deps_rolls': _DetectDependencyRolls(change_logs, os_platform) |
144 } | 144 } |
OLD | NEW |