Zachary Leaf | 782c54a | 2024-09-24 14:33:24 +0100 | [diff] [blame] | 1 | #!/usr/bin/env bash |
| 2 | # |
| 3 | # Copyright (c) 2024 Arm Limited. All rights reserved. |
| 4 | # |
| 5 | # SPDX-License-Identifier: BSD-3-Clause |
| 6 | # |
| 7 | pre_tf_build() { |
Zachary Leaf | 2a7aebf | 2024-10-11 15:25:49 +0100 | [diff] [blame^] | 8 | # pre_tf_build() and other call hooks are invoked from within subshells, so |
| 9 | # environment variables are lost when calling (except $PATH somehow is |
| 10 | # retained) |
| 11 | # |
| 12 | # rustup is installed by the root user in a non-default location |
| 13 | # /usr/local/rustup, so $RUSTUP_HOME is required to access rust config |
| 14 | # e.g. default toolchains and run cargo |
| 15 | # |
| 16 | # leave $CARGO_HOME blank so when this is run by the buildslave user it uses |
| 17 | # the default /home/buildslave/.cargo directory which it has write |
| 18 | # permissions for - that allows it to download new crates during compilation |
| 19 | # |
| 20 | # since rust was installed by root, buildslave user does not have write |
| 21 | # access to /usr/local/cargo and will error when trying to download new |
| 22 | # crates otherwise |
| 23 | # |
| 24 | # note: $PATH still contains /usr/local/cargo/bin at this point so cargo is |
| 25 | # still run via the root installation |
| 26 | # |
| 27 | # see https://github.com/rust-lang/rustup/issues/1085 |
| 28 | export RUSTUP_HOME=/usr/local/rustup |
Zachary Leaf | 7937b86 | 2024-10-11 12:33:50 +0100 | [diff] [blame] | 29 | make -C "$tf_root/rust" |
| 30 | make -C "$tf_root/rust" clippy |
Zachary Leaf | 782c54a | 2024-09-24 14:33:24 +0100 | [diff] [blame] | 31 | } |