diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 9a38aef88d0..128d5fbca11 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -296,7 +296,9 @@ repos: ?^cpp/build-support/build-lz4-lib\.sh$| ?^cpp/build-support/build-zstd-lib\.sh$| ?^cpp/build-support/get-upstream-commit\.sh$| + ?^cpp/build-support/update-flatbuffers\.sh$| ?^cpp/build-support/update-thrift\.sh$| + ?^cpp/build-support/vendor-flatbuffers\.sh$| ?^cpp/examples/minimal_build/run\.sh$| ?^cpp/examples/tutorial_examples/run\.sh$| ?^cpp/src/arrow/flight/sql/odbc/install/mac/postinstall$| diff --git a/cpp/build-support/update-flatbuffers.sh b/cpp/build-support/update-flatbuffers.sh index 6738f81a560..691d0190914 100755 --- a/cpp/build-support/update-flatbuffers.sh +++ b/cpp/build-support/update-flatbuffers.sh @@ -24,13 +24,16 @@ set -euo pipefail CWD="$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")" && pwd)" SOURCE_DIR="$CWD/../src" -PYTHON_SOURCE_DIR="$CWD/../../python" FORMAT_DIR="$CWD/../../format" -TOP="$FORMAT_DIR/.." FLATC="flatc --cpp --cpp-std c++11 --scoped-enums" OUT_DIR="$SOURCE_DIR/generated" -FILES=($(find $FORMAT_DIR -name '*.fbs')) +# Avoid word splitting (SC2207) while maintaining Bash 3 compatibility. +# See: https://www.shellcheck.net/wiki/SC2207 +FILES=() +while IFS= read -r file; do + FILES+=("$file") +done < <(find "$FORMAT_DIR" -name '*.fbs') FILES+=("$SOURCE_DIR/arrow/ipc/feather.fbs") $FLATC -o "$OUT_DIR" "${FILES[@]}" diff --git a/cpp/build-support/vendor-flatbuffers.sh b/cpp/build-support/vendor-flatbuffers.sh index 6cbf77b9ca5..30ebbcedbf2 100755 --- a/cpp/build-support/vendor-flatbuffers.sh +++ b/cpp/build-support/vendor-flatbuffers.sh @@ -25,7 +25,7 @@ set -eu SOURCE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")" && pwd)" VENDOR_LOCATION=$SOURCE_DIR/../thirdparty/flatbuffers/include/flatbuffers -mkdir -p $VENDOR_LOCATION -cp -f $FLATBUFFERS_HOME/include/flatbuffers/base.h $VENDOR_LOCATION -cp -f $FLATBUFFERS_HOME/include/flatbuffers/flatbuffers.h $VENDOR_LOCATION -cp -f $FLATBUFFERS_HOME/include/flatbuffers/stl_emulation.h $VENDOR_LOCATION +mkdir -p "$VENDOR_LOCATION" +cp -f "$FLATBUFFERS_HOME/include/flatbuffers/base.h" "$VENDOR_LOCATION" +cp -f "$FLATBUFFERS_HOME/include/flatbuffers/flatbuffers.h" "$VENDOR_LOCATION" +cp -f "$FLATBUFFERS_HOME/include/flatbuffers/stl_emulation.h" "$VENDOR_LOCATION"