Dockerfile.build: install sccache from distro packages when available

Prefer the distro-packaged sccache (installed via dnf) over downloading a
release tarball with curl. Fall back to the curl download when the package
is absent or on non-dnf distros, so existing behavior is unchanged.

Signed-off-by: Sun Yuechi <sunyuechi@iscas.ac.cn>
This commit is contained in:
Sun Yuechi 2026-07-15 11:53:53 +08:00
parent d3d08a106d
commit e25810d879

View File

@ -36,7 +36,9 @@ RUN DISTRO=$DISTRO \
FOR_MAKE_CHECK=${FOR_MAKE_CHECK} \
bash -x ${CEPH_CTR_SRC}/buildcontainer-setup.sh
RUN \
if [ $(uname -m) != ppc64le ]; then \
if rpm --quiet --query sccache 2>/dev/null || { command -v dnf >/dev/null 2>&1 && dnf install -y sccache 2>/dev/null; }; then \
echo "sccache provided by distro packages"; \
elif [ $(uname -m) != ppc64le ]; then \
SCCACHE_ARCH="$(uname -m)"; \
if [ "$SCCACHE_ARCH" = riscv64 ]; then SCCACHE_ARCH=riscv64gc; fi; \
SCCACHE_URL="${SCCACHE_REPO}/releases/download/${SCCACHE_VERSION}/sccache-${SCCACHE_VERSION}-${SCCACHE_ARCH}-unknown-linux-musl.tar.gz"; \