gstreamer/ci/scripts/source_image_env.sh
Jordan Petridis 9c5523d529 ci: Make it easier to run the build scripts locally
* Move the exported PATH variables into a script so
we can source it in all the wrapper scripts.

* Add a guard to only copy over the cache when the
SUBPROJECTS_CACHE_DIR variable is set, which only
happens on CI by default

* Make it possible to run the scripts with default
values for some of the variables, like WERROR and MESON_ARGS.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7591>
2024-10-28 13:47:18 +00:00

25 lines
725 B
Bash

#! /bin/bash
image_cache="${SUBPROJECTS_CACHE_DIR:-}"
# On the CI image we install the rust toolcahin under this path
# If it exists set the HOME and PATH variables and print the versions
# of what we have installed
cargo_binary="/usr/local/cargo/bin/cargo";
if [[ -e "$cargo_binary" ]]; then
export RUSTUP_HOME="/usr/local/rustup"
export CARGO_HOME="/usr/local/cargo"
export PATH="/usr/local/cargo/bin:$PATH"
rustup --version
rustc --version
cargo --version
cargo cinstall --version
fi
# Only copy the cache over if the variable is set, which usually only happens on CI.
if [ -n "$image_cache" ]; then
date -R
ci/scripts/handle-subprojects-cache.py --cache-dir "$image_cache" subprojects/
date -R
fi