update codestyle in travis scripts to conform to guidelines

* adds and fixes indentation in a few places
* removes redundant quotes
* adds quotes around some arguments to silence shellcheck warnings
* fixes spelling
This commit is contained in:
a1346054
2021-08-22 11:21:28 +00:00
committed by Markus F.X.J. Oberhumer
parent be8601f8cc
commit a94b0329c9
4 changed files with 30 additions and 31 deletions
+11 -11
View File
@@ -5,16 +5,16 @@ set -e; set -o pipefail
# Copyright (C) Markus Franz Xaver Johannes Oberhumer # Copyright (C) Markus Franz Xaver Johannes Oberhumer
if [[ $TRAVIS_OS_NAME == osx ]]; then if [[ $TRAVIS_OS_NAME == osx ]]; then
argv0=$0; argv0abs=$(greadlink -en -- "$0"); argv0dir=$(dirname "$argv0abs") argv0=$0; argv0abs=$(greadlink -en -- "$0"); argv0dir=$(dirname "$argv0abs")
else else
argv0=$0; argv0abs=$(readlink -en -- "$0"); argv0dir=$(dirname "$argv0abs") argv0=$0; argv0abs=$(readlink -en -- "$0"); argv0dir=$(dirname "$argv0abs")
fi fi
source "$argv0dir/travis_init.sh" || exit 1 source "$argv0dir/travis_init.sh" || exit 1
# create dirs # create dirs
cd / || exit 1 cd / || exit 1
mkbuilddirs $upx_BUILDDIR $ucl_BUILDDIR $upx_testsuite_BUILDDIR $zlib_BUILDDIR mkbuilddirs $upx_BUILDDIR $ucl_BUILDDIR $upx_testsuite_BUILDDIR $zlib_BUILDDIR
cd / && cd $upx_SRCDIR || exit 1 cd / && cd "$upx_SRCDIR" || exit 1
echo echo
print_settings print_settings
@@ -25,10 +25,10 @@ echo
# check whitespace # check whitespace
if [[ $TRAVIS_OS_NAME == linux ]]; then if [[ $TRAVIS_OS_NAME == linux ]]; then
cd / && cd $upx_SRCDIR || exit 1 cd / && cd $upx_SRCDIR || exit 1
echo "Checking source code for whitespace violations..." echo "Checking source code for whitespace violations..."
bash ./src/stub/scripts/check_whitespace.sh || exit 1 bash ./src/stub/scripts/check_whitespace.sh || exit 1
echo " Passed." echo " Passed."
fi # linux fi # linux
set -x set -x
@@ -45,7 +45,7 @@ if [[ $BM_X =~ (^|\+)rebuild-stubs($|\+) ]]; then
else else
bin_upx=$(readlink -en -- "$upx_SRCDIR/../deps/bin-upx-20210104") bin_upx=$(readlink -en -- "$upx_SRCDIR/../deps/bin-upx-20210104")
fi fi
cd / && cd $upx_SRCDIR || exit 1 cd / && cd "$upx_SRCDIR" || exit 1
extra_subdirs=() extra_subdirs=()
extra_subdirs+=( src/stub/src/arch/amd64 ) extra_subdirs+=( src/stub/src/arch/amd64 )
extra_subdirs+=( src/stub/src/arch/arm/v4a ) extra_subdirs+=( src/stub/src/arch/arm/v4a )
@@ -92,7 +92,7 @@ fi
# build UCL # build UCL
# #
cd / && cd $ucl_BUILDDIR || exit 1 cd / && cd "$ucl_BUILDDIR" || exit 1
# patch UCL # patch UCL
sed 's/^#elif (ACC_ARCH_AMD64 || ACC_ARCH_IA64)$/& \&\& !defined(__ILP32__)/' $ucl_SRCDIR/acc/acc_chk.ch > a.tmp sed 's/^#elif (ACC_ARCH_AMD64 || ACC_ARCH_IA64)$/& \&\& !defined(__ILP32__)/' $ucl_SRCDIR/acc/acc_chk.ch > a.tmp
if cmp -s a.tmp $ucl_SRCDIR/acc/acc_chk.ch; then rm a.tmp; else mv a.tmp $ucl_SRCDIR/acc/acc_chk.ch; fi if cmp -s a.tmp $ucl_SRCDIR/acc/acc_chk.ch; then rm a.tmp; else mv a.tmp $ucl_SRCDIR/acc/acc_chk.ch; fi
@@ -115,7 +115,7 @@ fi
# #
if [[ $BUILD_LOCAL_ZLIB == 1 ]]; then if [[ $BUILD_LOCAL_ZLIB == 1 ]]; then
cd / && cd $zlib_BUILDDIR || exit 1 cd / && cd "$zlib_BUILDDIR" || exit 1
# build manually # build manually
rm -f ./*.o libz.a rm -f ./*.o libz.a
$CC -O2 -c $zlib_SRCDIR/*.c $CC -O2 -c $zlib_SRCDIR/*.c
@@ -127,7 +127,7 @@ fi
# #
export UPX_UCLDIR="$ucl_SRCDIR" export UPX_UCLDIR="$ucl_SRCDIR"
cd / && cd $upx_BUILDDIR || exit 1 cd / && cd "$upx_BUILDDIR" || exit 1
make="make -f $upx_SRCDIR/src/Makefile" make="make -f $upx_SRCDIR/src/Makefile"
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -L$ucl_BUILDDIR/src/.libs" EXTRA_LDFLAGS="$EXTRA_LDFLAGS -L$ucl_BUILDDIR/src/.libs"
if [[ $BUILD_LOCAL_ZLIB == 1 ]]; then if [[ $BUILD_LOCAL_ZLIB == 1 ]]; then
+8 -8
View File
@@ -5,9 +5,9 @@ set -e; set -o pipefail
# Copyright (C) Markus Franz Xaver Johannes Oberhumer # Copyright (C) Markus Franz Xaver Johannes Oberhumer
if [[ $TRAVIS_OS_NAME == osx ]]; then if [[ $TRAVIS_OS_NAME == osx ]]; then
argv0=$0; argv0abs=$(greadlink -en -- "$0"); argv0dir=$(dirname "$argv0abs") argv0=$0; argv0abs=$(greadlink -en -- "$0"); argv0dir=$(dirname "$argv0abs")
else else
argv0=$0; argv0abs=$(readlink -en -- "$0"); argv0dir=$(dirname "$argv0abs") argv0=$0; argv0abs=$(readlink -en -- "$0"); argv0dir=$(dirname "$argv0abs")
fi fi
source "$argv0dir/travis_init.sh" || exit 1 source "$argv0dir/travis_init.sh" || exit 1
@@ -32,7 +32,7 @@ elif [[ -n $GITLAB_CI ]]; then
branch=$CI_BUILD_REF_NAME branch=$CI_BUILD_REF_NAME
else else
branch=$TRAVIS_BRANCH branch=$TRAVIS_BRANCH
if [[ "$TRAVIS_PULL_REQUEST" != "false" ]]; then exit 0; fi if [[ $TRAVIS_PULL_REQUEST != "false" ]]; then exit 0; fi
fi fi
subdir=${subdir%%:*}; subdir=${subdir%%/*}; subdir=${subdir%%--*} subdir=${subdir%%:*}; subdir=${subdir%%/*}; subdir=${subdir%%--*}
case $branch in case $branch in
@@ -45,9 +45,9 @@ case $branch in
esac esac
# get $rev, $branch and $git_user # get $rev, $branch and $git_user
cd / && cd $upx_SRCDIR || exit 1 cd / && cd "$upx_SRCDIR" || exit 1
rev=$(git rev-parse --verify HEAD) rev=$(git rev-parse --verify HEAD)
if [[ "$branch" == gitlab* ]]; then if [[ $branch == gitlab* ]]; then
if git fetch -v origin devel; then if git fetch -v origin devel; then
git branch -a -v git branch -a -v
rev=$(git merge-base origin/devel $rev || echo $rev) rev=$(git merge-base origin/devel $rev || echo $rev)
@@ -74,7 +74,7 @@ unset timestamp date
# // prepare directory $d # // prepare directory $d
# ************************************************************************/ # ************************************************************************/
cd / && cd $upx_BUILDDIR || exit 1 cd / && cd "$upx_BUILDDIR" || exit 1
mkdir deploy || exit 1 mkdir deploy || exit 1
chmod 700 deploy chmod 700 deploy
@@ -105,10 +105,10 @@ d=$d-$BM_C-$BM_B
# remove redundant -m32/-m64/-x86/-x64 from directory name # remove redundant -m32/-m64/-x86/-x64 from directory name
if [[ $d =~ ^((i386-darwin|i386-linux|i386-win32).*)(-m32|-x86)(-.+)?$ ]]; then if [[ $d =~ ^((i386-darwin|i386-linux|i386-win32).*)(-m32|-x86)(-.+)?$ ]]; then
d="${BASH_REMATCH[1]}${BASH_REMATCH[4]}" d="${BASH_REMATCH[1]}${BASH_REMATCH[4]}"
fi fi
if [[ $d =~ ^((amd64-darwin|amd64-linux|amd64-win64).*)(-m64|-x64)(-.+)?$ ]]; then if [[ $d =~ ^((amd64-darwin|amd64-linux|amd64-win64).*)(-m64|-x64)(-.+)?$ ]]; then
d="${BASH_REMATCH[1]}${BASH_REMATCH[4]}" d="${BASH_REMATCH[1]}${BASH_REMATCH[4]}"
fi fi
if [[ -n $subdir ]]; then if [[ -n $subdir ]]; then
+2 -2
View File
@@ -140,7 +140,7 @@ if [[ -n $BM_CROSS ]]; then
esac esac
fi fi
fi # BM_CROSS fi # BM_CROSS
if [[ "$CC" == "false" ]]; then # generic if [[ $CC == "false" ]]; then # generic
if [[ -z $BM_CROSS ]]; then if [[ -z $BM_CROSS ]]; then
if [[ $TRAVIS_OS_NAME == osx ]]; then if [[ $TRAVIS_OS_NAME == osx ]]; then
case $BM_C in case $BM_C in
@@ -199,7 +199,7 @@ mkbuilddirs() {
} }
# search for an existing $toptop_builddir # search for an existing $toptop_builddir
if [[ -z $toptop_builddir ]]; then if [[ -z $toptop_builddir ]]; then
for d in . ..; do for d in . ..; do
for subdir in "local" appveyor circle github gitlab travis .; do for subdir in "local" appveyor circle github gitlab travis .; do
dd=$d/build/$subdir dd=$d/build/$subdir
if [[ -d $dd ]]; then if [[ -d $dd ]]; then
+9 -10
View File
@@ -9,9 +9,9 @@ set -e; set -o pipefail
# #
if [[ $TRAVIS_OS_NAME == osx ]]; then if [[ $TRAVIS_OS_NAME == osx ]]; then
argv0=$0; argv0abs=$(greadlink -en -- "$0"); argv0dir=$(dirname "$argv0abs") argv0=$0; argv0abs=$(greadlink -en -- "$0"); argv0dir=$(dirname "$argv0abs")
else else
argv0=$0; argv0abs=$(readlink -en -- "$0"); argv0dir=$(dirname "$argv0abs") argv0=$0; argv0abs=$(readlink -en -- "$0"); argv0dir=$(dirname "$argv0abs")
fi fi
source "$argv0dir/travis_init.sh" || exit 1 source "$argv0dir/travis_init.sh" || exit 1
@@ -27,7 +27,7 @@ fi
# create dirs # create dirs
cd / || exit 1 cd / || exit 1
mkbuilddirs $upx_testsuite_BUILDDIR mkbuilddirs $upx_testsuite_BUILDDIR
cd / && cd $upx_testsuite_BUILDDIR || exit 1 cd / && cd "$upx_testsuite_BUILDDIR" || exit 1
if [[ ! -d $upx_testsuite_SRCDIR/files/packed ]]; then exit 1; fi if [[ ! -d $upx_testsuite_SRCDIR/files/packed ]]; then exit 1; fi
# /*********************************************************************** # /***********************************************************************
@@ -43,7 +43,7 @@ testsuite_split_f() {
fb=$(basename "$1") fb=$(basename "$1")
fsubdir=$(basename "$fd") fsubdir=$(basename "$fd")
# sanity checks # sanity checks
if [[ ! -f "$1" || -z "$fsubdir" || -z "$fb" ]]; then if [[ ! -f $1 || -z $fsubdir || -z $fb ]]; then
fd= fb= fsubdir= fd= fb= fsubdir=
fi fi
} }
@@ -111,7 +111,7 @@ testsuite_run_compress() {
# ************************************************************************/ # ************************************************************************/
recreate_expected_sha256sums() { recreate_expected_sha256sums() {
local o="$1" local o=$1
local files f d local files f d
echo "########## begin .sha256sums.recreate" > "$o" echo "########## begin .sha256sums.recreate" > "$o"
files=*/.sha256sums.current files=*/.sha256sums.current
@@ -163,7 +163,7 @@ if [[ $BM_T =~ (^|\+)valgrind($|\+) ]]; then
fi fi
if [[ $BM_B =~ (^|\+)coverage($|\+) ]]; then if [[ $BM_B =~ (^|\+)coverage($|\+) ]]; then
(cd / && cd $upx_BUILDDIR && lcov -d . --zerocounters) (cd / && cd "$upx_BUILDDIR" && lcov -d . --zerocounters)
fi fi
export UPX="--prefer-ucl --no-color --no-progress" export UPX="--prefer-ucl --no-color --no-progress"
@@ -194,7 +194,6 @@ for f in $upx_testsuite_SRCDIR/files/packed/*/upx-3.9[15]*; do
done done
testsuite_check_sha $testdir testsuite_check_sha $testdir
# run one pack+unpack step to canonicalize the files # run one pack+unpack step to canonicalize the files
testdir=t020_canonicalized testdir=t020_canonicalized
mkdir $testdir; v=expected_sha256sums__$testdir; echo -n "${!v}" >$testdir/.sha256sums.expected mkdir $testdir; v=expected_sha256sums__$testdir; echo -n "${!v}" >$testdir/.sha256sums.expected
@@ -248,7 +247,7 @@ time testsuite_run_compress --all-methods --no-lzma -5 --no-filter
# // summary # // summary
# ************************************************************************/ # ************************************************************************/
# recreate checkums from current version for an easy update in case of changes # recreate checksums from current version for an easy update in case of changes
recreate_expected_sha256sums .sha256sums.recreate recreate_expected_sha256sums .sha256sums.recreate
testsuite_header "UPX testsuite summary" testsuite_header "UPX testsuite summary"
@@ -258,10 +257,10 @@ if ! $upx_run --version; then
fi fi
echo echo
echo "upx_exe='$upx_exe'" echo "upx_exe='$upx_exe'"
if [[ "$upx_run" != "$upx_exe" ]]; then if [[ $upx_run != "$upx_exe" ]]; then
echo "upx_run='$upx_run'" echo "upx_run='$upx_run'"
fi fi
if [[ -f "$upx_exe" ]]; then if [[ -f $upx_exe ]]; then
ls -l "$upx_exe" ls -l "$upx_exe"
file "$upx_exe" || true file "$upx_exe" || true
fi fi