| OLD | NEW |
| 1 # Copyright (c) 2014 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2014 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 base64 | 5 import base64 |
| 6 import https | 6 |
| 7 import utils | 7 from common import utils |
| 8 | 8 |
| 9 | 9 |
| 10 DEPS_FILE_URL_SVN = 'https://src.chromium.org/chrome/trunk/src/DEPS?p=%s' | 10 DEPS_FILE_URL_SVN = 'https://src.chromium.org/chrome/trunk/src/DEPS?p=%s' |
| 11 DEPS_FILE_URL_GIT = ( | 11 DEPS_FILE_URL_GIT = ( |
| 12 'https://chromium.googlesource.com/chromium/src/+/%s/DEPS?format=text') | 12 'https://chromium.googlesource.com/chromium/src/+/%s/DEPS?format=text') |
| 13 | 13 |
| 14 | 14 |
| 15 class _VarImpl(object): | 15 class _VarImpl(object): |
| 16 | 16 |
| 17 def __init__(self, local_scope): | 17 def __init__(self, local_scope): |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 | 71 |
| 72 # Unknown path, return the whole path as component name. | 72 # Unknown path, return the whole path as component name. |
| 73 return '_'.join(path.split('/')) | 73 return '_'.join(path.split('/')) |
| 74 | 74 |
| 75 | 75 |
| 76 def _GetContentOfDEPS(chromium_revision): | 76 def _GetContentOfDEPS(chromium_revision): |
| 77 if utils.IsGitHash(chromium_revision): | 77 if utils.IsGitHash(chromium_revision): |
| 78 url = DEPS_FILE_URL_GIT | 78 url = DEPS_FILE_URL_GIT |
| 79 else: | 79 else: |
| 80 url = DEPS_FILE_URL_SVN | 80 url = DEPS_FILE_URL_SVN |
| 81 return https.SendRequest(url % chromium_revision) | 81 _, content = utils.GetHttpClient().Get(url % chromium_revision, timeout=60) |
| 82 return content |
| 82 | 83 |
| 83 | 84 |
| 84 def GetChromiumComponents(chromium_revision, | 85 def GetChromiumComponents(chromium_revision, |
| 85 os_platform='unix', | 86 os_platform='unix', |
| 86 deps_file_downloader=_GetContentOfDEPS): | 87 deps_file_downloader=_GetContentOfDEPS): |
| 87 """Return a list of components used by Chrome of the given revision. | 88 """Return a list of components used by Chrome of the given revision. |
| 88 | 89 |
| 89 Args: | 90 Args: |
| 90 chromium_revision: The revision of the Chrome build. | 91 chromium_revision: The revision of the Chrome build. |
| 91 os_platform: The target platform of the Chrome build, eg. win, mac, etc. | 92 os_platform: The target platform of the Chrome build, eg. win, mac, etc. |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 'path': path, | 196 'path': path, |
| 196 'rolled': new_component['revision'] != old_revision, | 197 'rolled': new_component['revision'] != old_revision, |
| 197 'name': new_component['name'], | 198 'name': new_component['name'], |
| 198 'old_revision': old_revision, | 199 'old_revision': old_revision, |
| 199 'new_revision': new_component['revision'], | 200 'new_revision': new_component['revision'], |
| 200 'repository': new_component['repository'], | 201 'repository': new_component['repository'], |
| 201 'repository_type': new_component['repository_type'] | 202 'repository_type': new_component['repository_type'] |
| 202 } | 203 } |
| 203 | 204 |
| 204 return components | 205 return components |
| 205 | |
| 206 | |
| 207 if __name__ == '__main__': | |
| 208 import json | |
| 209 print json.dumps(GetChromiumComponents( | |
| 210 'b4b1aea80b25a3b2f7952c9d95585e880421ef2b'), sort_keys=True, indent=2) | |
| OLD | NEW |