From 6a3ee0d453ef92dcad4fe4eaa21d8f58eb0e6529 Mon Sep 17 00:00:00 2001 From: Andrea Giacobino Date: Mon, 24 Jun 2024 11:56:32 +0200 Subject: [PATCH] Automatically detect the SRTOOL version to use (#105) --- scripts/build-tracing-runtime.sh | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/scripts/build-tracing-runtime.sh b/scripts/build-tracing-runtime.sh index f7146b1..b241d33 100755 --- a/scripts/build-tracing-runtime.sh +++ b/scripts/build-tracing-runtime.sh @@ -6,16 +6,13 @@ ALL_RUNTIMES_NAMES=( moonriver moonbeam ) -SRTOOL_IMAGE="paritytech/srtool:1.77.0" + # Arguments VERSION=$1 RUNTIME_NAME_FILTER=${2:-"[a-z]"} CARGO_BUILD_JOBS=${3:-"8"} -# Download srtool image -docker pull $SRTOOL_IMAGE - # Copy the needed source code in a temporary folder mkdir -p tmp/build/tracing cp -r tracing/${VERSION} tmp/build/tracing/${VERSION} @@ -23,6 +20,18 @@ cp -r tracing/shared tmp/build/tracing/${VERSION}/shared cd tmp/build/tracing/${VERSION} chmod -R 777 runtime + +# get the toolchain rust version +RUST_VERSION=$(cat rust-toolchain | grep channel | grep --only-matching --perl-regexp "(\d+\.){2}\d+") +# if the version is empty, default to 1.69.0 (that is for runtime before 2300) +if [ -z "$RUST_VERSION" ]; then + RUST_VERSION="1.69.0" +fi +SRTOOL_IMAGE="paritytech/srtool:$RUST_VERSION" + +# Download srtool image +docker pull $SRTOOL_IMAGE + for RUNTIME_NAME in ${ALL_RUNTIMES_NAMES[@]}; do RUNTIME_DIR="runtime/$RUNTIME_NAME" if [[ "$RUNTIME_NAME" =~ $RUNTIME_NAME_FILTER ]]; then