| Index: tools/bisect_utils.py
|
| diff --git a/tools/bisect_utils.py b/tools/bisect_utils.py
|
| index 12d8c78c5f29eb4a5d2eba818aca44ac1ca4d7ca..ab0e889f10e62a80080c98d489533addb4d88282 100644
|
| --- a/tools/bisect_utils.py
|
| +++ b/tools/bisect_utils.py
|
| @@ -41,6 +41,8 @@ REPO_PARAMS = [
|
| REPO_SYNC_COMMAND = 'git checkout -f $(git rev-list --max-count=1 '\
|
| '--before=%d remotes/m/master)'
|
|
|
| +ORIGINAL_ENV = {}
|
| +
|
| def OutputAnnotationStepStart(name):
|
| """Outputs appropriate annotation to signal the start of a step to
|
| a trybot.
|
| @@ -283,6 +285,29 @@ def SetupCrosRepo():
|
| return passed
|
|
|
|
|
| +def CopyAndSaveOriginalEnvironmentVars():
|
| + """Makes a copy of the current environment variables."""
|
| + # TODO: Waiting on crbug.com/255689, will remove this after.
|
| + vars_to_remove = []
|
| + for k, v in os.environ.iteritems():
|
| + if 'ANDROID' in k:
|
| + vars_to_remove.append(k)
|
| + vars_to_remove.append('CHROME_SRC')
|
| + vars_to_remove.append('CHROMIUM_GYP_FILE')
|
| + vars_to_remove.append('GOMA_DIR')
|
| + vars_to_remove.append('GYP_CROSSCOMPILE')
|
| + vars_to_remove.append('GYP_DEFINES')
|
| + vars_to_remove.append('GYP_GENERATORS')
|
| + vars_to_remove.append('GYP_GENERATOR_FLAGS')
|
| + vars_to_remove.append('OBJCOPY')
|
| + for k in vars_to_remove:
|
| + if os.environ.has_key(k):
|
| + del os.environ[k]
|
| +
|
| + global ORIGINAL_ENV
|
| + ORIGINAL_ENV = os.environ.copy()
|
| +
|
| +
|
| def SetupAndroidBuildEnvironment(opts):
|
| """Sets up the android build environment.
|
|
|
| @@ -293,6 +318,15 @@ def SetupAndroidBuildEnvironment(opts):
|
| Returns:
|
| True if successful.
|
| """
|
| +
|
| + # Revert the environment variables back to default before setting them up
|
| + # with envsetup.sh.
|
| + env_vars = os.environ.copy()
|
| + for k, _ in env_vars.iteritems():
|
| + del os.environ[k]
|
| + for k, v in ORIGINAL_ENV.iteritems():
|
| + os.environ[k] = v
|
| +
|
| path_to_file = os.path.join('build', 'android', 'envsetup.sh')
|
| proc = subprocess.Popen(['bash', '-c', 'source %s && env' % path_to_file],
|
| stdout=subprocess.PIPE,
|
| @@ -317,6 +351,7 @@ def SetupPlatformBuildEnvironment(opts):
|
| True if successful.
|
| """
|
| if opts.target_platform == 'android':
|
| + CopyAndSaveOriginalEnvironmentVars()
|
| return SetupAndroidBuildEnvironment(opts)
|
| elif opts.target_platform == 'cros':
|
| return SetupCrosRepo()
|
|
|