Skip to content

Commit 7b70ae2

Browse files
authored
Merge pull request #254 from chrysn-pull-requests/static-rust-earlier
Move minimal Rust from riotbuild to static-test-tools
2 parents 7e1b9bc + 7c2657d commit 7b70ae2

File tree

2 files changed

+27
-15
lines changed

2 files changed

+27
-15
lines changed

riotbuild/Dockerfile

+2-15
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ RUN \
6363
ca-certificates \
6464
ccache \
6565
cmake \
66-
curl \
6766
cython3 \
6867
gcc-multilib \
6968
gdb \
@@ -324,27 +323,15 @@ RUN echo 'Installing python3 packages' >&2 \
324323
&& pip3 install --no-cache-dir -r /tmp/requirements.txt \
325324
&& rm /tmp/requirements.txt
326325

327-
# While sourcing ~/.cargo/env later would have the right short-term effect,
328-
# we'd still need to set the right path even later when HOME is
329-
# /data/riotbuild -- so setting it right away.
330-
ENV PATH ${PATH}:/opt/rustup/.cargo/bin
331-
# Install nightly Rust via rustup; this is needed for Rust-on-RIOT builds and
332-
# contains all CARGO_TARGETs currently recognized for RIOT targets.
326+
# Add Rust components needed for building, adding to installation from static-test-tools
333327
#
334-
# *_HOMEs moved to /opt to make them world readable. RUSTUP_HOME is set
335-
# persistently in case someone in their image wants to do a quick `sudo rustup
336-
# toolchain add` or similar; CARGO_HOME is not because the user will need to
337-
# write there, and all rustup does here is to place some binaries that later
338-
# fan out to RUSTUP_HOME anyway.
328+
# See static-test-tools/Dockerfile for why which variables are set how.
339329
#
340330
# Components: rust-src is needed to run `-Z build-std=core`, which in turn is
341331
# needed on AVR (which thus doesn't need the avr-unknown-gnu-atmega328 target;
342332
# being able to build core might be useful for other targets as well).
343-
ENV RUSTUP_HOME /opt/rustup/.rustup
344333
RUN \
345-
RUSTUP_HOME=/opt/rustup/.rustup \
346334
CARGO_HOME=/opt/rustup/.cargo sh -c "\
347-
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal && \
348335
rustup component add rust-src && \
349336
rustup target add i686-unknown-linux-gnu && \
350337
rustup target add riscv32imac-unknown-none-elf && \

static-test-tools/Dockerfile

+25
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ RUN \
1515
apt-get -y --no-install-recommends install \
1616
coccinelle \
1717
cppcheck \
18+
curl \
1819
doxygen \
1920
graphviz \
2021
less \
@@ -35,3 +36,27 @@ RUN echo 'Installing python3 packages' >&2 && \
3536

3637
# Install uncrustify
3738
COPY --from=ghcr.io/kaspar030/uncrustify-builder:latest /usr/bin/uncrustify /usr/bin/uncrustify
39+
40+
# Rust base installation
41+
42+
# While sourcing ~/.cargo/env later would have the right short-term effect,
43+
# we'd still need to set the right path even later when HOME is
44+
# /data/riotbuild -- so setting it right away.
45+
ENV PATH ${PATH}:/opt/rustup/.cargo/bin
46+
47+
# Install Rust via rustup; this is needed for Rust-on-RIOT builds and contains
48+
# all CARGO_TARGETs currently recognized for RIOT targets.
49+
#
50+
# *_HOMEs moved to /opt to make them world readable. RUSTUP_HOME is set
51+
# persistently in case someone in their image wants to do a quick `sudo rustup
52+
# toolchain add` or similar; CARGO_HOME is not because the user will need to
53+
# write there, and all rustup does here is to place some binaries that later
54+
# fan out to RUSTUP_HOME anyway.
55+
#
56+
# Components: fmt is needed for the static test tools as those do `cargo fmt`
57+
# checks. More are added for riotbuild.
58+
ENV RUSTUP_HOME /opt/rustup/.rustup
59+
RUN \
60+
CARGO_HOME=/opt/rustup/.cargo sh -c "\
61+
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal && \
62+
rustup component add rustfmt"

0 commit comments

Comments
 (0)