diff options
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2022-05-10 07:23:33 +0000 |
---|---|---|
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2022-05-10 07:23:33 +0000 |
commit | cdb14f8af52b9819d9f499cc3caa398ebb0051ac (patch) | |
tree | b0522edde1d3c5356c95eb1ee2eae3e87befa1f3 /compiler_wrapper/reset_compiler_wrapper.sh | |
parent | f4de9d68440e8683b2497074fdc2d1108c851c2a (diff) | |
parent | 882a18888febb9cb0b9d6c6069498cbc4aa30f88 (diff) | |
download | toolchain-utils-cdb14f8af52b9819d9f499cc3caa398ebb0051ac.tar.gz |
Snap for 8564071 from 882a18888febb9cb0b9d6c6069498cbc4aa30f88 to mainline-os-statsd-releaseaml_sta_331910000aml_sta_331811000aml_sta_331711010aml_sta_331610000aml_sta_331511000aml_sta_331410000aml_sta_331311000aml_sta_331010010aml_sta_330910000android13-mainline-os-statsd-release
Change-Id: I72dc5929f7daf6bde83bea832bc2821e0f026515
Diffstat (limited to 'compiler_wrapper/reset_compiler_wrapper.sh')
-rwxr-xr-x | compiler_wrapper/reset_compiler_wrapper.sh | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/compiler_wrapper/reset_compiler_wrapper.sh b/compiler_wrapper/reset_compiler_wrapper.sh new file mode 100755 index 00000000..523e972d --- /dev/null +++ b/compiler_wrapper/reset_compiler_wrapper.sh @@ -0,0 +1,42 @@ +#!/bin/bash -eux +# +# Copyright 2021 The Chromium OS Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# If your compiler wrapper ends up broken, you can run this script to try to +# restore it to a working version. We can only use artifacts we download from +# gs://, since it's kind of hard to build a working compiler with a broken +# compiler wrapper. ;) + +if [[ ! -e "/etc/cros_chroot_version" ]]; then + echo "Run me inside of the chroot." + exit 1 +fi + +packages_to_reemerge=( + # We want to reemerge the host wrapper... + sys-devel/llvm +) + +gcc_wrappers=( + cross-x86_64-cros-linux-gnu/gcc + cross-armv7a-cros-linux-gnueabihf/gcc + cross-aarch64-cros-linux-gnu/gcc +) + +# ...and any existing target wrappers. +for gcc in "${gcc_wrappers[@]}"; do + # cheap check for whether or not the package in question is already installed + if ls /var/db/pkg/"${gcc}"-* >& /dev/null; then + packages_to_reemerge+=( "${gcc}" ) + fi +done + +# Ensure that we don't pick up any broken binpkgs for these when we install +# them below. +for pkg in "${packages_to_reemerge[@]}"; do + sudo rm -f "/var/lib/portage/pkgs/${pkg}"* +done + +sudo emerge -j16 -G "${packages_to_reemerge[@]}" |