ci: Remove cargo symlink workaround
Symlinking $CARGO_HOME to /usr/local/bin made rustup uninstaller delete the entire folder, causing mysterious build errors, so let's do the traditional .cargo/env sourcing to make rustup available to the rest of the build scripts. Also make sure that required scripts run the shell's rcfile to be able to setup the PATH correctly. Signed-off-by: Guilherme Gallo <guilherme.gallo@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33519>
This commit is contained in:
committed by
Marge Bot
parent
a663f97d2d
commit
8af7f8b7fe
@@ -61,7 +61,7 @@
|
||||
- .use-debian/x86_64_build
|
||||
stage: build-only
|
||||
script:
|
||||
- &meson-build timeout --verbose ${BUILD_JOB_TIMEOUT_OVERRIDE:-$BUILD_JOB_TIMEOUT} .gitlab-ci/meson/build.sh
|
||||
- &meson-build timeout --verbose ${BUILD_JOB_TIMEOUT_OVERRIDE:-$BUILD_JOB_TIMEOUT} bash --login .gitlab-ci/meson/build.sh
|
||||
|
||||
|
||||
# Make sure this list stays the same as all the jobs with
|
||||
|
||||
@@ -7,12 +7,6 @@ set -ex
|
||||
|
||||
uncollapsed_section_start rust "Building Rust toolchain"
|
||||
|
||||
# cargo (and rustup) wants to store stuff in $HOME/.cargo, and binaries in
|
||||
# $HOME/.cargo/bin. Make bin a link to a public bin directory so the commands
|
||||
# are just available to all build jobs.
|
||||
mkdir -p "$HOME"/.cargo
|
||||
ln -s /usr/local/bin "$HOME"/.cargo/bin
|
||||
|
||||
# Pick a specific snapshot from rustup so the compiler doesn't drift on us.
|
||||
RUST_VERSION=1.78.0-2024-05-02
|
||||
|
||||
@@ -25,6 +19,10 @@ curl -L --retry 4 -f --retry-all-errors --retry-delay 60 \
|
||||
--profile minimal \
|
||||
-y
|
||||
|
||||
# Make rustup tools available in the PATH environment variable
|
||||
# shellcheck disable=SC1091
|
||||
. "$HOME/.cargo/env"
|
||||
|
||||
rustup component add clippy rustfmt
|
||||
|
||||
# Set up a config script for cross compiling -- cargo needs your system cc for
|
||||
|
||||
@@ -6,8 +6,6 @@ fi
|
||||
|
||||
# Clean up any build cache
|
||||
rm -rf /root/.cache
|
||||
rm -rf /root/.cargo
|
||||
rm -rf /.cargo
|
||||
|
||||
if test -x /usr/bin/ccache; then
|
||||
ccache --show-stats
|
||||
|
||||
@@ -42,3 +42,10 @@ echo -e "retry_connrefused = on\n" \
|
||||
"retry_on_host_error = on\n" \
|
||||
"retry_on_http_error = 429,500,502,503,504\n" \
|
||||
"wait_retry = 32" >> /etc/wgetrc
|
||||
|
||||
# Ensure that rust tools are in PATH if they exist
|
||||
CARGO_ENV_FILE="$HOME/.cargo/env"
|
||||
if [ -f "$CARGO_ENV_FILE" ]; then
|
||||
# shellcheck disable=SC1090
|
||||
source "$CARGO_ENV_FILE"
|
||||
fi
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
variables:
|
||||
DEBIAN_X86_64_BUILD_BASE_IMAGE: "debian/x86_64_build-base"
|
||||
DEBIAN_BASE_TAG: "20250213-rustup"
|
||||
DEBIAN_BASE_TAG: "20250218-rustup"
|
||||
|
||||
DEBIAN_X86_64_BUILD_IMAGE_PATH: "debian/x86_64_build"
|
||||
DEBIAN_BUILD_TAG: "20250210-android-drm"
|
||||
|
||||
@@ -40,6 +40,7 @@ rustfmt:
|
||||
- .lint-rustfmt-rules
|
||||
before_script:
|
||||
- shopt -s globstar
|
||||
- source "$HOME/.cargo/env"
|
||||
- rustfmt --version
|
||||
- rustfmt --verbose src/**/lib.rs
|
||||
|
||||
|
||||
Reference in New Issue
Block a user