From 44831f50f7db2e81a3ea17d6f94a4f01f18f2913 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Cumplido?= Date: Tue, 10 Dec 2024 12:59:56 +0100 Subject: [PATCH] Install cmake in linux-apt-lint.dockerfile and update install_cmake.sh to not require platform argument --- .github/workflows/dev.yml | 2 +- ci/docker/linux-apt-lint.dockerfile | 5 ++++ ci/docker/python-wheel-manylinux.dockerfile | 2 +- ci/scripts/install_cmake.sh | 26 +++++++++++++++++---- dev/tasks/python-wheels/github.osx.yml | 2 +- dev/tasks/vcpkg-tests/github.windows.yml | 2 +- 6 files changed, 30 insertions(+), 9 deletions(-) diff --git a/.github/workflows/dev.yml b/.github/workflows/dev.yml index 02c3c5d983c99..2957ec5cdf365 100644 --- a/.github/workflows/dev.yml +++ b/.github/workflows/dev.yml @@ -56,7 +56,7 @@ jobs: - name: Install CMake 3.25.0 shell: bash run: | - ci/scripts/install_cmake.sh x86_64 linux 3.25.0 /tmp/local/ + ci/scripts/install_cmake.sh $(arch) 3.25.0 /tmp/local/ echo "/tmp/local/bin" >> $GITHUB_PATH - name: Install pre-commit run: | diff --git a/ci/docker/linux-apt-lint.dockerfile b/ci/docker/linux-apt-lint.dockerfile index 9ec80440a3c21..6825ad0c7b6e3 100644 --- a/ci/docker/linux-apt-lint.dockerfile +++ b/ci/docker/linux-apt-lint.dockerfile @@ -66,6 +66,11 @@ COPY --from=hadolint /bin/hadolint /usr/bin/hadolint COPY ci/scripts/install_iwyu.sh /arrow/ci/scripts/ RUN arrow/ci/scripts/install_iwyu.sh /tmp/iwyu /usr/local ${clang_tools} +# Update CMake +ARG cmake=3.25.0 +COPY ci/scripts/install_cmake.sh /arrow/ci/scripts/ +RUN /arrow/ci/scripts/install_cmake.sh $(arch) ${cmake} /usr/local/ + # Use python3 by default in scripts RUN ln -s /usr/bin/python3 /usr/local/bin/python diff --git a/ci/docker/python-wheel-manylinux.dockerfile b/ci/docker/python-wheel-manylinux.dockerfile index c6fa3cc0dce97..553facccd678c 100644 --- a/ci/docker/python-wheel-manylinux.dockerfile +++ b/ci/docker/python-wheel-manylinux.dockerfile @@ -53,7 +53,7 @@ ENV PATH=/opt/python/${CPYTHON_VERSION}-${CPYTHON_VERSION}/bin:${PATH} # Install CMake ARG cmake=3.29.2 COPY ci/scripts/install_cmake.sh arrow/ci/scripts/ -RUN /arrow/ci/scripts/install_cmake.sh ${arch} linux ${cmake} /usr/local +RUN /arrow/ci/scripts/install_cmake.sh ${arch} ${cmake} /usr/local # Install Ninja ARG ninja=1.10.2 diff --git a/ci/scripts/install_cmake.sh b/ci/scripts/install_cmake.sh index 7fdb06d90f02c..b83c7d57da3c5 100755 --- a/ci/scripts/install_cmake.sh +++ b/ci/scripts/install_cmake.sh @@ -31,15 +31,31 @@ platforms=([linux]=linux [macos]=macos [windows]=windows) -if [ "$#" -ne 4 ]; then - echo "Usage: $0 " +if [ "$#" -ne 3 ]; then + echo "Usage: $0 " exit 1 fi arch=${archs[$1]} -platform=${platforms[$2]} -version=$3 -prefix=$4 +version=$2 +prefix=$3 + +platform=$(uname) +case ${platform} in + Linux) + platform=linux + ;; + Darwin) + platform=macos + ;; + MSYS_NT*|MINGW64_NT*) + platform=windows + ;; + *) + echo "Unsupported platform: ${platform}" + exit 0 + ;; +esac mkdir -p ${prefix} url="https://github.com/Kitware/CMake/releases/download/v${version}/cmake-${version}-${platform}-" diff --git a/dev/tasks/python-wheels/github.osx.yml b/dev/tasks/python-wheels/github.osx.yml index 1799bd6ad6b6f..2cebee2f32b9b 100644 --- a/dev/tasks/python-wheels/github.osx.yml +++ b/dev/tasks/python-wheels/github.osx.yml @@ -63,7 +63,7 @@ jobs: - name: Install CMake 3.29.0 shell: bash run: | - arrow/ci/scripts/install_cmake.sh $(arch) macos 3.29.0 ${PWD}/local + arrow/ci/scripts/install_cmake.sh $(arch) 3.29.0 ${PWD}/local echo "${PWD}/local/bin" >> $GITHUB_PATH - name: Retrieve VCPKG version from arrow/.env diff --git a/dev/tasks/vcpkg-tests/github.windows.yml b/dev/tasks/vcpkg-tests/github.windows.yml index af12db595286f..46c6c0a6a3fd6 100644 --- a/dev/tasks/vcpkg-tests/github.windows.yml +++ b/dev/tasks/vcpkg-tests/github.windows.yml @@ -32,7 +32,7 @@ jobs: - name: Install CMake 3.29.0 shell: bash run: | - arrow/ci/scripts/install_cmake.sh amd64 windows 3.29.0 /c/cmake + arrow/ci/scripts/install_cmake.sh amd64 3.29.0 /c/cmake echo "c:\\cmake\\bin" >> $GITHUB_PATH - name: Download Timezone Database shell: bash