tfa-next: don't override RUSTUP_HOME for local CI runs
When running CI locally, RUSTUP_HOME should not be set to
/usr/local/rustup as it's currently being done.
It should be updated to /usr/local/rustup only when running on
jenkins.
Change-Id: I706eaf006ad4a4409a86fea02c969e9127a43cea
Signed-off-by: Tomás González <tomasagustin.gonzalezorlando@arm.com>
diff --git a/group/tf-next-build/fvp-next:nil b/group/tf-next-build/fvp-next:nil
index bdb903f..ea434db 100644
--- a/group/tf-next-build/fvp-next:nil
+++ b/group/tf-next-build/fvp-next:nil
@@ -5,37 +5,39 @@
# SPDX-License-Identifier: BSD-3-Clause
#
pre_tf_build() {
- # pre_tf_build() and other call hooks are invoked from within subshells, so
- # environment variables are lost when calling them (except $PATH somehow is
- # retained)
- # - use `set_hook_var` to propagate to other levels, e.g. the actual
- # tf_build() stage
- # - use `export $VAR=` for use inside this pre_tf_build() stage
- #
- # In the CI Dockerfile, rustup is installed by the root user in the
- # non-default location /usr/local/rustup, so $RUSTUP_HOME is required to
- # access rust config e.g. default toolchains and run cargo
- #
- # Leave $CARGO_HOME blank so when this script is run in CI by the buildslave
- # user, it uses the default /home/buildslave/.cargo directory which it has
- # write permissions for - that allows it to download new crates during
- # compilation
- #
- # The buildslave user does not have write permissions to the default
- # $CARGO_HOME=/usr/local/cargo dir and so will error when trying to download
- # new crates otherwise
- #
- # note: $PATH still contains /usr/local/cargo/bin at this point so cargo is
- # still run via the root installation
- #
- # see https://github.com/rust-lang/rustup/issues/1085
- #
- # set_hook_var propagates RUSTUP_HOME var to lower levels...
- set_hook_var RUSTUP_HOME /usr/local/rustup
- # ...but not to pre_tf_build() - explicit exporting is required to run
- # clippy here
- export RUSTUP_HOME=/usr/local/rustup
- make PLAT=fvp -C "$tf_root/rust" clippy
+ if not_upon "$local_ci"; then
+ # pre_tf_build() and other call hooks are invoked from within subshells, so
+ # environment variables are lost when calling them (except $PATH somehow is
+ # retained)
+ # - use `set_hook_var` to propagate to other levels, e.g. the actual
+ # tf_build() stage
+ # - use `export $VAR=` for use inside this pre_tf_build() stage
+ #
+ # In the CI Dockerfile, rustup is installed by the root user in the
+ # non-default location /usr/local/rustup, so $RUSTUP_HOME is required to
+ # access rust config e.g. default toolchains and run cargo
+ #
+ # Leave $CARGO_HOME blank so when this script is run in CI by the buildslave
+ # user, it uses the default /home/buildslave/.cargo directory which it has
+ # write permissions for - that allows it to download new crates during
+ # compilation
+ #
+ # The buildslave user does not have write permissions to the default
+ # $CARGO_HOME=/usr/local/cargo dir and so will error when trying to download
+ # new crates otherwise
+ #
+ # note: $PATH still contains /usr/local/cargo/bin at this point so cargo is
+ # still run via the root installation
+ #
+ # see https://github.com/rust-lang/rustup/issues/1085
+ #
+ # set_hook_var propagates RUSTUP_HOME var to lower levels...
+ set_hook_var RUSTUP_HOME /usr/local/rustup
+ # ...but not to pre_tf_build() - explicit exporting is required to run
+ # clippy here
+ export RUSTUP_HOME=/usr/local/rustup
+ make PLAT=fvp -C "$tf_root/rust" clippy
+ fi
}
post_tf_build() {
diff --git a/group/tf-next-build/qemu-next:nil b/group/tf-next-build/qemu-next:nil
index ec06601..f6bf20c 100644
--- a/group/tf-next-build/qemu-next:nil
+++ b/group/tf-next-build/qemu-next:nil
@@ -5,35 +5,37 @@
# SPDX-License-Identifier: BSD-3-Clause
#
pre_tf_build() {
- # pre_tf_build() and other call hooks are invoked from within subshells, so
- # environment variables are lost when calling them (except $PATH somehow is
- # retained)
- # - use `set_hook_var` to propagate to other levels, e.g. the actual
- # tf_build() stage
- # - use `export $VAR=` for use inside this pre_tf_build() stage
- #
- # In the CI Dockerfile, rustup is installed by the root user in the
- # non-default location /usr/local/rustup, so $RUSTUP_HOME is required to
- # access rust config e.g. default toolchains and run cargo
- #
- # Leave $CARGO_HOME blank so when this script is run in CI by the buildslave
- # user, it uses the default /home/buildslave/.cargo directory which it has
- # write permissions for - that allows it to download new crates during
- # compilation
- #
- # The buildslave user does not have write permissions to the default
- # $CARGO_HOME=/usr/local/cargo dir and so will error when trying to download
- # new crates otherwise
- #
- # note: $PATH still contains /usr/local/cargo/bin at this point so cargo is
- # still run via the root installation
- #
- # see https://github.com/rust-lang/rustup/issues/1085
- #
- # set_hook_var propagates RUSTUP_HOME var to lower levels...
- set_hook_var RUSTUP_HOME /usr/local/rustup
- # ...but not to pre_tf_build() - explicit exporting is required to run
- # clippy here
- export RUSTUP_HOME=/usr/local/rustup
- make PLAT=qemu -C "$tf_root/rust" clippy
+ if not_upon "$local_ci"; then
+ # pre_tf_build() and other call hooks are invoked from within subshells, so
+ # environment variables are lost when calling them (except $PATH somehow is
+ # retained)
+ # - use `set_hook_var` to propagate to other levels, e.g. the actual
+ # tf_build() stage
+ # - use `export $VAR=` for use inside this pre_tf_build() stage
+ #
+ # In the CI Dockerfile, rustup is installed by the root user in the
+ # non-default location /usr/local/rustup, so $RUSTUP_HOME is required to
+ # access rust config e.g. default toolchains and run cargo
+ #
+ # Leave $CARGO_HOME blank so when this script is run in CI by the buildslave
+ # user, it uses the default /home/buildslave/.cargo directory which it has
+ # write permissions for - that allows it to download new crates during
+ # compilation
+ #
+ # The buildslave user does not have write permissions to the default
+ # $CARGO_HOME=/usr/local/cargo dir and so will error when trying to download
+ # new crates otherwise
+ #
+ # note: $PATH still contains /usr/local/cargo/bin at this point so cargo is
+ # still run via the root installation
+ #
+ # see https://github.com/rust-lang/rustup/issues/1085
+ #
+ # set_hook_var propagates RUSTUP_HOME var to lower levels...
+ set_hook_var RUSTUP_HOME /usr/local/rustup
+ # ...but not to pre_tf_build() - explicit exporting is required to run
+ # clippy here
+ export RUSTUP_HOME=/usr/local/rustup
+ make PLAT=qemu -C "$tf_root/rust" clippy
+ fi
}