Merge branch 'shell-ci-fixes' into 'master'

ci: Correctly propagate exit status in run-style-check-diff.sh

See merge request GNOME/glib!1387
This commit is contained in:
Philip Withnall 2020-02-27 11:20:14 +00:00
commit 67610c7c0f
13 changed files with 84 additions and 69 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

@ -1,6 +1,6 @@
#!/bin/bash
set +e
set -e
# We need to add a new remote for the upstream master, since this script could
# be running in a personal fork of the repository which has out of date branches.
@ -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

@ -1,6 +1,9 @@
#!/bin/bash
set +e
set -e
# Wrap everything in a subshell so we can propagate the exit status.
(
# We need to add a new remote for the upstream master, since this script could
# be running in a personal fork of the repository which has out of date branches.
@ -12,9 +15,12 @@ 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
)
exit_status=$?
# The style check is not infallible. The clang-format configuration cannot
# perfectly describe GLibs coding style: in particular, it cannot align
# function arguments. The documented coding style for GLib takes priority over
@ -29,3 +35,5 @@ echo "Note that clang-format output is advisory and cannot always match the GLib
echo " https://gitlab.gnome.org/GNOME/gtk/blob/master/docs/CODING-STYLE"
echo "Warnings from this tool can be ignored in favour of the documented coding style,"
echo "or in favour of matching the style of existing surrounding code."
exit ${exit_status}

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 \

View File

