Fix bug where gold is not selected in new chroots.
In CL:37326, I updated cros_setup_toolchains to skip the
SelectActiveToolchains step when no new toolchains were installed. This
introduced a bug, because the 'gold' linker is not necessarily selected by
default in the SDK. To fix this bug without affecting speed, I've
updated cros_setup_toolchains to always run SelectActiveToolchains, but
implemented the check for the current active toolchain in a more
efficient way.
BUG=none
TEST=Verify gold is now selected again in new chroots.
Change-Id: Ic8cdab7273346de55e75c277bc4b895955cbabd7
Reviewed-on: https://gerrit.chromium.org/gerrit/37444
Commit-Ready: David James <davidjames@chromium.org>
Tested-by: David James <davidjames@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
diff --git a/scripts/cros_setup_toolchains.py b/scripts/cros_setup_toolchains.py
index 7c1de26..86a882b 100644
--- a/scripts/cros_setup_toolchains.py
+++ b/scripts/cros_setup_toolchains.py
@@ -453,7 +453,7 @@
if not packages:
print 'Nothing to update!'
- return False
+ return
print 'Updating packages:'
print packages
@@ -464,7 +464,6 @@
cmd.extend(packages)
cros_build_lib.RunCommand(cmd)
- return True
def CleanTargets(targets):
@@ -525,9 +524,10 @@
if target in suffixes[package]:
desired += suffixes[package][target]
- cmd = [ package + '-config', '-c', target ]
+ extra_env = {'CHOST': target}
+ cmd = ['%s-config' % package, '-c', target]
current = cros_build_lib.RunCommand(cmd, print_cmd=False,
- redirect_stdout=True).output.splitlines()[0]
+ redirect_stdout=True, extra_env=extra_env).output.splitlines()[0]
# Do not gcc-config when the current is live or nothing needs to be done.
if current != desired and current != '9999':
cmd = [ package + '-config', desired ]
@@ -588,11 +588,12 @@
targets['host'] = {}
# Now update all packages.
- if UpdateTargets(targets, usepkg):
- SelectActiveToolchains(targets, CONFIG_TARGET_SUFFIXES)
+ UpdateTargets(targets, usepkg)
- if deleteold:
- CleanTargets(targets)
+ SelectActiveToolchains(targets, CONFIG_TARGET_SUFFIXES)
+
+ if deleteold:
+ CleanTargets(targets)
def main(argv):