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

Unified Diff: appengine/findit/common/chromium_deps.py

Issue 1950123003: [Findit] Fetch DEPS from buildspec/ instead of trunk for chrome official builds. (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Update doc string. Created 4 years, 7 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 | appengine/findit/common/dependency.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: appengine/findit/common/chromium_deps.py
diff --git a/appengine/findit/common/chromium_deps.py b/appengine/findit/common/chromium_deps.py
index 970b2df6dce69523948993dca745357711c35c59..3bfaae184808227982f279ce756017e86f4f0eb9 100644
--- a/appengine/findit/common/chromium_deps.py
+++ b/appengine/findit/common/chromium_deps.py
@@ -2,18 +2,34 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
-from common import git_repository
-from common import http_client_appengine
+import re
+
from common import dependency
from common import deps_parser
+from common import git_repository
+from common import http_client_appengine
_CHROMIUM_ROOT_DIR = 'src/'
_CHROMIUM_REPO_MASTER = 'https://chromium.googlesource.com/chromium/src.git'
+_CHROME_VERSION_PATTERN = re.compile(r'^\d+\.\d+\.\d+\.\d+$')
+
+_BUILDSPEC_REPO = ('https://chrome-internal.googlesource.com/chrome/tools/'
+ 'buildspec.git/')
+
+
+def IsChromeVersion(revision):
+ """Determines if a revision is a chrome version."""
+ if _CHROME_VERSION_PATTERN.match(revision):
+ return True
+
+ return False
+
class DEPSDownloader(deps_parser.DEPSLoader):
"""Downloads DEPS from remote Git repo."""
+
def __init__(self, check_deps_git_first=False):
"""
Args:
@@ -50,16 +66,26 @@ def GetChromeDependency(revision, platform, check_deps_git_first=False):
"""Returns all dependencies of Chrome as a dict for the given revision and OS.
Args:
- revision (str): The revision of a Chrome build.
+ revision (str): The revision of a Chrome build, it can be a githash or a
+ chrome version for a official build.
platform (str): The target platform of the Chrome build, should be one of
- 'win', 'ios', 'mac', 'unix', 'android', or 'all'.
+ 'win', 'ios', 'mac', 'unix', 'android', or 'all'.
check_deps_git_first (bool): If True, use .DEPS.git instead of DEPS.
Returns:
A map from dependency path to the dependency info.
"""
+ deps_repo_info = {'deps_file': 'DEPS'}
+
+ if IsChromeVersion(revision):
+ # For chrome version, get the DEPS file from internal buildspec/ repo
+ # instead of chromium trunk.
+ deps_repo_info['deps_repo_url'] = _BUILDSPEC_REPO
+ deps_repo_info['deps_repo_revision'] = 'master'
+ deps_repo_info['deps_file'] = 'release/%s/DEPS' % revision
+
root_dep = dependency.Dependency(
- _CHROMIUM_ROOT_DIR, _CHROMIUM_REPO_MASTER, revision, 'DEPS')
+ _CHROMIUM_ROOT_DIR, _CHROMIUM_REPO_MASTER, revision, **deps_repo_info)
deps_parser.UpdateDependencyTree(
root_dep, [platform], DEPSDownloader(check_deps_git_first))
@@ -78,14 +104,21 @@ def GetChromeDependency(revision, platform, check_deps_git_first=False):
def GetChromiumDEPSRolls(old_cr_revision, new_cr_revision, platform,
- check_deps_git_first=False):
+ check_deps_git_first=False, skip_chromium_roll=True):
"""Returns a list of dependency rolls between the given Chromium revisions.
Args:
- old_cr_revision (str): The Git commit hash for the old Chromium revision.
- new_cr_revision (str): The Git commit hash for the new Chromium revision.
+ old_cr_revision (str): The old Chromium revision, it can be a githash or a
+ chrome version for a official build.
+ new_cr_revision (str): The new Chromium revision, it can be a githash or a
+ chrome version for a official build.
platform (str): The target OS platform of the Chrome or test binary.
check_deps_git_first (bool): If True, use .DEPS.git instead of DEPS.
+ skip_chromium_roll (bool): If False, chromium roll will be contained in
+ the return.
+
+ Returns:
+ A list of DependencyRoll objects in the revision range.
"""
old_deps = GetChromeDependency(
old_cr_revision, platform, check_deps_git_first)
@@ -95,7 +128,7 @@ def GetChromiumDEPSRolls(old_cr_revision, new_cr_revision, platform,
rolls = []
for path, new_dep in new_deps.iteritems():
- if path == _CHROMIUM_ROOT_DIR: # Skip the root dependency -- chromium.
+ if skip_chromium_roll and path == _CHROMIUM_ROOT_DIR:
continue
old_revision = None
@@ -117,22 +150,20 @@ def GetChromiumDEPSRolls(old_cr_revision, new_cr_revision, platform,
def GetDEPSRollsDict(old_cr_revision, new_cr_revision, platform):
- """Gets dep_path to DependencyRoll dictionary for deps in
- (old_cr_revision, new_cr_revision].
+ """Gets dep_path to DependencyRoll dictionary for deps between revisions.
Args:
- old_cr_revision (str): The Git commit hash for the old Chromium revision.
- new_cr_revision (str): The Git commit hash for the new Chromium revision.
+ old_cr_revision (str): The old Chromium revision, it can be a githash or a
+ chrome version for a official build.
+ new_cr_revision (str): The new Chromium revision, it can be a githash or a
+ chrome version for a official build.
platform (str): The target OS platform of the Chrome or test binary.
Returns:
- A dict, mapping dep path to DependencyRoll.
+ A dict, mapping dep path to its DependencyRoll.
"""
- deps_rolls = GetChromiumDEPSRolls(old_cr_revision, new_cr_revision, platform)
- # Add chromium as dependency roll.
- deps_rolls.append(dependency.DependencyRoll(
- _CHROMIUM_ROOT_DIR, _CHROMIUM_REPO_MASTER,
- old_cr_revision, new_cr_revision))
+ deps_rolls = GetChromiumDEPSRolls(old_cr_revision, new_cr_revision, platform,
+ skip_chromium_roll=False)
deps_rolls_dict = {}
for dep_roll in deps_rolls:
« no previous file with comments | « no previous file | appengine/findit/common/dependency.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698