diff --git a/src/usr/local/containerbase/tools/v2/rust.sh b/src/usr/local/containerbase/tools/v2/rust.sh index 75e3cd7c7..d9ec5cff3 100644 --- a/src/usr/local/containerbase/tools/v2/rust.sh +++ b/src/usr/local/containerbase/tools/v2/rust.sh @@ -25,6 +25,15 @@ function init_tool () { chown -R "${USER_ID}" "${cargo_home}" } +function check_tool_requirements () { + if [[ "${TOOL_VERSION}" == "nightly" || "${TOOL_VERSION}" == "beta" ]]; then + # allow beta and nightly versions + return + fi + # Sensitive default that can be overwritten by tools if needed + check_semver "$TOOL_VERSION" "all" +} + function install_tool () { local versioned_tool_path local file @@ -55,7 +64,7 @@ function install_tool () { mkdir -p "${TEMP_DIR}/rust" bsdtar --strip 1 -C "${TEMP_DIR}/rust" -xf "${file}" versioned_tool_path=$(create_versioned_tool_path) - "${TEMP_DIR}/rust/install.sh" --prefix="$versioned_tool_path" --components=cargo,rust-std-"${arch}"-unknown-linux-gnu,rustc + "${TEMP_DIR}/rust/install.sh" --prefix="$versioned_tool_path" --components="cargo,rust-std-${arch}-unknown-linux-gnu,rustc" rm -rf "${TEMP_DIR}/rust" } diff --git a/test/rust/Dockerfile b/test/rust/Dockerfile index 7c24cbf9a..f5394b39e 100644 --- a/test/rust/Dockerfile +++ b/test/rust/Dockerfile @@ -90,6 +90,32 @@ RUN set -ex; \ ls -la /tmp/containerbase/cache; \ true +#-------------------------------------- +# test c: beta +#-------------------------------------- +FROM base AS testc + +USER 12021 + +RUN install-tool rust beta + +SHELL [ "/bin/sh", "-c" ] +RUN rustc --version +RUN cargo --version + +#-------------------------------------- +# test d: nightly +#-------------------------------------- +FROM base AS testd + +USER 12021 + +RUN install-tool rust nightly + +SHELL [ "/bin/sh", "-c" ] +RUN rustc --version +RUN cargo --version + #-------------------------------------- # final #-------------------------------------- @@ -97,3 +123,5 @@ FROM base COPY --from=testa /.dummy /.dummy COPY --from=testb /.dummy /.dummy +COPY --from=testc /.dummy /.dummy +COPY --from=testd /.dummy /.dummy