Skip to content

Commit bd81d72

Browse files
committed
fix(stm32): restore st-arm-clang install
1 parent c139429 commit bd81d72

1 file changed

Lines changed: 31 additions & 35 deletions

File tree

stm32/Dockerfile

Lines changed: 31 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,52 @@
11
FROM ubuntu:24.04
22

33
ARG DEBIAN_FRONTEND=noninteractive
4+
# Pin the last STM32Cube IDE core package that still ships the Linux cube
5+
# downloader. Newer 1.2.x packages currently only contain win32/cube.exe,
6+
# which would otherwise build a silently broken image without starm-clang.
7+
ARG STM32CUBE_IDE_CORE_VERSION=1.1.0
8+
ARG STM32CUBE_IDE_CORE_VSIX_URL="https://stmicroelectronics.gallerycdn.vsassets.io/extensions/stmicroelectronics/stm32cube-ide-core/1.1.0/1765810657223/Microsoft.VisualStudio.Services.VSIXPackage"
49

510
LABEL maintainer="2592509183@qq.com"
611
LABEL description="This is a Docker Image for XRobot build."
712

813
RUN apt update
914

10-
RUN apt upgrade -y --no-install-recommends && apt install -y --no-install-recommends xz-utils git curl sudo wget zip unzip make && apt install -y net-tools usbutils util-linux expect nano gdb cmake ninja-build file clang-tidy gcc g++ python3-tk && apt clean
15+
RUN apt upgrade -y --no-install-recommends && apt install -y --no-install-recommends xz-utils git curl sudo wget zip unzip make && apt install -y net-tools usbutils util-linux nano gdb cmake ninja-build file clang-tidy gcc g++ python3-tk && apt clean
1116

1217
RUN apt-get update && \
1318
apt-get install -y --no-install-recommends \
1419
xz-utils git curl sudo wget zip unzip make \
15-
net-tools usbutils util-linux expect expect-dev nano gdb cmake ninja-build file clang-tidy gcc g++ python3-tk libgpiod-dev && \
16-
apt-get clean
20+
net-tools usbutils util-linux nano gdb cmake ninja-build file clang-tidy gcc g++ python3-tk libgpiod-dev && \
21+
apt-get clean
1722

18-
RUN curl -L -o stm32cube-ide-core.vsix \
23+
RUN curl -L -o stm32cube-ide-core.pkg \
1924
-H "Accept: application/octet-stream" \
2025
-A "Mozilla/5.0" \
21-
"https://marketplace.visualstudio.com/_apis/public/gallery/publishers/stmicroelectronics/vsextensions/stm32cube-ide-core/latest/vspackage" && \
22-
mv stm32cube-ide-core.vsix stm32cube-ide-core.vsix.gz && \
23-
gunzip stm32cube-ide-core.vsix.gz && \
24-
unzip stm32cube-ide-core.vsix && \
25-
cat > download.exp <<'EOF'
26-
spawn extension/resources/binaries/linux/x86_64/cube bundle download st-arm-clang
27-
set timeout -1
28-
expect {
29-
-re "Proceed with download.*" {
30-
send "yes\r"
31-
exp_continue
32-
}
33-
eof
34-
}
35-
EOF
36-
37-
RUN if [ -x extension/resources/binaries/linux/x86_64/cube ]; then \
38-
script -q -c "expect download.exp" /dev/null && \
39-
rm download.exp && \
40-
BUNDLE_FILE=$(ls -t *.bundle | head -n1) && \
41-
mkdir -p /opt/st-arm-clang && \
42-
unzip "$BUNDLE_FILE" -d /opt/st-arm-clang; \
26+
"${STM32CUBE_IDE_CORE_VSIX_URL}" && \
27+
if file stm32cube-ide-core.pkg | grep -qi "gzip compressed"; then \
28+
mv stm32cube-ide-core.pkg stm32cube-ide-core.vsix.gz && \
29+
gunzip stm32cube-ide-core.vsix.gz; \
4330
else \
44-
echo "Linux STM32Cube downloader not found in stm32cube-ide-core.vsix; skipping st-arm-clang bundle install."; \
45-
rm download.exp; \
31+
mv stm32cube-ide-core.pkg stm32cube-ide-core.vsix; \
4632
fi && \
47-
rm -rf extension *.bundle *.vsix stm32cube-ide-core.vsix.gz
48-
49-
RUN if [ -d /opt/st-arm-clang/bin ]; then \
50-
for exe in /opt/st-arm-clang/bin/*; do \
51-
ln -sf "$exe" /usr/bin/$(basename "$exe"); \
52-
done; \
53-
fi
33+
unzip -q stm32cube-ide-core.vsix && \
34+
test -x extension/resources/binaries/linux/x86_64/cube || \
35+
(echo "Linux STM32Cube downloader missing in stm32cube-ide-core ${STM32CUBE_IDE_CORE_VERSION}" >&2 && exit 1) && \
36+
extension/resources/binaries/linux/x86_64/cube bundle download --yes st-arm-clang && \
37+
BUNDLE_FILE=$(find . -maxdepth 1 -type f -name 'st-arm-clang*-linux.bundle' | head -n1) && \
38+
test -n "$BUNDLE_FILE" && \
39+
mkdir -p /opt/st-arm-clang && \
40+
unzip "$BUNDLE_FILE" -d /opt/st-arm-clang && \
41+
rm -rf extension *.bundle stm32cube-ide-core.pkg stm32cube-ide-core.vsix stm32cube-ide-core.vsix.gz
42+
43+
RUN test -x /opt/st-arm-clang/bin/starm-clang && \
44+
test -x /opt/st-arm-clang/bin/starm-clang++ && \
45+
for exe in /opt/st-arm-clang/bin/*; do \
46+
ln -sf "$exe" /usr/bin/$(basename "$exe"); \
47+
done && \
48+
command -v starm-clang && \
49+
command -v starm-clang++
5450

5551

5652
RUN sudo mv /usr/lib/python3.12/EXTERNALLY-MANAGED /usr/lib/python3.12/EXTERNALLY-MANAGED.bk

0 commit comments

Comments
 (0)