mirror of
https://github.com/weechat/weechat.git
synced 2026-06-27 13:26:38 +02:00
core: don't use eval to run commands in scripts
This fixes the following shellcheck error: SC2294 (warning): eval negates the benefit of arrays. Drop eval to preserve whitespace/symbols (or eval as string).
This commit is contained in:
+11
-11
@@ -41,29 +41,29 @@ err ()
|
||||
|
||||
run ()
|
||||
{
|
||||
printf "Running \"%s\"..." "$@"
|
||||
if eval "$@" >"$AUTOGEN_LOG" 2>&1 ; then
|
||||
echo " OK"
|
||||
printf "Running \"%s\"... " "$*"
|
||||
if "$@" >"$AUTOGEN_LOG" 2>&1 ; then
|
||||
echo "OK"
|
||||
else
|
||||
echo " FAILED"
|
||||
echo "FAILED"
|
||||
err
|
||||
fi
|
||||
}
|
||||
|
||||
# remove autotools stuff
|
||||
run "rm -f config.h.in"
|
||||
run "rm -f aclocal.m4 configure config.log config.status"
|
||||
run "rm -rf autom4te*.cache"
|
||||
run rm -f config.h.in
|
||||
run rm -f aclocal.m4 configure config.log config.status
|
||||
run rm -rf "autom4te*.cache"
|
||||
|
||||
# remove libtool stuff
|
||||
run "rm -f libtool"
|
||||
run rm -f libtool
|
||||
|
||||
# remove gettext stuff
|
||||
run "rm -f ABOUT-NLS"
|
||||
run "rm -rf intl"
|
||||
run rm -f ABOUT-NLS
|
||||
run rm -rf intl
|
||||
|
||||
# execute autoreconf cmds
|
||||
run "autoreconf -vi"
|
||||
run autoreconf -vi
|
||||
|
||||
# ending
|
||||
rm -f "$AUTOGEN_LOG"
|
||||
|
||||
+27
-25
@@ -36,14 +36,8 @@
|
||||
# This script is used to build WeeChat in CI environment.
|
||||
#
|
||||
|
||||
run ()
|
||||
{
|
||||
echo "Running \"$*\"..."
|
||||
if ! eval "$@"; then
|
||||
echo "ERROR"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
# exit on any error
|
||||
set -e
|
||||
|
||||
BUILDDIR="build-tmp-$$"
|
||||
|
||||
@@ -61,32 +55,40 @@ if [ -z "$BUILDTOOL" ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
run ()
|
||||
{
|
||||
"$@"
|
||||
}
|
||||
|
||||
# display commands
|
||||
set -x
|
||||
|
||||
# create build directory
|
||||
run "mkdir $BUILDDIR"
|
||||
run "cd $BUILDDIR"
|
||||
mkdir "$BUILDDIR"
|
||||
cd "$BUILDDIR"
|
||||
|
||||
if [ "$BUILDTOOL" = "cmake" ]; then
|
||||
# build with CMake
|
||||
run "cmake .. -DENABLE_MAN=ON -DENABLE_DOC=ON -DENABLE_TESTS=ON ${BUILDARGS}"
|
||||
run cmake .. -DENABLE_MAN=ON -DENABLE_DOC=ON -DENABLE_TESTS=ON "${BUILDARGS}"
|
||||
if [ -f "build.ninja" ]; then
|
||||
run "ninja -v"
|
||||
run "ninja -v changelog"
|
||||
run "ninja -v rn"
|
||||
run "sudo ninja install"
|
||||
ninja -v
|
||||
ninja -v changelog
|
||||
ninja -v rn
|
||||
sudo ninja install
|
||||
else
|
||||
run "make VERBOSE=1 -j$(nproc)"
|
||||
run "make VERBOSE=1 changelog"
|
||||
run "make VERBOSE=1 rn"
|
||||
run "sudo make install"
|
||||
make VERBOSE=1 --jobs="$(nproc)"
|
||||
make VERBOSE=1 changelog
|
||||
make VERBOSE=1 rn
|
||||
sudo make install
|
||||
fi
|
||||
run "ctest -V"
|
||||
ctest -V
|
||||
fi
|
||||
|
||||
if [ "$BUILDTOOL" = "autotools" ]; then
|
||||
# build with autotools
|
||||
run "../autogen.sh"
|
||||
run "../configure --enable-man --enable-doc --enable-tests ${BUILDARGS}"
|
||||
run "make -j$(nproc)"
|
||||
run "sudo make install"
|
||||
run "./tests/tests -v"
|
||||
../autogen.sh
|
||||
run ../configure --enable-man --enable-doc --enable-tests "${BUILDARGS}"
|
||||
make --jobs="$(nproc)"
|
||||
sudo make install
|
||||
./tests/tests -v
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user