From: Simon Marchi Date: Thu, 3 Oct 2024 15:03:49 +0000 (-0400) Subject: Fix indentation in shell scripts X-Git-Url: http://git.lttng.org./?a=commitdiff_plain;h=6e67042df12b9f0f8118e9ac55d0c572e3b65e53;p=lttng-ci.git Fix indentation in shell scripts There is currently a mix of tabs and spaces in shell scripts. The most common style appears to be 4 spaces, so convert everything to that. Modify `.editorconfig` to try to enforce that style. Change-Id: Ic2c9a051a2713cc97d071bf3581952ee16985aa3 Signed-off-by: Simon Marchi --- diff --git a/.editorconfig b/.editorconfig index 316a6d9..cf53910 100644 --- a/.editorconfig +++ b/.editorconfig @@ -19,3 +19,7 @@ indent_size = 2 [*.py] indent_style = space indent_size = 4 + +[*.sh] +indent_style = space +indent_size = 4 diff --git a/lava/kvm/generate_kvm_virsh.sh b/lava/kvm/generate_kvm_virsh.sh index 07cb91e..e3bacd3 100755 --- a/lava/kvm/generate_kvm_virsh.sh +++ b/lava/kvm/generate_kvm_virsh.sh @@ -23,18 +23,18 @@ virsh vol-create-as --pool default --name "${name}.raw" --capacity 2G --format r data_disk_path="$(virsh vol-path ${name}.raw --pool default)" sudo mkfs.ext4 "$data_disk_path" virt-install --print-xml \ - --name "$name" \ - --memory 2096\ - --disk /var/lib/libvirt/images/ipxe.iso,device=cdrom \ - --boot cdrom \ - --disk "$data_disk_path,format=raw" \ - --vcpus 2 \ - --cpu host \ - --serial pty \ - --graphics none \ - --autostart \ - --network bridge=br0 \ - --check path_in_use=off > "$tmp" + --name "$name" \ + --memory 2096\ + --disk /var/lib/libvirt/images/ipxe.iso,device=cdrom \ + --boot cdrom \ + --disk "$data_disk_path,format=raw" \ + --vcpus 2 \ + --cpu host \ + --serial pty \ + --graphics none \ + --autostart \ + --network bridge=br0 \ + --check path_in_use=off > "$tmp" virsh define --validate "$tmp" virsh start "$name" rm -rf "$tmp" diff --git a/scripts/babeltrace-benchmark/benchmark.sh b/scripts/babeltrace-benchmark/benchmark.sh index 9a3256b..bb0d937 100755 --- a/scripts/babeltrace-benchmark/benchmark.sh +++ b/scripts/babeltrace-benchmark/benchmark.sh @@ -30,28 +30,28 @@ mkdir -p "$TMPDIR" export TMPDIR function checkout_scripts() { - git clone https://github.com/lttng/lttng-ci.git "$SCRIPT_DIR" + git clone https://github.com/lttng/lttng-ci.git "$SCRIPT_DIR" } function setup_env () { - mkdir -p "$RESULTS_DIR" - virtualenv --python python3 "$VENV" - set +u - # shellcheck disable=SC1090 - . "${VENV}/bin/activate" - set -u - pip install -r "$REQUIREMENT_PATH" + mkdir -p "$RESULTS_DIR" + virtualenv --python python3 "$VENV" + set +u + # shellcheck disable=SC1090 + . "${VENV}/bin/activate" + set -u + pip install -r "$REQUIREMENT_PATH" } function run_jobs () { - python "$SCRIPT_PATH" --generate-jobs --repo-path "$SRC_DIR" + python "$SCRIPT_PATH" --generate-jobs --repo-path "$SRC_DIR" } function generate_report () { - python "$SCRIPT_PATH" --generate-report --repo-path "$SRC_DIR" --report-name "${RESULTS_DIR}/babeltrace-benchmark.pdf" + python "$SCRIPT_PATH" --generate-report --repo-path "$SRC_DIR" --report-name "${RESULTS_DIR}/babeltrace-benchmark.pdf" } checkout_scripts diff --git a/scripts/babeltrace/build.sh b/scripts/babeltrace/build.sh index 7b7318e..4ce38ac 100755 --- a/scripts/babeltrace/build.sh +++ b/scripts/babeltrace/build.sh @@ -154,7 +154,7 @@ exit_status=0 # Use bear to generate compile_commands.json when enabled BEAR="" if [ "$BABELTRACE_GEN_COMPILE_COMMANDS" = "yes" ]; then - BEAR="bear" + BEAR="bear" fi # Create tmp directory diff --git a/scripts/binutils-gdb/build.sh b/scripts/binutils-gdb/build.sh index 3d7c561..951314c 100755 --- a/scripts/binutils-gdb/build.sh +++ b/scripts/binutils-gdb/build.sh @@ -212,8 +212,8 @@ export CC="cc" export CXX="c++" if use_ccache; then - CC="ccache $CC" - CXX="ccache $CXX" + CC="ccache $CC" + CXX="ccache $CXX" fi # To make GDB find libcc1.so @@ -244,7 +244,7 @@ print_os || true print_tooling || true if use_ccache; then - ccache -c + ccache -c fi # This job has been seen generating cores in /tmp, filling and and causing diff --git a/scripts/common/coverity.sh b/scripts/common/coverity.sh index 21e76ab..0bcc84b 100755 --- a/scripts/common/coverity.sh +++ b/scripts/common/coverity.sh @@ -86,7 +86,7 @@ lttng-ust) esac if [ -d "$WORKSPACE/src/linux" ]; then - export KERNELDIR="$WORKSPACE/src/linux" + export KERNELDIR="$WORKSPACE/src/linux" fi # Enter the source directory diff --git a/scripts/common/print.sh b/scripts/common/print.sh index b45b2b9..a0bcc57 100755 --- a/scripts/common/print.sh +++ b/scripts/common/print.sh @@ -9,7 +9,7 @@ COLOR_BLUE='\033[0;34m' COLOR_NONE='\033[0m' # No Color print_blue() { - echo -e "${COLOR_BLUE}$1${COLOR_NONE}" + echo -e "${COLOR_BLUE}$1${COLOR_NONE}" } print_hardware() { @@ -41,7 +41,7 @@ print_os() { echo "Version: $(head -n1 /etc/release)" elif command -v sw_vers >/dev/null 2>&1; then # For MacOS - echo "Version: $(sw_vers -productName) $(sw_vers -productVersion)" + echo "Version: $(sw_vers -productName) $(sw_vers -productVersion)" fi echo -n "Kernel: " @@ -96,7 +96,7 @@ print_tooling() { if command -v cmake >/dev/null 2>&1; then print_blue "cmake version" - cmake --version + cmake --version fi print_blue "automake version" @@ -146,17 +146,17 @@ print_tooling() { if command -v asciidoc >/dev/null 2>&1; then print_blue "asciidoc version" - asciidoc --version + asciidoc --version fi if command -v xmlto >/dev/null 2>&1; then print_blue "xmlto version" - xmlto --version + xmlto --version fi if command -v openssl >/dev/null 2>&1; then print_blue "openssl version" - openssl version + openssl version fi if command -v pkg-config >/dev/null 2>&1; then @@ -170,7 +170,7 @@ print_tooling() { print_pkgconfig_mod libdw print_pkgconfig_mod libelf print_pkgconfig_mod libxml-2.0 - print_pkgconfig_mod msgpack + print_pkgconfig_mod msgpack print_pkgconfig_mod popt print_pkgconfig_mod uuid print_pkgconfig_mod zlib diff --git a/scripts/common/scan-build.sh b/scripts/common/scan-build.sh index 478fff1..1dd980c 100755 --- a/scripts/common/scan-build.sh +++ b/scripts/common/scan-build.sh @@ -88,7 +88,7 @@ lttng-ust) esac if [ -d "$WORKSPACE/src/linux" ]; then - export KERNELDIR="$WORKSPACE/src/linux" + export KERNELDIR="$WORKSPACE/src/linux" fi # Enter the source directory diff --git a/scripts/librseq/build.sh b/scripts/librseq/build.sh index 5a10c2e..693c333 100755 --- a/scripts/librseq/build.sh +++ b/scripts/librseq/build.sh @@ -127,7 +127,7 @@ exit_status=0 # Use bear to generate compile_commands.json when enabled BEAR="" if [ "$LIBRSEQ_GEN_COMPILE_COMMANDS" = "yes" ]; then - BEAR="bear" + BEAR="bear" fi # Create tmp directory @@ -162,7 +162,7 @@ clang-*) ;; *) if [ "x$cc" != "x" ]; then - export CC="$cc" + export CC="$cc" fi ;; esac diff --git a/scripts/liburcu/build.sh b/scripts/liburcu/build.sh index 40f3469..a823255 100755 --- a/scripts/liburcu/build.sh +++ b/scripts/liburcu/build.sh @@ -149,7 +149,7 @@ exit_status=0 # Use bear to generate compile_commands.json when enabled BEAR="" if [ "$USERSPACE_RCU_GEN_COMPILE_COMMANDS" = "yes" ]; then - BEAR="bear" + BEAR="bear" fi # Create tmp directory @@ -180,7 +180,7 @@ clang-*) ;; *) if [ "x$cc" != "x" ]; then - export CC="$cc" + export CC="$cc" fi ;; esac diff --git a/scripts/lttng-tools/build.sh b/scripts/lttng-tools/build.sh index 41b1fb7..b5198e2 100755 --- a/scripts/lttng-tools/build.sh +++ b/scripts/lttng-tools/build.sh @@ -182,7 +182,7 @@ exit_status=0 # Use bear to generate compile_commands.json when enabled BEAR="" if [ "$LTTNG_TOOLS_GEN_COMPILE_COMMANDS" = "yes" ]; then - BEAR="bear" + BEAR="bear" fi # Create tmp directory @@ -232,7 +232,7 @@ clang-*) ;; *) if [ "x$cc" != "x" ]; then - export CC="$cc" + export CC="$cc" fi ;; esac @@ -267,9 +267,9 @@ cygwin|cygwin64|msys32|msys64) if command -v $PYTHON2 >/dev/null 2>&1; then P2_VERSION=$($PYTHON2 -c 'import sys;v = sys.version.split()[0].split("."); print("{}.{}".format(v[0], v[1]))') DEPS_PYTHON2="$WORKSPACE/deps/build/$LIBDIR/python$P2_VERSION/site-packages" - if [ "$LIBDIR" != "$LIBDIR_ARCH" ]; then + if [ "$LIBDIR" != "$LIBDIR_ARCH" ]; then DEPS_PYTHON2="$DEPS_PYTHON2:$WORKSPACE/deps/build/$LIBDIR_ARCH/python$P2_VERSION/site-packages" - fi + fi fi P3_VERSION=$($PYTHON3 -c 'import sys;v = sys.version.split()[0].split("."); print("{}.{}".format(v[0], v[1]))') diff --git a/scripts/lttng-tools/gerrit-depends-on.sh b/scripts/lttng-tools/gerrit-depends-on.sh index 5b55c82..f61f53b 100755 --- a/scripts/lttng-tools/gerrit-depends-on.sh +++ b/scripts/lttng-tools/gerrit-depends-on.sh @@ -88,39 +88,39 @@ git rev-list --format=%B --max-count=1 HEAD | while read -r line; do # the change id. We could also be clever and require that the # "branch name" be included in the `Depends-on` clause. local_query="${gerrit_url}/changes/?q=change:${gerrit_id}+branch:${GERRIT_BRANCH}${gerrit_query}" - default_branch="${GERRIT_BRANCH}" + default_branch="${GERRIT_BRANCH}" ;; *) local_query="${gerrit_url}/changes/?q=change:${gerrit_id}${gerrit_query}" - default_branch="master" + default_branch="master" ;; esac json_doc=$(curl "$local_query" | tail -n+2) count=$(jq -r '. | length' <<< "$json_doc") if [ "$count" != "1" ]; then - echo "Expected an array of size 1 got $count" - exit 1 + echo "Expected an array of size 1 got $count" + exit 1 fi ref=$(jq -r "$gerrit_json_query" <<< "$json_doc") change_status=$(jq -r "$gerrit_json_query_status" <<< "$json_doc") if [ "$change_status" == "MERGED" ]; then - # When the change we depends on is merged use master as the ref. - # This is not ideal CI time wise since we do not reuse artifacts. - # This solve a tricky situation where we actually want to use master - # instead of the change available on gerrit. Intermediary changes - # present in master could have an impact on the change under test. - echo "Depends-on change is MERGED. Defaulting to ${default_branch}" - ref="refs/heads/$default_branch" + # When the change we depends on is merged use master as the ref. + # This is not ideal CI time wise since we do not reuse artifacts. + # This solve a tricky situation where we actually want to use master + # instead of the change available on gerrit. Intermediary changes + # present in master could have an impact on the change under test. + echo "Depends-on change is MERGED. Defaulting to ${default_branch}" + ref="refs/heads/$default_branch" elif [ "$change_status" == "ABANDONED" ]; then - # We have a situation where the "HEAD" commit for feature branch are - # not merged and abandoned. Default to the master branch and hope - # for the best. This is far from ideal but we need might also need - # to find a better way to handle feature branch here. In the - # meantime use master for such cases. - echo "Depends-on change is ABANDONED. Defaulting to ${default_branch}" - ref="refs/heads/${default_branch}" + # We have a situation where the "HEAD" commit for feature branch are + # not merged and abandoned. Default to the master branch and hope + # for the best. This is far from ideal but we need might also need + # to find a better way to handle feature branch here. In the + # meantime use master for such cases. + echo "Depends-on change is ABANDONED. Defaulting to ${default_branch}" + ref="refs/heads/${default_branch}" fi # The build.sh script from userspace-rcu expects the source to be located in @@ -128,7 +128,7 @@ git rev-list --format=%B --max-count=1 HEAD | while read -r line; do if [ "$project" = "userspace-rcu" ]; then clone_directory="liburcu" else - clone_directory="$project" + clone_directory="$project" fi clone_directory="$WORKSPACE/src/$clone_directory" diff --git a/scripts/lttng-tools/postbuild_clean_processes_coredumps.sh b/scripts/lttng-tools/postbuild_clean_processes_coredumps.sh index 2f56e8c..bc62b1a 100755 --- a/scripts/lttng-tools/postbuild_clean_processes_coredumps.sh +++ b/scripts/lttng-tools/postbuild_clean_processes_coredumps.sh @@ -57,12 +57,12 @@ while read -r core_file; do # Make sure the coredump is finished using fuser while fuser "$core_file"; do sleep 1 - sleep_count+=1 + sleep_count+=1 - # Skip the core file if it takes more than 30 seconds - if [ "$sleep_count" -ge 30 ]; then - continue - fi + # Skip the core file if it takes more than 30 seconds + if [ "$sleep_count" -ge 30 ]; then + continue + fi done # Print a full backtrace of all threads diff --git a/scripts/lttng-tools/release.sh b/scripts/lttng-tools/release.sh index 430ab4e..3268e49 100644 --- a/scripts/lttng-tools/release.sh +++ b/scripts/lttng-tools/release.sh @@ -113,7 +113,7 @@ export TMPDIR="$tmpdir" # the trace reader in its test suite or that we move to only supporting # babeltrace2 if [ -x "$DEPS_BIN/babeltrace2" ]; then - ln -s "$DEPS_BIN/babeltrace2" "$DEPS_BIN/babeltrace" + ln -s "$DEPS_BIN/babeltrace2" "$DEPS_BIN/babeltrace" fi # When using babeltrace2 make sure that it finds its plugins and diff --git a/scripts/lttng-ust/build.sh b/scripts/lttng-ust/build.sh index 26672ca..8f6164a 100755 --- a/scripts/lttng-ust/build.sh +++ b/scripts/lttng-ust/build.sh @@ -139,7 +139,7 @@ exit_status=0 # Use bear to generate compile_commands.json when enabled BEAR="" if [ "$LTTNG_UST_GEN_COMPILE_COMMANDS" = "yes" ]; then - BEAR="bear" + BEAR="bear" fi # Create tmp directory @@ -170,7 +170,7 @@ clang-*) ;; *) if [ "x$cc" != "x" ]; then - export CC="$cc" + export CC="$cc" fi ;; esac @@ -246,7 +246,7 @@ agents) # Explicitly add '--enable-java-agent-log4j2', it's not part of '-all' in stable 2.12/2.13 if verlt "$PACKAGE_VERSION" "2.14"; then - CONF_OPTS+=("--enable-java-agent-log4j2") + CONF_OPTS+=("--enable-java-agent-log4j2") fi ;; diff --git a/scripts/packaging/test-run.sh b/scripts/packaging/test-run.sh index 25d432e..e0cc66d 100755 --- a/scripts/packaging/test-run.sh +++ b/scripts/packaging/test-run.sh @@ -10,7 +10,7 @@ lttng stop count=$(lttng view | wc -l) if [ $count -lt "100" ]; then - false + false fi diff --git a/scripts/system-tests/checkout-modules.sh b/scripts/system-tests/checkout-modules.sh index 9a8442b..a039467 100755 --- a/scripts/system-tests/checkout-modules.sh +++ b/scripts/system-tests/checkout-modules.sh @@ -18,5 +18,5 @@ set -exu git clone "$LTTNG_MODULES_REPO" src/lttng-modules && \ - cd src/lttng-modules && \ - git reset --hard "$LTTNG_MODULES_COMMIT_ID" + cd src/lttng-modules && \ + git reset --hard "$LTTNG_MODULES_COMMIT_ID"