Standardize shell script indent level

We have a mixture of 2 and 4 space indent.

    4 benchmarks/driver.sh
    2 build_tools/check.sh
    4 build_tools/git_version_gen.sh
    4 build_tools/mac_notarize.sh
    2 build_tools/make_pkg.sh
    2 build_tools/make_tarball.sh
    2 build_tools/make_vendor_tarball.sh
    4 docker/docker_run_tests.sh
    4 osx/install.sh
    2 tests/test_functions/sphinx-shared.sh

Our editorconfig file specifies 2, with no explicit reason.
Our fish and Python scripts use 4, so let's use that.
This commit is contained in:
Johannes Altmanninger
2025-06-19 12:00:43 +02:00
parent 963c3425a3
commit 49926cfbac
6 changed files with 63 additions and 63 deletions

View File

@@ -15,8 +15,8 @@ indent_style = tab
[*.{md,rst}] [*.{md,rst}]
trim_trailing_whitespace = false trim_trailing_whitespace = false
[*.{sh,ac}] [*.sh]
indent_size = 2 indent_size = 4
[Dockerfile] [Dockerfile]
indent_size = 2 indent_size = 2

View File

@@ -3,9 +3,9 @@
set -ex set -ex
cleanup () { cleanup () {
if [ -n "$template_file" ] && [ -e "$template_file" ]; then if [ -n "$template_file" ] && [ -e "$template_file" ]; then
rm "$template_file" rm "$template_file"
fi fi
} }
trap cleanup EXIT INT TERM HUP trap cleanup EXIT INT TERM HUP

View File

