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

Side by Side Diff: appengine/findit/common/chromium_deps.py

Issue 1154593005: [Findit] Add a sub-pipeline to analyze failures caused by DEPS rolls. (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Fix url to changes in DEPS roll. Created 5 years, 6 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 unified diff | Download patch
OLDNEW
1 # Copyright 2014 The Chromium Authors. All rights reserved. 1 # Copyright 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 from common import git_repository 5 from common import git_repository
6 from common import http_client_appengine 6 from common import http_client_appengine
7 from common import dependency 7 from common import dependency
8 from common import deps_parser 8 from common import deps_parser
9 9
10 10
11 class DEPSDownloader(deps_parser.DEPSLoader): 11 class DEPSDownloader(deps_parser.DEPSLoader):
12 """Download DEPS from remote GIT repo.""" 12 """Downloads DEPS from remote GIT repo."""
qyearsley 2015/05/29 23:14:33 GIT -> git or Git
stgao 2015/05/30 00:21:05 Done.
13 13
14 def Load(self, repo_url, revision, deps_file): 14 def Load(self, repo_url, revision, deps_file):
15 http_client = http_client_appengine.HttpClientAppengine() 15 http_client = http_client_appengine.HttpClientAppengine()
16 repo = git_repository.GitRepository(repo_url, http_client) 16 repo = git_repository.GitRepository(repo_url, http_client)
17 17
18 content = None 18 content = None
19 19
20 # Try .DEPS.git first if the given deps_file is "DEPS", because before 20 # Try .DEPS.git first if the given deps_file is "DEPS", because before
21 # migration from SVN to GIT, .DEPS.git contains dependencies from GIT while 21 # migration from SVN to GIT, .DEPS.git contains dependencies from GIT while
qyearsley 2015/05/29 23:14:32 GIT -> git or Git
stgao 2015/05/30 00:21:05 Done.
22 # DEPS contains those from SVN. 22 # DEPS contains those from SVN.
23 if deps_file == 'DEPS': 23 if deps_file == 'DEPS':
24 content = repo.GetSource('.DEPS.git', revision) 24 content = repo.GetSource('.DEPS.git', revision)
25 25
26 # If .DEPS.git is not found, use DEPS. Assume it is a commit after migration 26 # If .DEPS.git is not found, use DEPS. Assume it is a commit after migration
27 # from SVN to GIT. 27 # from SVN to GIT.
28 if content is None: 28 if content is None:
29 content = repo.GetSource(deps_file, revision) 29 content = repo.GetSource(deps_file, revision)
30 30
31 if content is None: 31 if content is None:
32 raise Exception('Failed to pull %s file.' % deps_file) 32 raise Exception('Failed to pull %s file.' % deps_file)
33 33
34 return content 34 return content
35 35
36 36
37 def GetChromeDependency(revision, os_platform): 37 def GetChromeDependency(revision, os_platform):
38 """Return all dependencies of Chrome as a dict for the given revision and os. 38 """Returns all dependencies of Chrome as a dict for the given revision and os.
qyearsley 2015/05/29 23:14:33 Nit: os -> OS
stgao 2015/05/30 00:21:05 Done.
39 39
40 Args: 40 Args:
41 revision (str): The revision of a Chrome build. 41 revision (str): The revision of a Chrome build.
42 os_platform (str): The target platform of the Chrome build, should be one of 42 os_platform (str): The target platform of the Chrome build, should be one of
43 'win', 'ios', 'mac', 'unix', 'android', or 'all'. 43 'win', 'ios', 'mac', 'unix', 'android', or 'all'.
44 44
45 Returns: 45 Returns:
46 A map from dependency path to the dependency info. 46 A map from dependency path to the dependency info.
47 """ 47 """
48 root_dep = dependency.Dependency( 48 root_dep = dependency.Dependency(
49 'src/', 'https://chromium.googlesource.com/chromium/src.git', revision, 49 'src/', 'https://chromium.googlesource.com/chromium/src.git', revision,
50 'DEPS') 50 'DEPS')
51 51
52 deps_parser.UpdateDependencyTree(root_dep, [os_platform], DEPSDownloader()) 52 deps_parser.UpdateDependencyTree(root_dep, [os_platform], DEPSDownloader())
53 53
54 dependencies = {} 54 dependencies = {}
55 55
56 # Flatten the dependency tree into a one-level dict. 56 # Flatten the dependency tree into a one-level dict.
57 def _FlattenDepTree(dep): 57 def FlattenDepTree(dep):
58 dependencies[dep.path] = dep 58 dependencies[dep.path] = dep
59 for child in dep.children.values(): 59 for child in dep.children.values():
60 _FlattenDepTree(child) 60 FlattenDepTree(child)
61 61
62 _FlattenDepTree(root_dep) 62 FlattenDepTree(root_dep)
63 63
64 return dependencies 64 return dependencies
65
66
67 def GetChromiumDEPSRolls(old_cr_revision, new_cr_revision, os_platform):
68 """Returns a list of dependency rolls between the given Chromium revisions.
69
70 Args:
71 old_cr_revision (str): The old Chromium revision.
72 new_cr_revision (str): The new Chromium revision.
qyearsley 2015/05/29 23:14:33 Are these git commit hashes or commit positions or
stgao 2015/05/30 00:21:05 Done. Git commit hashes.
73 os_platform (str): The target OS platform of the Chrome or test binary.
74 """
75 old_deps = GetChromeDependency(old_cr_revision, os_platform)
76 new_deps = GetChromeDependency(new_cr_revision, os_platform)
77
78 rolls = []
79
80 for path, new_dep in new_deps.iteritems():
81 if path == 'src/':
82 continue
83
84 old_revision = None
85 if path in old_deps:
86 old_revision = old_deps[path].revision
87
88 if old_revision != new_dep.revision:
89 rolls.append(
90 dependency.DependencyRoll(
91 path, new_dep.repo_url, old_revision, new_dep.revision))
92
93 # Note: dependencies could be deleted too. However, regressions caused by that
94 # seems rare. Thus, ignore them for now.
95
96 return rolls
OLDNEW
« no previous file with comments | « no previous file | appengine/findit/common/dependency.py » ('j') | appengine/findit/common/dependency.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698