Skip to content

Commit 2895530

Browse files
committed
Address shellcheck errors/warnings in build.sh
1 parent fbe82f7 commit 2895530

File tree

1 file changed

+21
-10
lines changed

1 file changed

+21
-10
lines changed

prerequisites/build.sh

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#
66
# - Build OpenCoarrays prerequisite packages and their prerequisites
77
#
8-
# Usage: LOG_LEVEL=7 B3B_USE_CASE=/opt/bash3boilerplate/src/use-case ./my-script.sh -f script_input.txt
8+
# Usage: LOG_LEVEL=7 B3B_USE_CASE=/opt/bash3boilerplate/src/use-case ./my-script.sh -f script_input.txt
99
#
1010
# More info:
1111
#
@@ -28,7 +28,7 @@
2828
# (1) Import several bash3boilerplate helper functions & default settings.
2929
# (2) Set several variables describing the current file and its usage page.
3030
# (3) Parse the usage information (default usage file name: current file's name with -usage appended).
31-
# (4) Parse the command line using the usage information.
31+
# (4) Parse the command line using the usage information.
3232

3333

3434
export OPENCOARRAYS_SRC_DIR="${OPENCOARRAYS_SRC_DIR:-${PWD}/..}"
@@ -40,9 +40,10 @@ if [[ ! -f "${OPENCOARRAYS_SRC_DIR}/src/libcaf.h" ]]; then
4040
fi
4141
export B3B_USE_CASE="${B3B_USE_CASE:-${OPENCOARRAYS_SRC_DIR}/prerequisites/use-case}"
4242
if [[ ! -f "${B3B_USE_CASE:-}/bootstrap.sh" ]]; then
43-
echo "Please set B3B_USE_CASE to the bash3boilerplate use-case directory path."
43+
echo "Please set B3B_USE_CASE to the bash3boilerplate use-case directory path."
4444
exit 2
4545
fi
46+
# shellcheck source=./use-case/bootstrap.sh
4647
source "${B3B_USE_CASE}/bootstrap.sh" "$@"
4748

4849

@@ -59,13 +60,14 @@ trap cleanup_before_exit EXIT # The signal is specified here. Could be SIGINT, S
5960

6061
export __flag_present=1
6162

63+
# shellcheck disable=SC2154
6264
if [[ "${arg_l}" != "${__flag_present}" && "${arg_L}" != "${__flag_present}" &&
6365
"${arg_v}" != "${__flag_present}" && "${arg_h}" != "${__flag_present}" &&
6466
-z "${arg_D:-${arg_p:-${arg_P:-${arg_U:-${arg_V}}}}}" ]]; then
6567
help "${__base}: Insufficient arguments. Please pass either -D, -h, -l, -L, -p, -P, -U, -v, -V, or a longer equivalent."
6668
fi
6769

68-
# Suppress info and debug messages if -l, -P, -U, -V, -D, or their longer equivalent is present:
70+
# Suppress info and debug messages if -l, -P, -U, -V, -D, or their longer equivalent is present:
6971
[[ "${arg_l}" == "${__flag_present}" || ! -z "${arg_P:-${arg_U:-${arg_V:-${arg_D}}}}" ]] && suppress_info_debug_messages
7072

7173
[ -z "${LOG_LEVEL:-}" ] && emergency "Cannot continue without LOG_LEVEL. "
@@ -75,10 +77,11 @@ fi
7577
[ ! -z "${arg_P:-}" ] && [ ! -z "${arg_U:-}" ] && emergency "Only specify one of -P, -U, -V, or their long-form equivalents."
7678
[ ! -z "${arg_U:-}" ] && [ ! -z "${arg_V:-}" ] && emergency "Only specify one of -P, -U, -V, or their long-form equivalents."
7779

78-
### Print bootstrapped magic variables to STDERR when LOG_LEVEL
80+
### Print bootstrapped magic variables to STDERR when LOG_LEVEL
7981
### is at the default value (6) or above.
8082
#####################################################################
81-
83+
# shellcheck disable=SC2154
84+
{
8285
info "__file: ${__file}"
8386
info "__dir: ${__dir}"
8487
info "__base: ${__base}"
@@ -87,8 +90,8 @@ info "__usage: ${__usage}"
8790
info "LOG_LEVEL: ${LOG_LEVEL}"
8891

8992
info "-b (--branch): ${arg_b} "
90-
info "-c (--with-c): ${arg_c} "
91-
info "-C (--with-cpp): ${arg_C} "
93+
info "-c (--with-c): ${arg_c} "
94+
info "-C (--with-cpp): ${arg_C} "
9295
info "-d (--debug): ${arg_d} "
9396
info "-D (--print-downloader): ${arg_D} "
9497
info "-e (--verbose): ${arg_e} "
@@ -103,33 +106,41 @@ info "-m (--with-cmake): ${arg_m} "
103106
info "-M (--with-mpi): ${arg_M} "
104107
info "-n (--no-color): ${arg_n} "
105108
info "-p (--package): ${arg_p}"
106-
info "-P (--print-path): ${arg_P} "
109+
info "-P (--print-path): ${arg_P} "
107110
info "-t (--with-tau): ${arg_t} "
108111
info "-U (--print-url): ${arg_U} "
109112
info "-v (--version): ${arg_v} "
110113
info "-V (--print-version): ${arg_V} "
111-
114+
}
115+
# shellcheck source=./build-functions/set_or_print_default_version.sh
112116
source "${OPENCOARRAYS_SRC_DIR:-}/prerequisites/build-functions/set_or_print_default_version.sh"
113117
set_or_print_default_version
114118
export version_to_build="${arg_I:-${default_version}}"
115119

120+
# shellcheck source=./build-functions/set_or_print_downloader.sh
116121
source "${OPENCOARRAYS_SRC_DIR:-}/prerequisites/build-functions/set_or_print_downloader.sh"
117122
set_or_print_downloader
118123

124+
# shellcheck source=./build-functions/set_or_print_url.sh
119125
source "${OPENCOARRAYS_SRC_DIR:-}/prerequisites/build-functions/set_or_print_url.sh"
120126
set_or_print_url
121127

128+
# shellcheck source=./build-functions/set_or_print_installation_path.sh
122129
source "${OPENCOARRAYS_SRC_DIR:-}/prerequisites/build-functions/set_or_print_installation_path.sh"
123130
set_or_print_installation_path
124131

132+
# shellcheck source=./build-functions/download_if_necessary.sh
125133
source "${OPENCOARRAYS_SRC_DIR:-}/prerequisites/build-functions/download_if_necessary.sh"
126134
download_if_necessary
127135

136+
# shellcheck source=./build-functions/unpack_if_necessary.sh
128137
source "${OPENCOARRAYS_SRC_DIR:-}/prerequisites/build-functions/unpack_if_necessary.sh"
129138
unpack_if_necessary
130139

140+
# shellcheck source=./build-functions/set_compilers.sh
131141
source "${OPENCOARRAYS_SRC_DIR:-}/prerequisites/build-functions/set_compilers.sh"
132142
set_compilers
133143

144+
# shellcheck source=./build-functions/build_and_install.sh
134145
source "${OPENCOARRAYS_SRC_DIR:-}/prerequisites/build-functions/build_and_install.sh"
135146
build_and_install

0 commit comments

Comments
 (0)