Skip to content

Commit 16be955

Browse files
authored
Merge branch 'main' into feature/pre-commit-hook_support_1138
2 parents cf7d654 + e3e3ed7 commit 16be955

17 files changed

+424
-14
lines changed

src/nvidia-cuda/install.sh

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,24 @@ export DEBIAN_FRONTEND=noninteractive
4444

4545
check_packages wget ca-certificates
4646

47+
# Determine system architecture and set NVIDIA repository URL accordingly
48+
ARCH=$(uname -m)
49+
case $ARCH in
50+
x86_64)
51+
NVIDIA_ARCH="x86_64"
52+
;;
53+
aarch64 | arm64)
54+
NVIDIA_ARCH="arm64"
55+
;;
56+
*)
57+
echo "Unsupported architecture: $ARCH"
58+
exit 1
59+
;;
60+
esac
61+
4762
# Add NVIDIA's package repository to apt so that we can download packages
48-
# Always use the ubuntu2004 repo because the other repos (e.g., debian11) are missing packages
4963
# Updating the repo to ubuntu2204 as ubuntu 20.04 is going out of support.
50-
NVIDIA_REPO_URL="https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64"
64+
NVIDIA_REPO_URL="https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/$NVIDIA_ARCH"
5165
KEYRING_PACKAGE="cuda-keyring_1.0-1_all.deb"
5266
KEYRING_PACKAGE_URL="$NVIDIA_REPO_URL/$KEYRING_PACKAGE"
5367
KEYRING_PACKAGE_PATH="$(mktemp -d)"
@@ -62,6 +76,10 @@ nvtx_pkg="cuda-nvtx-${CUDA_VERSION/./-}"
6276
toolkit_pkg="cuda-toolkit-${CUDA_VERSION/./-}"
6377
if ! apt-cache show "$cuda_pkg"; then
6478
echo "The requested version of CUDA is not available: CUDA $CUDA_VERSION"
79+
if [ "$NVIDIA_ARCH" = "arm64" ]; then
80+
echo "Note: arm64 supports limited CUDA versions. Please check available versions:"
81+
echo "https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/arm64"
82+
fi
6583
exit 1
6684
fi
6785

@@ -93,6 +111,9 @@ if [ "$INSTALL_CUDNN" = "true" ]; then
93111

94112
if ! apt-cache show "$cudnn_pkg_version"; then
95113
echo "The requested version of cuDNN is not available: cuDNN $CUDNN_VERSION for CUDA $CUDA_VERSION"
114+
if [ "$NVIDIA_ARCH" = "arm64" ]; then
115+
echo "Note: arm64 has limited cuDNN package availability"
116+
fi
96117
exit 1
97118
fi
98119

@@ -112,6 +133,9 @@ if [ "$INSTALL_CUDNNDEV" = "true" ]; then
112133
fi
113134
if ! apt-cache show "$cudnn_dev_pkg_version"; then
114135
echo "The requested version of cuDNN development package is not available: cuDNN $CUDNN_VERSION for CUDA $CUDA_VERSION"
136+
if [ "$NVIDIA_ARCH" = "arm64" ]; then
137+
echo "Note: arm64 has limited cuDNN development package availability"
138+
fi
115139
exit 1
116140
fi
117141

src/rust/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ Installs Rust, common Rust utilities, and their required dependencies
1818
| version | Select or enter a version of Rust to install. | string | latest |
1919
| profile | Select a rustup install profile. | string | minimal |
2020
| targets | Optional comma separated list of additional Rust targets to install. | string | - |
21+
| components | Optional comma separeated list of rust components to be installed based on input. | string | rust-analyzer,rust-src,rustfmt,clippy |
2122

2223
## Customizations
2324

src/rust/devcontainer-feature.json

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"id": "rust",
3-
"version": "1.4.0",
3+
"version": "1.5.0",
44
"name": "Rust",
55
"documentationURL": "https://github.com/devcontainers/features/tree/main/src/rust",
66
"description": "Installs Rust, common Rust utilities, and their required dependencies",
@@ -57,7 +57,18 @@
5757
"armv7-unknown-linux-gnueabihf",
5858
"x86_64-unknown-redox,x86_64-unknown-uefi"
5959
]
60-
}
60+
},
61+
"components": {
62+
"type": "string",
63+
"default": "rust-analyzer,rust-src,rustfmt,clippy",
64+
"description": "Optional, comma separated list of Rust components to be installed",
65+
"proposals": [
66+
"rust-analyzer,rust-src,rustfmt,clippy",
67+
"rust-analyzer,rust-src",
68+
"rustfmt,clippy,rust-docs",
69+
"llvm-tools-preview,rust-src,rustfmt"
70+
]
71+
}
6172
},
6273
"customizations": {
6374
"vscode": {

src/rust/install.sh

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
RUST_VERSION="${VERSION:-"latest"}"
1111
RUSTUP_PROFILE="${PROFILE:-"minimal"}"
1212
RUSTUP_TARGETS="${TARGETS:-""}"
13+
IFS=',' read -ra components <<< "${COMPONENTS:-rust-analyzer,rust-src,rustfmt,clippy}"
1314

1415
export CARGO_HOME="${CARGO_HOME:-"/usr/local/cargo"}"
1516
export RUSTUP_HOME="${RUSTUP_HOME:-"/usr/local/rustup"}"
@@ -394,8 +395,19 @@ if [ "${UPDATE_RUST}" = "true" ]; then
394395
echo "Updating Rust..."
395396
rustup update 2>&1
396397
fi
397-
echo "Installing common Rust dependencies..."
398-
rustup component add rust-analyzer rust-src rustfmt clippy 2>&1
398+
# Install Rust components
399+
echo "Installing Rust components..."
400+
for component in "${components[@]}"; do
401+
# Trim leading and trailing whitespace
402+
component="${component#"${component%%[![:space:]]*}"}" && component="${component%"${component##*[![:space:]]}"}"
403+
if [ -n "${component}" ]; then
404+
echo "Installing Rust component: ${component}"
405+
if ! rustup component add "${component}" 2>&1; then
406+
echo "Warning: Failed to install component '${component}'. It may not be available for this toolchain." >&2
407+
exit 1
408+
fi
409+
fi
410+
done
399411

400412
if [ -n "${RUSTUP_TARGETS}" ]; then
401413
IFS=',' read -ra targets <<< "${RUSTUP_TARGETS}"

test/rust/rust_with_almalinux_8.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,27 @@ set -e
55
# Optional: Import test library
66
source dev-container-features-test-lib
77

8+
# Helper function to check component is installed
9+
check_component_installed() {
10+
local component=$1
11+
if rustup component list | grep -q "${component}.*installed"; then
12+
return 0 # Component is installed (success)
13+
else
14+
return 1 # Component is not installed (failure)
15+
fi
16+
}
17+
818
# Definition specific tests
919
check "cargo version" cargo --version
1020
check "rustc version" rustc --version
1121
check "correct rust version" rustup target list | grep aarch64-unknown-linux-gnu
1222

23+
# Check that all specified extended components are installed
24+
check "rust-analyzer is installed" check_component_installed "rust-analyzer"
25+
check "rust-src is installed" check_component_installed "rust-src"
26+
check "rustfmt is installed" check_component_installed "rustfmt"
27+
check "clippy is installed" check_component_installed "clippy"
28+
check "rust-docs is installed" check_component_installed "rust-docs"
1329

1430
# Report result
1531
reportResults

test/rust/rust_with_almalinux_9.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,27 @@ set -e
55
# Optional: Import test library
66
source dev-container-features-test-lib
77

8+
# Helper function to check component is installed
9+
check_component_installed() {
10+
local component=$1
11+
if rustup component list | grep -q "${component}.*installed"; then
12+
return 0 # Component is installed (success)
13+
else
14+
return 1 # Component is not installed (failure)
15+
fi
16+
}
17+
818
# Definition specific tests
919
check "cargo version" cargo --version
1020
check "rustc version" rustc --version
1121
check "correct rust version" rustup target list | grep aarch64-unknown-linux-gnu
1222

23+
# Check that all specified extended components are installed
24+
check "rust-analyzer is installed" check_component_installed "rust-analyzer"
25+
check "rust-src is installed" check_component_installed "rust-src"
26+
check "rustfmt is installed" check_component_installed "rustfmt"
27+
check "clippy is installed" check_component_installed "clippy"
28+
check "rust-docs is installed" check_component_installed "rust-docs"
1329

1430
# Report result
1531
reportResults

test/rust/rust_with_centos.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,27 @@ set -e
55
# Optional: Import test library
66
source dev-container-features-test-lib
77

8+
# Helper function to check component is installed
9+
check_component_installed() {
10+
local component=$1
11+
if rustup component list | grep -q "${component}.*installed"; then
12+
return 0 # Component is installed (success)
13+
else
14+
return 1 # Component is not installed (failure)
15+
fi
16+
}
17+
818
# Definition specific tests
919
check "cargo version" cargo --version
1020
check "rustc version" rustc --version
1121
check "correct rust version" rustup target list | grep aarch64-unknown-linux-gnu
1222

23+
# Check that all specified extended components are installed
24+
check "rust-analyzer is installed" check_component_installed "rust-analyzer"
25+
check "rust-src is installed" check_component_installed "rust-src"
26+
check "rustfmt is installed" check_component_installed "rustfmt"
27+
check "clippy is installed" check_component_installed "clippy"
28+
check "rust-docs is installed" check_component_installed "rust-docs"
1329

1430
# Report result
1531
reportResults
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
# Optional: Import test library
6+
source dev-container-features-test-lib
7+
8+
# Helper function to check component is installed
9+
check_component_installed() {
10+
local component=$1
11+
if rustup component list | grep -q "${component}.*installed"; then
12+
return 0 # Component is installed (success)
13+
else
14+
return 1 # Component is not installed (failure)
15+
fi
16+
}
17+
18+
# Helper function to check component is NOT installed
19+
check_component_not_installed() {
20+
local component=$1
21+
if rustup component list | grep -q "${component}.*installed"; then
22+
return 1 # Component is installed (failure)
23+
else
24+
return 0 # Component is not installed (success)
25+
fi
26+
}
27+
28+
# Definition specific tests
29+
check "cargo version" cargo --version
30+
check "rustc version" rustc --version
31+
check "correct rust version" rustup target list | grep aarch64-unknown-linux-gnu
32+
33+
# Check that specified custom components are installed
34+
check "rust-analyzer is installed" check_component_installed "rust-analyzer"
35+
check "rust-src is installed" check_component_installed "rust-src"
36+
check "rustfmt is installed" check_component_installed "rustfmt"
37+
38+
# Check that clippy NOT installed
39+
check "clippy not installed" check_component_not_installed "clippy"
40+
41+
# Report result
42+
reportResults
43+
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
# Optional: Import test library
6+
source dev-container-features-test-lib
7+
8+
# Helper function to check component is installed
9+
check_component_installed() {
10+
local component=$1
11+
if rustup component list | grep -q "${component}.*installed"; then
12+
return 0 # Component is installed (success)
13+
else
14+
return 1 # Component is not installed (failure)
15+
fi
16+
}
17+
18+
# Definition specific tests
19+
check "cargo version" cargo --version
20+
check "rustc version" rustc --version
21+
check "correct rust version" rustup target list | grep aarch64-unknown-linux-gnu
22+
23+
# Check that default components are installed
24+
check "rust-analyzer is installed" check_component_installed "rust-analyzer"
25+
check "rust-src is installed" check_component_installed "rust-src"
26+
check "rustfmt is installed" check_component_installed "rustfmt"
27+
check "clippy is installed" check_component_installed "clippy"
28+
29+
# Report result
30+
reportResults
31+
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
# Optional: Import test library
6+
source dev-container-features-test-lib
7+
8+
# Helper function to check component is installed
9+
check_component_installed() {
10+
local component=$1
11+
if rustup component list | grep -q "${component}.*installed"; then
12+
return 0 # Component is installed (success)
13+
else
14+
return 1 # Component is not installed (failure)
15+
fi
16+
}
17+
18+
# Helper function to check component is NOT installed
19+
check_component_not_installed() {
20+
local component=$1
21+
if rustup component list | grep -q "${component}.*installed"; then
22+
return 1 # Component is installed (failure)
23+
else
24+
return 0 # Component is not installed (success)
25+
fi
26+
}
27+
28+
# Definition specific tests
29+
check "cargo version" cargo --version
30+
check "rustc version" rustc --version
31+
check "correct rust version" rustup target list | grep aarch64-unknown-linux-gnu
32+
33+
# Check that no additional components are installed when empty list is provided
34+
# Only the basic rust toolchain should be available
35+
check "basic rust toolchain" rustc --version
36+
37+
# Verify that default components are automatically installed
38+
check "rust-analyzer is installed" check_component_installed "rust-analyzer"
39+
check "rust-src is installed" check_component_installed "rust-src"
40+
check "rustfmt is installed" check_component_installed "rustfmt"
41+
check "clippy is installed" check_component_installed "clippy"
42+
43+
# Report result
44+
reportResults
45+

0 commit comments

Comments
 (0)