From 4c22cd77cfc4cffac0d989e60f3b3eaa6f2654f7 Mon Sep 17 00:00:00 2001 From: Hiroyuki Sato Date: Tue, 4 Aug 2026 20:25:30 +0900 Subject: [PATCH] GH-50803: [CI][Dev] Fix shellcheck errors in the ci/scripts/r_windows_build.sh --- .pre-commit-config.yaml | 1 + ci/scripts/r_windows_build.sh | 49 +++++++++++++++++------------------ 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 3cd67845cb54..8adc2275e5b5 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -346,6 +346,7 @@ repos: ?^ci/scripts/r_sanitize\.sh$| ?^ci/scripts/r_test\.sh$| ?^ci/scripts/r_valgrind\.sh$| + ?^ci/scripts/r_windows_build\.sh$| ?^ci/scripts/release_test\.sh$| ?^ci/scripts/ruby_test\.sh$| ?^ci/scripts/rust_build\.sh$| diff --git a/ci/scripts/r_windows_build.sh b/ci/scripts/r_windows_build.sh index ef9c58f6afca..7eb8c0c2b55e 100755 --- a/ci/scripts/r_windows_build.sh +++ b/ci/scripts/r_windows_build.sh @@ -19,22 +19,21 @@ set -ex -: ${ARROW_HOME:=$(pwd)} +: "${ARROW_HOME:=$(pwd)}" # Make sure it is absolute and exported -export ARROW_HOME="$(cd "${ARROW_HOME}" && pwd)" +ARROW_HOME="$(cd "${ARROW_HOME}" && pwd)" +export ARROW_HOME pacman --noconfirm -Syy -RWINLIB_LIB_DIR="lib" -: ${MINGW_ARCH:="mingw32 mingw64 ucrt64"} - +: "${MINGW_ARCH:=mingw32 mingw64 ucrt64}" export MINGW_ARCH -cp $ARROW_HOME/ci/scripts/PKGBUILD . +cp "${ARROW_HOME}/ci/scripts/PKGBUILD" . printenv makepkg-mingw --noconfirm --noprogressbar --skippgpcheck --nocheck --syncdeps --cleanbuild -VERSION=$(grep Version $ARROW_HOME/r/DESCRIPTION | cut -d " " -f 2) +VERSION="$(grep Version "${ARROW_HOME}/r/DESCRIPTION" | cut -d " " -f 2)" DST_DIR="r-libarrow-windows-x86_64-$VERSION" # Collect the build artifacts and make the shape of zip file that rwinlib expects @@ -47,12 +46,12 @@ cd build MSYS_LIB_DIR="/c/rtools${RTOOLS_VERSION}" # Untar the builds we made -ls *.xz | xargs -n 1 tar -xJf -mkdir -p $DST_DIR +find . -maxdepth 1 -type f -name '*.xz' -print0 | xargs -0 -n1 tar -xJf +mkdir -p "${DST_DIR}" # Grab the headers from one, either one is fine # (if we're building twice to combine old and new toolchains, this may already exist) -if [ ! -d $DST_DIR/include ]; then - mv $(echo $MINGW_ARCH | cut -d ' ' -f 1)/include $DST_DIR +if [ ! -d "${DST_DIR}/include" ]; then + mv "$(echo "${MINGW_ARCH}" | cut -d ' ' -f 1)/include" "${DST_DIR}" fi # mingw64 -> x64 @@ -60,34 +59,34 @@ fi # ucrt64 -> x64-ucrt if [ -d mingw64/lib/ ]; then - ls $MSYS_LIB_DIR/mingw64/lib/ + ls "${MSYS_LIB_DIR}/mingw64/lib/" # Make the rest of the directory structure - mkdir -p $DST_DIR/lib/x64 + mkdir -p "${DST_DIR}/lib/x64" # Move the 64-bit versions of libarrow into the expected location - mv mingw64/lib/*.a $DST_DIR/lib/x64 + mv mingw64/lib/*.a "${DST_DIR}/lib/x64" # These are from https://dl.bintray.com/rtools/mingw{32,64}/ - cp $MSYS_LIB_DIR/mingw64/lib/lib{snappy,zstd,lz4,brotli*,bz2,crypto,curl,ss*,utf8proc,re2,nghttp2}.a $DST_DIR/lib/x64 + cp "${MSYS_LIB_DIR}"/mingw64/lib/lib{snappy,zstd,lz4,brotli*,bz2,crypto,curl,ss*,utf8proc,re2,nghttp2}.a "${DST_DIR}/lib/x64" fi # Same for the 32-bit versions if [ -d mingw32/lib/ ]; then - ls $MSYS_LIB_DIR/mingw32/lib/ - mkdir -p $DST_DIR/lib/i386 - mv mingw32/lib/*.a $DST_DIR/lib/i386 - cp $MSYS_LIB_DIR/mingw32/lib/lib{snappy,zstd,lz4,brotli*,bz2,crypto,curl,ss*,utf8proc,re2,nghttp2}.a $DST_DIR/lib/i386 + ls "${MSYS_LIB_DIR}/mingw32/lib/" + mkdir -p "${DST_DIR}/lib/i386" + mv mingw32/lib/*.a "${DST_DIR}/lib/i386" + cp "${MSYS_LIB_DIR}"/mingw32/lib/lib{snappy,zstd,lz4,brotli*,bz2,crypto,curl,ss*,utf8proc,re2,nghttp2}.a "${DST_DIR}/lib/i386" fi # Do the same also for ucrt64 if [ -d ucrt64/lib/ ]; then - ls $MSYS_LIB_DIR/ucrt64/lib/ - mkdir -p $DST_DIR/lib/x64-ucrt - mv ucrt64/lib/*.a $DST_DIR/lib/x64-ucrt - cp $MSYS_LIB_DIR/ucrt64/lib/lib{snappy,zstd,lz4,brotli*,bz2,crypto,curl,ss*,utf8proc,re2,nghttp2}.a $DST_DIR/lib/x64-ucrt + ls "${MSYS_LIB_DIR}/ucrt64/lib/" + mkdir -p "${DST_DIR}/lib/x64-ucrt" + mv ucrt64/lib/*.a "${DST_DIR}/lib/x64-ucrt" + cp "${MSYS_LIB_DIR}"/ucrt64/lib/lib{snappy,zstd,lz4,brotli*,bz2,crypto,curl,ss*,utf8proc,re2,nghttp2}.a "$DST_DIR"/lib/x64-ucrt fi # Create build artifact -zip -r ${DST_DIR}.zip $DST_DIR +zip -r "${DST_DIR}.zip" "$DST_DIR" # Copy that to a file name/path that does not vary by version number so we # can easily find it in the R package tests on CI -cp ${DST_DIR}.zip ../libarrow.zip +cp "${DST_DIR}.zip" ../libarrow.zip