ci: Fix various shellcheck warnings in the shell scripts

I haven’t tested any of them. This is entirely mechanical. I used
shellcheck 0.7.0 with default options.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
This commit is contained in:
Philip Withnall 2020-02-25 11:46:11 +00:00
parent 95479256df
commit 23d26cfe7e
8 changed files with 34 additions and 27 deletions

View File

@ -24,8 +24,8 @@ set -e
# Download Android NDK
ANDROID_NDK_VERSION="r17b"
ANDROID_NDK_SHA512="062fac12f747730f5563995089a8b4abab683fbbc621aa8582fdf35fe327daee5d69ed2437af257c10ec4ef54ecd3805a8f134a1400eb8f34ee76f55c8dc9ae9"
wget --quiet https://dl.google.com/android/repository/android-ndk-$ANDROID_NDK_VERSION-linux-x86_64.zip
echo "$ANDROID_NDK_SHA512 android-ndk-$ANDROID_NDK_VERSION-linux-x86_64.zip" | sha512sum -c
unzip android-ndk-$ANDROID_NDK_VERSION-linux-x86_64.zip
rm android-ndk-$ANDROID_NDK_VERSION-linux-x86_64.zip
mv android-ndk-$ANDROID_NDK_VERSION $ANDROID_NDK_PATH
wget --quiet "https://dl.google.com/android/repository/android-ndk-${ANDROID_NDK_VERSION}-linux-x86_64.zip"
echo "${ANDROID_NDK_SHA512} android-ndk-${ANDROID_NDK_VERSION}-linux-x86_64.zip" | sha512sum -c
unzip "android-ndk-${ANDROID_NDK_VERSION}-linux-x86_64.zip"
rm "android-ndk-${ANDROID_NDK_VERSION}-linux-x86_64.zip"
mv "android-ndk-${ANDROID_NDK_VERSION}" "${ANDROID_NDK_PATH}"

View File

@ -27,7 +27,7 @@ toolchain_path=$(pwd)/android-toolchain-$arch-$api
prefix_path=$(pwd)/android-$arch-$api
# Create standalone toolchains
$ANDROID_NDK_PATH/build/tools/make_standalone_toolchain.py --arch $arch --api $api --install-dir $toolchain_path
"${ANDROID_NDK_PATH}/build/tools/make_standalone_toolchain.py" --arch "${arch}" --api "${api}" --install-dir "${toolchain_path}"
target_host=aarch64-linux-android
export AR=$target_host-ar
@ -45,7 +45,7 @@ if [ "$api" -lt "28" ]; then
echo "1233fe3ca09341b53354fd4bfe342a7589181145a1232c9919583a8c9979636855839049f3406f253a9d9829908816bb71fd6d34dd544ba290d6f04251376b1a libiconv-1.15.tar.gz" | sha512sum -c
tar xzf libiconv-1.15.tar.gz
pushd libiconv-1.15
./configure --host=$target_host --prefix=$prefix_path --libdir=$prefix_path/lib64
./configure --host="${target_host}" --prefix="${prefix_path}" --libdir="${prefix_path}/lib64"
make
make install
popd
@ -58,7 +58,7 @@ wget --quiet https://github.com/libffi/libffi/releases/download/v3.3-rc0/libffi-
echo "e6e695d32cd6eb7d65983f32986fccdfc786a593d2ea18af30ce741f58cfa1eb264b1a8d09df5084cb916001aea15187b005c2149a0620a44397a4453b6137d4 libffi-3.3-rc0.tar.gz" | sha512sum -c
tar xzf libffi-3.3-rc0.tar.gz
pushd libffi-3.3-rc0
./configure --host=$target_host --prefix=$prefix_path --libdir=$prefix_path/lib64
./configure --host="${target_host}" --prefix="${prefix_path}" --libdir="${prefix_path}/lib64"
make
make install
popd
@ -66,9 +66,9 @@ rm libffi-3.3-rc0.tar.gz
rm -r libffi-3.3-rc0
# Create a pkg-config wrapper that won't pick fedora libraries
mkdir -p $prefix_path/bin
mkdir -p "${prefix_path}/bin"
export PKG_CONFIG=$prefix_path/bin/pkg-config
cat > $PKG_CONFIG <<- EOM
cat > "${PKG_CONFIG}" <<- EOM
#!/bin/sh
SYSROOT=${prefix_path}
export PKG_CONFIG_DIR=
@ -76,10 +76,10 @@ export PKG_CONFIG_LIBDIR=\${SYSROOT}/lib64/pkgconfig
export PKG_CONFIG_SYSROOT_DIR=\${SYSROOT}
exec pkg-config "\$@"
EOM
chmod +x $PKG_CONFIG
chmod +x "${PKG_CONFIG}"
# Create a cross file that can be passed to meson
cat > cross_file_android_${arch}_${api}.txt <<- EOM
cat > "cross_file_android_${arch}_${api}.txt" <<- EOM
[host_machine]
system = 'android'
cpu_family = 'aarch64'

View File

