cros_setup_toolchains: Also copy .elf file from noccache version
The compiler wrapper is a dynamically linked binary, so we
also need to copy the .elf file, and not just the binary
wrapper.
BUG=chromium:1012806
TEST=Build standalone toolchain via:
TEST=sudo $(which cros_setup_toolchains) --create-packages \
TEST=--output-dir /tmp/toolchain-pkgs -t x86_64-cros-linux-gnu
TEST=Unpack the toolchain and call:
TEST=usr/x86_64-pc-linux-gnu/x86_64-cros-linux-gnu/gcc-bin/\
TEST=4.9.x/x86_64-cros-linux-gnu-clang -print-config
TEST=Verify that this prints ...useCCache:false...
Change-Id: Ide0a187ea7823740c38cd09a0f8f89f35f61f808
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/chromite/+/1849457
Tested-by: Tobias Bosch <tbosch@google.com>
Commit-Queue: Manoj Gupta <manojgupta@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
diff --git a/scripts/cros_setup_toolchains.py b/scripts/cros_setup_toolchains.py
index 7e58af3..730f972 100644
--- a/scripts/cros_setup_toolchains.py
+++ b/scripts/cros_setup_toolchains.py
@@ -1158,7 +1158,6 @@
"""Remove chroot-specific things from our sysroot wrappers"""
# Disable ccache since we know it won't work outside of chroot.
- # Update the new go wrapper.
# Use the version of the wrapper that does not use ccache.
for sysroot_wrapper in glob.glob(os.path.join(
output_dir + srcpath, 'sysroot_wrapper*.ccache')):
@@ -1166,35 +1165,7 @@
# but only the extracted toolchain.
os.unlink(sysroot_wrapper)
shutil.copy(sysroot_wrapper[:-6] + 'noccache', sysroot_wrapper)
-
- # Update the old python wrapper
- # TODO(crbug/773875): Remove this logic once the go wrapper
- # is rolled out.
- old_wrapper_paths = [os.path.join(output_dir + srcpath,
- 'sysroot_wrapper'),
- os.path.join(output_dir + srcpath,
- 'sysroot_wrapper.hardened')]
- for sysroot_wrapper in old_wrapper_paths:
- if not os.path.exists(sysroot_wrapper):
- continue
- contents = osutils.ReadFile(sysroot_wrapper).splitlines()
-
- # In order to optimize startup time in the chroot we run python a little
- # differently there. Put it back to the more portable way here.
- # See https://crbug.com/773138 for some details.
- if contents[0] == '#!/usr/bin/python2 -S':
- contents[0] = '#!/usr/bin/env python2'
-
- for num, line in enumerate(contents):
- if '@CCACHE_DEFAULT@' in line:
- assert 'True' in line
- contents[num] = line.replace('True', 'False')
- break
- # Can't update the wrapper in place to not affect the chroot,
- # but only the extracted toolchain.
- os.unlink(sysroot_wrapper)
- osutils.WriteFile(sysroot_wrapper, '\n'.join(contents))
- os.chmod(sysroot_wrapper, 0o755)
+ shutil.copy(sysroot_wrapper[:-6] + 'noccache.elf', sysroot_wrapper + '.elf')
def _CreateMainLibDir(target, output_dir):