-
-
Notifications
You must be signed in to change notification settings - Fork 313
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
style(shell): Address various shellcheck issues and formatting #3548
base: main
Are you sure you want to change the base?
Changes from all commits
8f192a3
7306341
bba2c8c
b83fddf
5368efb
182478b
865b79d
ba3b9cd
9594172
882ea97
f2c4bdf
9089e1e
eb93acc
9ceeaa4
00e99ae
556efc7
cfd93f6
22e9007
284d8d8
8c60635
a7fe797
12e92fd
ee39a20
ec1f378
f5085ac
465b78d
4aa7694
7f69537
9de6688
3d3b773
8ada2c3
91e2773
503bcee
f6d374f
a89c65d
95d06b5
859d6ed
b476ab8
46870ae
0b1ab69
ee1721a
bb905b7
27415a7
2176756
5b1e1b4
d4fcd17
d5b0f3b
7b6f4b6
1abbb07
0da3c1d
08a4fd8
4ddb7d0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -19,10 +19,10 @@ fi | |||||
# Adding -Werror to make's CFLAGS is a workaround for configuring with | ||||||
# an old version of configure, which issues compiler warnings and | ||||||
# errors out. This may be removed with upgraded configure.in file. | ||||||
makecmd="make" | ||||||
if [[ "$#" -ge 2 ]]; then | ||||||
makecmd=("make") | ||||||
if [[ $# -ge 2 ]]; then | ||||||
ARGS=("$@") | ||||||
makecmd="make CFLAGS='$CFLAGS ${ARGS[@]:1}' CXXFLAGS='$CXXFLAGS ${ARGS[@]:1}'" | ||||||
makecmd=("make" "CFLAGS=$CFLAGS ${ARGS[@]:1}" "CXXFLAGS=$CXXFLAGS ${ARGS[@]:1}") | ||||||
fi | ||||||
|
||||||
# non-existent variables as an errors | ||||||
|
@@ -52,5 +52,5 @@ export INSTALL_PREFIX=$1 | |||||
--with-tiff \ | ||||||
--with-zstd | ||||||
|
||||||
eval $makecmd | ||||||
"${makecmd[@]}" | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This isn't quite the same. When having the quoted $makecmd, the arguments aren't split. Having unquoted $makecmd is problematic for globs, or all reasons why you'd want to quote variables. Double quoted array with See https://www.shellcheck.net/wiki/SC2086 for general quoting tips (near the end), and https://www.shellcheck.net/wiki/SC2068 and https://www.shellcheck.net/wiki/SC2048 and There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This goes with above suggestion. |
||||||
make install |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,9 +19,10 @@ fi | |
# Adding -Werror to make's CFLAGS is a workaround for configuring with | ||
# an old version of configure, which issues compiler warnings and | ||
# errors out. This may be removed with upgraded configure.in file. | ||
makecmd="make" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See build_ubuntu-22.04.sh |
||
if [[ "$#" -eq 2 ]]; then | ||
makecmd="make CFLAGS='$CFLAGS $2' CXXFLAGS='$CXXFLAGS $2'" | ||
makecmd=("make") | ||
if [[ $# -ge 2 ]]; then | ||
ARGS=("$@") | ||
makecmd=("make" "CFLAGS=$CFLAGS ${ARGS[@]:1}" "CXXFLAGS=$CXXFLAGS ${ARGS[@]:1}") | ||
fi | ||
|
||
# non-existent variables as an errors | ||
|
@@ -50,5 +51,5 @@ export INSTALL_PREFIX=$1 | |
--without-openmp \ | ||
--without-pthread | ||
|
||
eval $makecmd | ||
"${makecmd[@]}" | ||
make install |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -18,7 +18,7 @@ CONFIGURE_FLAGS="\ | |||||
--with-bzlib-libs=${CONDA_PREFIX}/lib \ | ||||||
--with-cairo \ | ||||||
--with-cairo-includes=${CONDA_PREFIX}/include/cairo \ | ||||||
--with-cairo-ldflags="-lcairo" \ | ||||||
--with-cairo-ldflags=-lcairo \ | ||||||
--with-cairo-libs=${CONDA_PREFIX}/lib \ | ||||||
--with-cxx \ | ||||||
--with-fftw-includes=${CONDA_PREFIX}/include \ | ||||||
|
@@ -33,7 +33,6 @@ CONFIGURE_FLAGS="\ | |||||
--with-libpng=${CONDA_PREFIX}/bin/libpng-config \ | ||||||
--with-libs=${CONDA_PREFIX}/lib \ | ||||||
--with-netcdf=${CONDA_PREFIX}/bin/nc-config \ | ||||||
--with-netcdf=${CONDA_PREFIX}/bin/nc-config \ | ||||||
--with-nls \ | ||||||
--with-opengl=aqua \ | ||||||
--with-openmp \ | ||||||
|
@@ -46,7 +45,7 @@ CONFIGURE_FLAGS="\ | |||||
--with-proj-share=${CONDA_PREFIX}/share/proj \ | ||||||
--with-readline \ | ||||||
--with-readline-includes=${CONDA_PREFIX}/include/readline \ | ||||||
--with-readline-libs=${CONDA_PREFIX}/lib | ||||||
--with-readline-libs=${CONDA_PREFIX}/lib \ | ||||||
--with-sqlite \ | ||||||
--with-sqlite-includes=${CONDA_PREFIX}/include \ | ||||||
--with-sqlite-libs=${CONDA_PREFIX}/lib \ | ||||||
|
@@ -56,7 +55,7 @@ CONFIGURE_FLAGS="\ | |||||
--with-zstd-includes=${CONDA_PREFIX}/include \ | ||||||
--with-zstd-libs=${CONDA_PREFIX}/lib \ | ||||||
--without-mysql \ | ||||||
--without-x \ | ||||||
--without-x | ||||||
" | ||||||
|
||||||
export CFLAGS="-O2 -pipe -arch ${CONDA_ARCH} -DGL_SILENCE_DEPRECATION -Wall -Wextra -Wpedantic -Wvla" | ||||||
|
@@ -66,7 +65,7 @@ export CPPFLAGS="-isystem${CONDA_PREFIX}/include" | |||||
./configure $CONFIGURE_FLAGS | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This I wasn't sure that it would work on posix shell on Mac, and didn't know the complete side effects There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What shellcheck suggest is the same on Mac. |
||||||
|
||||||
EXEMPT="" | ||||||
make -j$(sysctl -n hw.ncpu) CFLAGS="$CFLAGS -Werror $EXEMPT" \ | ||||||
CXXFLAGS="$CXXFLAGS -Werror $EXEMPT" | ||||||
make -j"$(sysctl -n hw.ncpu)" CFLAGS="$CFLAGS -Werror $EXEMPT" \ | ||||||
CXXFLAGS="$CXXFLAGS -Werror $EXEMPT" | ||||||
|
||||||
make install |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
#!/usr/bin/env sh | ||
# Tests generating toolboxes XML | ||
|
||
# run make in gui/wxpython before the test | ||
# run test using sh -e | ||
|
||
python $GISBASE/gui/wxpython/core/toolboxes.py doctest | ||
python $GISBASE/gui/wxpython/core/toolboxes.py test | ||
python "$GISBASE/gui/wxpython/core/toolboxes.py" doctest | ||
python "$GISBASE/gui/wxpython/core/toolboxes.py" test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here, I'd suggest to refactor, to make things more clear: