diff options
-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__': |