diff options
author | George Burgess IV <gbiv@google.com> | 2020-10-08 12:50:27 -0700 |
---|---|---|
committer | George Burgess <gbiv@chromium.org> | 2020-10-09 17:17:16 +0000 |
commit | 8ecb53f8c692c56f1f824c377fe51a5789616713 (patch) | |
tree | be327a91cefd839858bc4e32b1f1609408ecc254 /rust_tools | |
parent | 6868239551ebbefe0a87f0ff8565917c4f2859f5 (diff) | |
download | toolchain-utils-8ecb53f8c692c56f1f824c377fe51a5789616713.tar.gz |
rust_uprev: emerge arm-none-eabi-gcc & do it in parallel
arm-none-eabi-gcc isn't mentioned in the list of RUSTC_TARGET_TRIPLES,
though it's necessary (we check for it in the ebuild)
While I'm in the area, if we're unconditionally emerge'ing all of these
anyway, do it in parallel. Doing so makes installation take 1/4 as long.
BUG=chromium:1136579, chromium:1112551
TEST=Ran the script
Change-Id: I49063487b2e2b2c83e2ef30dd8f8904b13c59f38
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/2462927
Reviewed-by: Tiancong Wang <tcwang@google.com>
Tested-by: George Burgess <gbiv@chromium.org>
Diffstat (limited to 'rust_tools')
-rwxr-xr-x | rust_tools/rust_uprev.py | 15 | ||||
-rwxr-xr-x | rust_tools/rust_uprev_test.py | 13 |
2 files changed, 19 insertions, 9 deletions
diff --git a/rust_tools/rust_uprev.py b/rust_tools/rust_uprev.py index 1d29556d..4fdae60f 100755 --- a/rust_tools/rust_uprev.py +++ b/rust_tools/rust_uprev.py @@ -594,12 +594,23 @@ def build_cross_compiler() -> None: m = target_triples_re.search(contents) assert m, 'RUST_TARGET_TRIPLES not found in rust ebuild' target_triples = m.group(1).strip().split('\n') + + compiler_targets_to_install = [ + target.strip() for target in target_triples if 'cros-' in target + ] for target in target_triples: if 'cros-' not in target: continue target = target.strip() - logging.info('Emerging cross compiler %s', target) - subprocess.check_call(['sudo', 'emerge', '-G', f'cross-{target}/gcc']) + + # We also always need arm-none-eabi, though it's not mentioned in + # RUSTC_TARGET_TRIPLES. + compiler_targets_to_install.append('arm-none-eabi') + + logging.info('Emerging cross compilers %s', compiler_targets_to_install) + subprocess.check_call( + ['sudo', 'emerge', '-j', '-G'] + + [f'cross-{target}/gcc' for target in compiler_targets_to_install]) def create_new_commit(rust_version: RustVersion) -> None: diff --git a/rust_tools/rust_uprev_test.py b/rust_tools/rust_uprev_test.py index d13ce912..fc506004 100755 --- a/rust_tools/rust_uprev_test.py +++ b/rust_tools/rust_uprev_test.py @@ -436,8 +436,9 @@ class RustUprevOtherStagesTests(unittest.TestCase): def test_build_cross_compiler(self, mock_call, mock_output): mock_output.return_value = f'rust-{self.new_version}.ebuild' cros_targets = [ - 'x86_64-cros-linux-gnu', 'armv7a-cros-linux-gnueabihf', - 'aarch64-cros-linux-gnu' + 'x86_64-cros-linux-gnu', + 'armv7a-cros-linux-gnueabihf', + 'aarch64-cros-linux-gnu', ] all_triples = ['x86_64-pc-linux-gnu'] + cros_targets rust_ebuild = 'RUSTC_TARGET_TRIPLES=(' + '\n\t'.join(all_triples) + ')' @@ -445,11 +446,9 @@ class RustUprevOtherStagesTests(unittest.TestCase): with mock.patch('builtins.open', mock_open): rust_uprev.build_cross_compiler() - emerge_calls = [ - mock.call(['sudo', 'emerge', '-G', f'cross-{x}/gcc']) - for x in cros_targets - ] - mock_call.assert_has_calls(emerge_calls) + mock_call.assert_called_once_with( + ['sudo', 'emerge', '-j', '-G'] + + [f'cross-{x}/gcc' for x in cros_targets + ['arm-none-eabi']]) if __name__ == '__main__': |