@ -7,22 +7,22 @@ else
exit 1
fi
if test -f $ORIGINAL/lib/localcharset.c ; then : ; else
if test -f "${ORIGINAL}/lib/localcharset.c" ; then : ; else
echo "Usage: make-patch.sh /path/to/libcharset" 1>&2
exit 1
fi
VERSION=`grep VERSION= $ORIGINAL/configure.ac | sed s/VERSION=//`
VERSION=$(grep VERSION= "${ORIGINAL}/configure.ac" | sed s/VERSION=//)
echo "# Patch against libcharset version $VERSION" > libcharset-glib.patch
echo "# Patch against libcharset version ${VERSION}" > libcharset-glib.patch
for i in localcharset.c ref-add.sin ref-del.sin ; do
diff -u $ORIGINAL/lib/$i $i >> libcharset-glib.patch
diff -u "${ORIGINAL}/lib/${i}" "${i}" >> libcharset-glib.patch
done
for i in glibc21.m4 codeset.m4 ; do
diff -u $ORIGINAL/m4/$i $i >> libcharset-glib.patch
diff -u "${ORIGINAL}/m4/${i}" "${i}" >> libcharset-glib.patch
done
diff -u $ORIGINAL/include/libcharset.h.in libcharset.h >> libcharset-glib.patch
diff -u $ORIGINAL/include/localcharset.h.in localcharset.h >> libcharset-glib.patch
diff -u "${ORIGINAL}/include/libcharset.h.in" libcharset.h >> libcharset-glib.patch
diff -u "${ORIGINAL}/include/localcharset.h.in" localcharset.h >> libcharset-glib.patch

View File

@ -7,27 +7,27 @@ else
exit 1
fi
if test -f $ORIGINAL/lib/localcharset.c ; then : ; else
if test -f "${ORIGINAL}/lib/localcharset.c" ; then : ; else
echo "Usage: update.sh /path/to/libcharset" 1>&2
exit 1
fi
VERSION=`grep VERSION= $ORIGINAL/configure.ac | sed s/VERSION=//`
VERSION=$(grep VERSION= "${ORIGINAL}/configure.ac" | sed s/VERSION=//)
for i in localcharset.c ref-add.sin ref-del.sin config.charset ; do
cp $ORIGINAL/lib/$i .
cp "${ORIGINAL}/lib/${i}" .
done
for i in libcharset.h localcharset.h ; do
cp $ORIGINAL/include/$i.in ./$i
cp "${ORIGINAL}/include/${i}.in" "./${i}"
done
for i in codeset.m4 glibc21.m4 ; do
cp $ORIGINAL/m4/$i .
cp "${ORIGINAL}/m4/${i}" .
done
patch -p0 < libcharset-glib.patch
echo "dnl From libcharset $VERSION" > ../../aclibcharset.m4
echo "dnl From libcharset ${VERSION}" > ../../aclibcharset.m4

View File

@ -1,9 +1,11 @@
#! /bin/sh
set -e
IN="../update-pcre"
PCRE=$1
if [ "x$PCRE" = x -o "x$PCRE" = x--help -o "x$PCRE" = x-h ]; then
if [ "x$PCRE" = x ] || [ "x$PCRE" = x--help ] || [ "x$PCRE" = x-h ]; then
cat >&2 << EOF
$0 PCRE-DIR
@ -23,8 +25,8 @@ if [ ! -f gregex.h ]; then
exit 1
fi
if [ ! -f $PCRE/Makefile.in -o ! -f $PCRE/pcre_compile.c ]; then
echo "'$PCRE' does not contain a valid PCRE version." 2> /dev/null
if [ ! -f "${PCRE}/Makefile.in" ] || [ ! -f "${PCRE}/pcre_compile.c" ]; then
echo "'${PCRE}' does not contain a valid PCRE version." 2> /dev/null
exit 1
fi
@ -40,7 +42,7 @@ cd pcre
# this could be a problem (e.g. when cross-compiling), so now generate
# the file and then distribuite it with GRegex.
echo "Generating pcre_chartables.c"
cp -R $PCRE tmp-build
cp -R "${PCRE}" tmp-build
cd tmp-build
./configure --enable-utf8 --enable-unicode-properties --disable-cpp > /dev/null
make pcre_chartables.c > /dev/null
@ -55,14 +57,14 @@ rm -R tmp-build
# Compiled C files.
echo "Generating makefiles"
all_files=`awk '/^OBJ = /, /^\\s*$/ \
{ \
sub("^OBJ = ", ""); \
sub(".@OBJEXT@[[:blank:]]*\\\\\\\\", ""); \
sub("\\\\$\\\\(POSIX_OBJ\\\\)", ""); \
print; \
}' \
$PCRE/Makefile.in`
all_files=$(awk '/^OBJ = /, /^\\s*$/ ' \
'{' \
'sub("^OBJ = ", "");' \
'sub(".@OBJEXT@[[:blank:]]*\\\\\\\\", "");' \
'sub("\\\\$\\\\(POSIX_OBJ\\\\)", "");' \
'print;' \
'}' \
"${PCRE}/Makefile.in")
# Headers.
included_files="pcre.h pcre_internal.h ucp.h ucpinternal.h"
@ -71,21 +73,21 @@ included_files="pcre.h pcre_internal.h ucp.h ucpinternal.h"
cat $IN/Makefile.am-1 > Makefile.am
for name in $all_files; do
echo " $name.c \\" >> Makefile.am
if [ $name != pcre_chartables ]; then
if [ "${name}" != pcre_chartables ]; then
# pcre_chartables.c is a generated file.
cp $PCRE/$name.c .
cp "${PCRE}/${name}.c" .
fi
done
for f in $included_files; do
echo " $f \\" >> Makefile.am
cp $PCRE/$f .
cp "${PCRE}/${f}" .
done
cat $IN/Makefile.am-2 >> Makefile.am
echo "Patching PCRE"
# Copy the license.
cp $PCRE/COPYING .
cp "${PCRE}/COPYING" .
# Use glib for memory allocation.
patch > /dev/null < $IN/memory.patch

View File

@ -38,7 +38,7 @@ if ! type gdb >/dev/null 2>&1; then
fi
echo_v "Running gdb on assert-msg-test"
OUT=$($LIBTOOL --mode=execute gdb --batch -x ${srcdir:-.}/assert-msg-test.gdb ./assert-msg-test 2> $error_out) || fail "failed to run gdb"
OUT=$($LIBTOOL --mode=execute gdb --batch -x "${srcdir:-.}/assert-msg-test.gdb" ./assert-msg-test 2> $error_out) || fail "failed to run gdb"
echo_v "Checking if assert message is in __glib_assert_msg"
if ! echo "$OUT" | grep -q '^$1.*"GLib:ERROR:.*assert-msg-test.c:.*:.*main.*: assertion failed: (42 < 0)"'; then

View File

@ -13,25 +13,23 @@ echo_v ()
fi
}
error_out=/dev/null
if [ "$1" = "-v" ]; then
verbose=1
error_out=/dev/stderr
fi
for I in ${srcdir:-.}/collate/*.in; do
for I in "${srcdir:-.}"/collate/*.in; do
echo_v "Sorting $I"
name=`basename $I .in`
./unicode-collate $I > collate.out
name=$(basename "${I}" .in)
./unicode-collate "${I}" > collate.out
if [ $? -eq 2 ]; then
exit 0
fi
diff collate.out ${srcdir:-.}/collate/$name.unicode ||
diff collate.out "${srcdir:-.}/collate/$name.unicode" ||
fail "unexpected error when using g_utf8_collate() on $I"
./unicode-collate --key $I > collate.out
diff collate.out ${srcdir:-.}/collate/$name.unicode ||
./unicode-collate --key "${I}" > collate.out
diff collate.out "${srcdir:-.}/collate/$name.unicode" ||
fail "unexpected error when using g_utf8_collate_key() on $I"
./unicode-collate --file $I > collate.out
diff collate.out ${srcdir:-.}/collate/$name.file ||
./unicode-collate --file "${I}" > collate.out
diff collate.out "${srcdir:-.}/collate/$name.file" ||
fail "unexpected error when using g_utf8_collate_key_for_filename() on $I"
done