@ -19,7 +19,7 @@ genhtml \
-o _coverage/coverage
cd _coverage
rm -f *.lcov
rm -f ./*.lcov
cat >index.html <<EOL
<html>

View File

@ -12,5 +12,5 @@ git fetch upstream
# `upstream/master` or `upstream/glib-2-62`).
# `${CI_MERGE_REQUEST_TARGET_BRANCH_NAME}` is only defined if were running in
# a merge request pipeline; fall back to `${CI_DEFAULT_BRANCH}` otherwise.
newest_common_ancestor_sha=$(diff --old-line-format='' --new-line-format='' <(git rev-list --first-parent upstream/${CI_MERGE_REQUEST_TARGET_BRANCH_NAME:-${CI_DEFAULT_BRANCH}}) <(git rev-list --first-parent HEAD) | head -1)
newest_common_ancestor_sha=$(diff --old-line-format='' --new-line-format='' <(git rev-list --first-parent "upstream/${CI_MERGE_REQUEST_TARGET_BRANCH_NAME:-${CI_DEFAULT_BRANCH}}") <(git rev-list --first-parent HEAD) | head -1)
./.gitlab-ci/check-todos.py "${newest_common_ancestor_sha}"

View File

@ -6,9 +6,9 @@ read_arg() {
# $3 = arg parameter
local rematch='^[^=]*=(.*)$'
if [[ $2 =~ $rematch ]]; then
read "$1" <<< "${BASH_REMATCH[1]}"
read -r "$1" <<< "${BASH_REMATCH[1]}"
else
read "$1" <<< "$3"
read -r "$1" <<< "$3"
# There is no way to shift our callers args, so
# return 1 to indicate they should do it instead.
return 1
@ -16,7 +16,7 @@ read_arg() {
}
SUDO_CMD="sudo"
if `docker -v | grep -q podman` ; then
if docker -v |& grep -q podman; then
# Using podman
SUDO_CMD=""
# Docker is actually implemented by podman, and its OCI output
@ -27,6 +27,8 @@ fi
set -e
base=""
base_version=""
build=0
run=0
push=0
@ -79,7 +81,7 @@ if [ $list == 1 ]; then
fi
# All commands after this require --base to be set
if [ -z $base ]; then
if [ -z "${base}" ]; then
echo "Usage: $0 <command>"
exit 1
fi
@ -89,7 +91,7 @@ if [ ! -f "$base.Dockerfile" ]; then
exit 1
fi
if [ -z $base_version ]; then
if [ -z "${base_version}" ]; then
base_version="latest"
else
base_version="v$base_version"

View File

@ -15,7 +15,7 @@ git fetch upstream
# `upstream/master` or `upstream/glib-2-62`).
# `${CI_MERGE_REQUEST_TARGET_BRANCH_NAME}` is only defined if were running in
# a merge request pipeline; fall back to `${CI_DEFAULT_BRANCH}` otherwise.
newest_common_ancestor_sha=$(diff --old-line-format='' --new-line-format='' <(git rev-list --first-parent upstream/${CI_MERGE_REQUEST_TARGET_BRANCH_NAME:-${CI_DEFAULT_BRANCH}}) <(git rev-list --first-parent HEAD) | head -1)
newest_common_ancestor_sha=$(diff --old-line-format='' --new-line-format='' <(git rev-list --first-parent "upstream/${CI_MERGE_REQUEST_TARGET_BRANCH_NAME:-${CI_DEFAULT_BRANCH}}") <(git rev-list --first-parent HEAD) | head -1)
git diff -U0 --no-color "${newest_common_ancestor_sha}" | ./clang-format-diff.py -binary "clang-format-7" -p1
)

View File

@ -14,7 +14,7 @@ esac
meson test \
-C _build \
--timeout-multiplier ${MESON_TEST_TIMEOUT_MULTIPLIER} \
--timeout-multiplier "${MESON_TEST_TIMEOUT_MULTIPLIER}" \
--no-suite flaky \
"$@"

View File

@ -27,16 +27,21 @@ pacman --noconfirm -S --needed \
curl -O -J -L "https://github.com/linux-test-project/lcov/releases/download/v1.14/lcov-1.14.tar.gz"
echo "14995699187440e0ae4da57fe3a64adc0a3c5cf14feab971f8db38fb7d8f071a lcov-1.14.tar.gz" | sha256sum -c
tar -xzf lcov-1.14.tar.gz
LCOV="$(pwd)/lcov-1.14/bin/lcov"
# FIXME: not currently using lcov, see below
#LCOV="$(pwd)/lcov-1.14/bin/lcov"
mkdir -p _coverage
mkdir -p _ccache
export CCACHE_BASEDIR="$(pwd)"
export CCACHE_DIR="${CCACHE_BASEDIR}/_ccache"
CCACHE_BASEDIR="$(pwd)"
CCACHE_DIR="${CCACHE_BASEDIR}/_ccache"
export CCACHE_BASEDIR CCACHE_DIR
pip3 install --upgrade --user meson==0.49.2
export PATH="$HOME/.local/bin:$PATH"
export CFLAGS="-coverage -ftest-coverage -fprofile-arcs"
PATH="$HOME/.local/bin:$PATH"
CFLAGS="-coverage -ftest-coverage -fprofile-arcs"
DIR="$(pwd)"
export PATH CFLAGS
meson --werror --buildtype debug _build
cd _build
@ -53,7 +58,7 @@ ninja
# --output-file "${DIR}/_coverage/${CI_JOB_NAME}-baseline.lcov"
# FIXME: fix the test suite
meson test --timeout-multiplier ${MESON_TEST_TIMEOUT_MULTIPLIER} --no-suite flaky || true
meson test --timeout-multiplier "${MESON_TEST_TIMEOUT_MULTIPLIER}" --no-suite flaky || true
python3 "${DIR}"/.gitlab-ci/meson-junit-report.py \
--project-name glib \