build: Fix shellcheck warnings in various old build and test scripts

Most of these scripts can probably just be deleted (see issue #2045),
but for now it was easier to just mechanically fix the shellcheck
warnings in them, rather than think about whether we actually needed the
script.

Fixes done using shellcheck 0.7.0 with default options. I haven’t tested
any of the changes.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
This commit is contained in:
Philip Withnall 2020-02-25 11:47:46 +00:00
parent 00dfb1de0f
commit c5d661b4c4
5 changed files with 40 additions and 40 deletions

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