Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(158)

Unified Diff: tools/findit/chromium_deps.py

Issue 430943003: [Findit] Plain objects to represent and parse stack trace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: reupload Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tools/findit/component_dictionary.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/findit/chromium_deps.py
diff --git a/tools/findit/chromium_deps.py b/tools/findit/chromium_deps.py
index 0de6721d125428b1c712053735d8aa6305907328..6bad2c49e6bccb0c7cbb97a6159102a0e331df28 100644
--- a/tools/findit/chromium_deps.py
+++ b/tools/findit/chromium_deps.py
@@ -2,14 +2,18 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
+import base64
import https
import utils
-DEPS_FILE_URL = 'https://src.chromium.org/chrome/trunk/src/DEPS?p=%s'
+DEPS_FILE_URL_SVN = 'https://src.chromium.org/chrome/trunk/src/DEPS?p=%s'
+DEPS_FILE_URL_GIT = (
+ 'https://chromium.googlesource.com/chromium/src/+/%s/DEPS?format=text')
class _VarImpl(object):
+
def __init__(self, local_scope):
self._local_scope = local_scope
@@ -70,7 +74,11 @@ def _GetComponentName(path):
def _GetContentOfDEPS(chromium_revision):
- return https.SendRequest(DEPS_FILE_URL % chromium_revision)
+ if utils.IsGitHash(chromium_revision):
+ url = DEPS_FILE_URL_GIT
+ else:
+ url = DEPS_FILE_URL_SVN
+ return https.SendRequest(url % chromium_revision)
def GetChromiumComponents(chromium_revision,
@@ -85,13 +93,23 @@ def GetChromiumComponents(chromium_revision,
and returns the content of the DEPS file. The returned
content is assumed to be trusted input and will be
evaluated as python code.
+
+ Returns:
+ A map from component path to parsed component name, repository URL,
+ repository type and revision.
"""
if os_platform.lower() == 'linux':
os_platform = 'unix'
+ is_git_hash = utils.IsGitHash(chromium_revision)
+
# Download the content of DEPS file in chromium.
deps_content = deps_file_downloader(chromium_revision)
+ # Googlesource git returns text file encoded in base64, so decode it.
+ if is_git_hash:
+ deps_content = base64.b64decode(deps_content)
+
all_deps = {}
# Parse the content of DEPS file.
@@ -102,7 +120,7 @@ def GetChromiumComponents(chromium_revision,
# Figure out components based on the dependencies.
components = {}
- for component_path in all_deps.keys():
+ for component_path in all_deps:
name = _GetComponentName(component_path)
repository, revision = all_deps[component_path].split('@')
is_git_hash = utils.IsGitHash(revision)
@@ -123,47 +141,51 @@ def GetChromiumComponents(chromium_revision,
'revision': revision
}
- # Add chromium as a component.
- # TODO(stgao): Move to git.
+ # Add chromium as a component, depending on the repository type.
+ if is_git_hash:
+ repository = 'https://chromium.googlesource.com/chromium/src/'
+ repository_type = 'git'
+ else:
+ repository = 'https://src.chromium.org/chrome/trunk'
+ repository_type = 'svn'
+
components['src/'] = {
'path': 'src/',
'name': 'chromium',
- 'repository': 'https://src.chromium.org/chrome/trunk',
- 'repository_type': 'svn',
+ 'repository': repository,
+ 'repository_type': repository_type,
'revision': chromium_revision
}
return components
-def GetChromiumComponentRange(chromium_revision1,
- chromium_revision2,
+def GetChromiumComponentRange(old_revision,
+ new_revision,
os_platform='unix',
deps_file_downloader=_GetContentOfDEPS):
"""Return a list of components with their revision ranges.
Args:
- chromium_revision1: The revision of a Chrome build.
- chromium_revision2: The revision of another Chrome build.
+ old_revision: The old revision of a Chrome build.
+ new_revision: The new revision of a Chrome build.
os_platform: The target platform of the Chrome build, eg. win, mac, etc.
deps_file_downloader: A function that takes the chromium_revision as input,
and returns the content of the DEPS file. The returned
content is assumed to be trusted input and will be
evaluated as python code.
- """
- # TODO(stgao): support git.
- chromium_revision1 = int(chromium_revision1)
- chromium_revision2 = int(chromium_revision2)
- old_revision = str(min(chromium_revision1, chromium_revision2))
- new_revision = str(max(chromium_revision1, chromium_revision2))
+ Returns:
+ A map from component path to its parsed regression and other information.
+ """
+ # Assume first revision is the old revision.
old_components = GetChromiumComponents(old_revision, os_platform,
deps_file_downloader)
new_components = GetChromiumComponents(new_revision, os_platform,
deps_file_downloader)
components = {}
- for path in new_components.keys():
+ for path in new_components:
new_component = new_components[path]
old_revision = None
if path in old_components:
@@ -184,4 +206,5 @@ def GetChromiumComponentRange(chromium_revision1,
if __name__ == '__main__':
import json
- print json.dumps(GetChromiumComponents(284750), sort_keys=True, indent=2)
+ print json.dumps(GetChromiumComponents(
+ 'b4b1aea80b25a3b2f7952c9d95585e880421ef2b'), sort_keys=True, indent=2)
« no previous file with comments | « no previous file | tools/findit/component_dictionary.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698