@@ -3,18 +3,18 @@
# Script to produce an OS X installer .pkg and .app(.zip) # Script to produce an OS X installer .pkg and .app(.zip)
usage() { usage() {
echo "Build macOS packages, optionally signing and notarizing them." echo "Build macOS packages, optionally signing and notarizing them."
echo "Usage: $0 options" echo "Usage: $0 options"
echo "Options:" echo "Options:"
echo " -s Enables code signing" echo " -s Enables code signing"
echo " -f <APP_KEY.p12> Path to .p12 file for application signing" echo " -f <APP_KEY.p12> Path to .p12 file for application signing"
echo " -i <INSTALLER_KEY.p12> Path to .p12 file for installer signing" echo " -i <INSTALLER_KEY.p12> Path to .p12 file for installer signing"
echo " -p <PASSWORD> Password for the .p12 files (necessary to access the certificates)" echo " -p <PASSWORD> Password for the .p12 files (necessary to access the certificates)"
echo " -e <entitlements file> (Optional) Path to an entitlements XML file" echo " -e <entitlements file> (Optional) Path to an entitlements XML file"
echo " -n Enables notarization. This will fail if code signing is not also enabled." echo " -n Enables notarization. This will fail if code signing is not also enabled."
echo " -j <API_KEY.JSON> Path to JSON file generated with \`rcodesign encode-app-store-connect-api-key\` (required for notarization)" echo " -j <API_KEY.JSON> Path to JSON file generated with \`rcodesign encode-app-store-connect-api-key\` (required for notarization)"
echo echo
exit 1 exit 1
} }
set -x set -x
@@ -33,32 +33,32 @@ X86_64_DEPLOY_TARGET='MACOSX_DEPLOYMENT_TARGET=10.9'
RUST_VERSION_X86_64=1.73.0 RUST_VERSION_X86_64=1.73.0
while getopts "sf:i:p:e:nj:" opt; do while getopts "sf:i:p:e:nj:" opt; do
case $opt in case $opt in
s) SIGN=1;; s) SIGN=1;;
f) P12_APP_FILE=$(realpath "$OPTARG");; f) P12_APP_FILE=$(realpath "$OPTARG");;
i) P12_INSTALL_FILE=$(realpath "$OPTARG");; i) P12_INSTALL_FILE=$(realpath "$OPTARG");;
p) P12_PASSWORD="$OPTARG";; p) P12_PASSWORD="$OPTARG";;
e) ENTITLEMENTS_FILE=$(realpath "$OPTARG");; e) ENTITLEMENTS_FILE=$(realpath "$OPTARG");;
n) NOTARIZE=1;; n) NOTARIZE=1;;
j) API_KEY_FILE=$(realpath "$OPTARG");; j) API_KEY_FILE=$(realpath "$OPTARG");;
\?) usage;; \?) usage;;
esac esac
done done
if [ -n "$SIGN" ] && { [ -z "$P12_APP_FILE" ] || [ -z "$P12_INSTALL_FILE" ] || [ -z "$P12_PASSWORD" ]; }; then if [ -n "$SIGN" ] && { [ -z "$P12_APP_FILE" ] || [ -z "$P12_INSTALL_FILE" ] || [ -z "$P12_PASSWORD" ]; }; then
usage usage
fi fi
if [ -n "$NOTARIZE" ] && [ -z "$API_KEY_FILE" ]; then if [ -n "$NOTARIZE" ] && [ -z "$API_KEY_FILE" ]; then
usage usage
fi fi
VERSION=$(git describe --always --dirty 2>/dev/null) VERSION=$(git describe --always --dirty 2>/dev/null)
if test -z "$VERSION" ; then if test -z "$VERSION" ; then
echo "Could not get version from git" echo "Could not get version from git"
if test -f version; then if test -f version; then
VERSION=$(cat version) VERSION=$(cat version)
fi fi
fi fi
echo "Version is $VERSION" echo "Version is $VERSION"
@@ -76,7 +76,7 @@ mkdir -p "$PKGDIR/build_x86_64" "$PKGDIR/build_arm64" "$PKGDIR/root" "$PKGDIR/in
# and will probably not be built universal, so the package will fail to validate/run on other systems. # and will probably not be built universal, so the package will fail to validate/run on other systems.
# Note CMAKE_OSX_ARCHITECTURES is still relevant for the Mac app. # Note CMAKE_OSX_ARCHITECTURES is still relevant for the Mac app.
{ cd "$PKGDIR/build_arm64" \ { cd "$PKGDIR/build_arm64" \
&& cmake \ && cmake \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \ -DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_EXE_LINKER_FLAGS="-Wl,-ld_classic" \ -DCMAKE_EXE_LINKER_FLAGS="-Wl,-ld_classic" \
-DWITH_GETTEXT=OFF \ -DWITH_GETTEXT=OFF \
@@ -91,7 +91,7 @@ mkdir -p "$PKGDIR/build_x86_64" "$PKGDIR/build_arm64" "$PKGDIR/root" "$PKGDIR/in
# Build for x86-64 but do not install; instead we will make some fat binaries inside the root. # Build for x86-64 but do not install; instead we will make some fat binaries inside the root.
# Set RUST_VERSION_X86_64 to the last version of Rust that supports macOS 10.9. # Set RUST_VERSION_X86_64 to the last version of Rust that supports macOS 10.9.
{ cd "$PKGDIR/build_x86_64" \ { cd "$PKGDIR/build_x86_64" \
&& cmake \ && cmake \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \ -DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_EXE_LINKER_FLAGS="-Wl,-ld_classic" \ -DCMAKE_EXE_LINKER_FLAGS="-Wl,-ld_classic" \
-DWITH_GETTEXT=OFF \ -DWITH_GETTEXT=OFF \
@@ -99,7 +99,7 @@ mkdir -p "$PKGDIR/build_x86_64" "$PKGDIR/build_arm64" "$PKGDIR/root" "$PKGDIR/in
-DRust_CARGO_TARGET=x86_64-apple-darwin \ -DRust_CARGO_TARGET=x86_64-apple-darwin \
-DCMAKE_OSX_ARCHITECTURES='arm64;x86_64' \ -DCMAKE_OSX_ARCHITECTURES='arm64;x86_64' \
-DFISH_USE_SYSTEM_PCRE2=OFF "$SRC_DIR" \ -DFISH_USE_SYSTEM_PCRE2=OFF "$SRC_DIR" \
&& env $X86_64_DEPLOY_TARGET make VERBOSE=1 -j 12; } && env $X86_64_DEPLOY_TARGET make VERBOSE=1 -j 12; }
# Fatten them up. # Fatten them up.
for FILE in "$PKGDIR"/root/usr/local/bin/*; do for FILE in "$PKGDIR"/root/usr/local/bin/*; do

View File

@@ -18,22 +18,22 @@ set -e
BUILD_TOOL="make" BUILD_TOOL="make"
BUILD_GENERATOR="Unix Makefiles" BUILD_GENERATOR="Unix Makefiles"
if command -v ninja >/dev/null; then if command -v ninja >/dev/null; then
BUILD_TOOL="ninja" BUILD_TOOL="ninja"
BUILD_GENERATOR="Ninja" BUILD_GENERATOR="Ninja"
fi fi
# We need GNU tar as that supports the --mtime and --transform options # We need GNU tar as that supports the --mtime and --transform options
TAR=notfound TAR=notfound
for try in tar gtar gnutar; do for try in tar gtar gnutar; do
if $try -Pcf /dev/null --mtime now /dev/null >/dev/null 2>&1; then if $try -Pcf /dev/null --mtime now /dev/null >/dev/null 2>&1; then
TAR=$try TAR=$try
break break
fi fi
done done
if [ "$TAR" = "notfound" ]; then if [ "$TAR" = "notfound" ]; then
echo 'No suitable tar (supporting --mtime) found as tar/gtar/gnutar in PATH' echo 'No suitable tar (supporting --mtime) found as tar/gtar/gnutar in PATH'
exit 1 exit 1
fi fi
# Get the current directory, which we'll use for symlinks # Get the current directory, which we'll use for symlinks
@@ -63,7 +63,7 @@ cmake -G "$BUILD_GENERATOR" -DCMAKE_BUILD_TYPE=Debug "$wd"
$BUILD_TOOL doc $BUILD_TOOL doc
TAR_APPEND="$TAR --append --file=$path --mtime=now --owner=0 --group=0 \ TAR_APPEND="$TAR --append --file=$path --mtime=now --owner=0 --group=0 \
--mode=g+w,a+rX --transform s/^/$prefix\//" --mode=g+w,a+rX --transform s/^/$prefix\//"
$TAR_APPEND --no-recursion user_doc $TAR_APPEND --no-recursion user_doc
$TAR_APPEND user_doc/html user_doc/man $TAR_APPEND user_doc/html user_doc/man
$TAR_APPEND version $TAR_APPEND version

View File

@@ -11,15 +11,15 @@ set -e
# We need GNU tar as that supports the --mtime and --transform options # We need GNU tar as that supports the --mtime and --transform options
TAR=notfound TAR=notfound
for try in tar gtar gnutar; do for try in tar gtar gnutar; do
if $try -Pcf /dev/null --mtime now /dev/null >/dev/null 2>&1; then if $try -Pcf /dev/null --mtime now /dev/null >/dev/null 2>&1; then
TAR=$try TAR=$try
break break
fi fi
done done
if [ "$TAR" = "notfound" ]; then if [ "$TAR" = "notfound" ]; then
echo 'No suitable tar (supporting --mtime) found as tar/gtar/gnutar in PATH' echo 'No suitable tar (supporting --mtime) found as tar/gtar/gnutar in PATH'
exit 1 exit 1
fi fi
# Get the current directory, which we'll use for telling Cargo where to find the sources # Get the current directory, which we'll use for telling Cargo where to find the sources

View File

@@ -3,9 +3,9 @@
set -e set -e
cleanup () { cleanup () {
if [ -n "$tmp_dir" ] && [ -e "$tmp_dir" ]; then if [ -n "$tmp_dir" ] && [ -e "$tmp_dir" ]; then
rm -r "$tmp_dir" rm -r "$tmp_dir"
fi fi
} }
trap cleanup EXIT INT TERM HUP trap cleanup EXIT INT TERM HUP
@@ -17,12 +17,12 @@ tmp_dir=$(mktemp -d)
doctree=$tmp_dir/doctree doctree=$tmp_dir/doctree
output_dir=$tmp_dir/$builder output_dir=$tmp_dir/$builder
sphinx-build \ sphinx-build \
-j auto \ -j auto \
-q \ -q \
-W \ -W \
-E \ -E \
-b "$builder" \ -b "$builder" \
-c "$docsrc" \ -c "$docsrc" \
-d "$doctree" \ -d "$doctree" \
"$docsrc" \ "$docsrc" \
"$output_dir" "$output_dir"