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

Unified Diff: tools/auto_bisect/bisect_utils.py

Issue 607803005: Trigger build request using git try instead of try_job_http on bisect bots (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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
Index: tools/auto_bisect/bisect_utils.py
diff --git a/tools/auto_bisect/bisect_utils.py b/tools/auto_bisect/bisect_utils.py
index 0e5976df5ab08e1922629e62db1e9ec10f184335..31c1e704d10fceb96e6cb24c9565fe0beafbf05a 100644
--- a/tools/auto_bisect/bisect_utils.py
+++ b/tools/auto_bisect/bisect_utils.py
@@ -11,7 +11,6 @@ annotations for the Buildbot waterfall.
import errno
import imp
import os
-import shutil
import stat
import subprocess
import sys
@@ -308,28 +307,6 @@ def OnAccessError(func, path, _):
raise
-def RemoveThirdPartyDirectory(dir_name):
- """Removes third_party directory from the source.
-
- At some point, some of the third_parties were causing issues to changes in
- the way they are synced. We remove such folder in order to avoid sync errors
- while bisecting.
-
- Returns:
- True on success, otherwise False.
- """
- path_to_dir = os.path.join(os.getcwd(), 'third_party', dir_name)
- try:
- if os.path.exists(path_to_dir):
- shutil.rmtree(path_to_dir, onerror=OnAccessError)
- except OSError, e:
- print 'Error #%d while running shutil.rmtree(%s): %s' % (
- e.errno, path_to_dir, str(e))
- if e.errno != errno.ENOENT:
- return False
- return True
-
-
def _CleanupPreviousGitRuns():
"""Cleans up any leftover index.lock files after running git."""
# If a previous run of git crashed, or bot was reset, etc., then we might
@@ -350,10 +327,24 @@ def RunGClientAndSync(cwd=None):
Returns:
The return code of the call.
"""
- params = ['sync', '--verbose', '--nohooks', '--reset', '--force']
+ params = ['sync', '--verbose', '--nohooks', '--reset', '--force',
+ '--delete_unversioned_trees']
return RunGClient(params, cwd=cwd)
+def ResetToMasterBranch(cwd=None):
+ """Checkouts master branch."""
qyearsley 2014/09/27 01:45:34 "Checks out the master branch." or "Moves to the m
prasadv 2014/09/29 17:36:13 Done.
+ current_branch, returncode = RunGit(
+ ['rev-parse', '--abbrev-ref', 'HEAD'], cwd=cwd)
+ if returncode:
+ print 'Failed to Switch to master branch %s' % current_branch
+ return False
qyearsley 2014/09/27 01:45:34 As you noted, running "git rev-parse --abbrev-ref
prasadv 2014/09/29 17:36:13 Actually we don't need this function, I removed th
+ # Forcibly reset to master branch.
+ CheckRunGit(['checkout', '-f', 'master'], cwd=cwd)
+
+ return True
+
+
def SetupGitDepot(opts, custom_deps):
"""Sets up the depot for the bisection.
@@ -368,35 +359,19 @@ def SetupGitDepot(opts, custom_deps):
otherwise.
"""
name = 'Setting up Bisection Depot'
+ try:
+ if opts.output_buildbot_annotations:
+ OutputAnnotationStepStart(name)
- if opts.output_buildbot_annotations:
- OutputAnnotationStepStart(name)
-
- passed = False
-
- if not RunGClientAndCreateConfig(opts, custom_deps):
- passed_deps_check = True
- if os.path.isfile(os.path.join('src', FILE_DEPS_GIT)):
- cwd = os.getcwd()
- os.chdir('src')
- if passed_deps_check:
- passed_deps_check = RemoveThirdPartyDirectory('libjingle')
- if passed_deps_check:
- passed_deps_check = RemoveThirdPartyDirectory('skia')
- os.chdir(cwd)
-
- if passed_deps_check:
- _CleanupPreviousGitRuns()
-
- RunGClient(['revert'])
- if not RunGClientAndSync():
- passed = True
-
- if opts.output_buildbot_annotations:
- print
- OutputAnnotationStepClosed()
+ if RunGClientAndCreateConfig(opts, custom_deps):
+ return False
- return passed
+ _CleanupPreviousGitRuns()
+ RunGClient(['revert'])
+ return not RunGClientAndSync()
+ finally:
+ if opts.output_buildbot_annotations:
+ OutputAnnotationStepClosed()
def CheckIfBisectDepotExists(opts):
@@ -451,6 +426,15 @@ def CreateBisectDirectoryAndSetupDepot(opts, custom_deps):
opts: The options parsed from the command line through parse_args().
custom_deps: A dictionary of additional dependencies to add to .gclient.
"""
+ if CheckIfBisectDepotExists(opts):
+ path_to_dir = os.path.join(os.path.abspath(opts.working_directory),
+ 'bisect', 'src')
qyearsley 2014/09/27 01:45:34 By the way, do you think it's a good idea to make
prasadv 2014/09/29 17:36:14 Done.
+ (output, _) = RunGit(['rev-parse', '--is-inside-work-tree'],
+ cwd=path_to_dir)
qyearsley 2014/09/27 01:45:33 Under what circumstances are we not "inside work t
prasadv 2014/09/29 17:36:14 This can happen when you are bisect folder but gcl
+ if output.strip() == 'true':
+ if not ResetToMasterBranch(path_to_dir):
+ raise RuntimeError('Failed to reset branch to master.')
+
if not _CreateAndChangeToSourceDirectory(opts.working_directory):
raise RuntimeError('Could not create bisect directory.')
« tools/auto_bisect/bisect_perf_regression.py ('K') | « tools/auto_bisect/bisect_perf_regression.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698