update shellcheck to v0.10.0

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
This commit is contained in:
Tonis Tiigi
2024-06-19 17:01:16 -07:00
parent f39d56342e
commit b2f8cc9165
5 changed files with 37 additions and 36 deletions

View File

@@ -1,5 +1,6 @@
# syntax = docker/dockerfile:1.5
FROM koalaman/shellcheck-alpine:v0.7.2
# syntax=docker/dockerfile:1.8
# check=error=true
FROM koalaman/shellcheck-alpine:v0.10.0
WORKDIR /src
COPY src .
RUN shellcheck xx-*
RUN --mount=type=bind,src=src shellcheck xx-*

View File

@@ -402,7 +402,7 @@ setup() {
if [ "$exp" = "riscv64" ]; then
exp="riscv"
fi
if ld -V 2>/dev/null | grep $exp >/dev/null; then
if ld -V 2>/dev/null | grep "$exp" >/dev/null; then
ln -s "$(command -v ld)" "/usr/bin/${target}-ld"
linker="/usr/bin/${target}-ld"
XX_CC_PREFER_LINKER=
@@ -538,7 +538,7 @@ EOT
}
check_compiler() {
if [ ! -f /usr/bin/$name ]; then
if [ ! -f "/usr/bin/$name" ]; then
echo >&2 "/usr/bin/$name not found. Make sure package is installed. xx doesn't currently support binaries in custom location"
exit
fi
@@ -560,7 +560,7 @@ downloadLD=
for p in "$@"; do
# ignore if custom --config already set
if [ "${p}" = "--config" ]; then
exec /usr/bin/$name "$@"
exec "/usr/bin/$name" "$@"
fi
if [ "${p}" = "--print-target-triple" ] || [ "${p}" = "-print-target-triple" ]; then
printTarget=1
@@ -667,15 +667,15 @@ if [ -z "${target}" ] && [ ! -f /etc/llvm/xx-default.cfg ] && [ -n "$wrapped" ];
setup
fi
if [ ! -f /usr/bin/$name ]; then
if [ ! -f "/usr/bin/$name" ]; then
echo >&2 "/usr/bin/$name not found. Make sure package is installed. xx doesn't currently support binaries in custom location"
exit
fi
if [ -z "$target" ] && [ -f /etc/llvm/xx-default.cfg ]; then
exec /usr/bin/$name --config /etc/llvm/xx-default.cfg "$@"
exec "/usr/bin/$name" --config /etc/llvm/xx-default.cfg "$@"
elif [ -f "/usr/bin/${target}.cfg" ]; then
exec /usr/bin/$name --config "/usr/bin/${target}.cfg" "$@"
exec "/usr/bin/$name" --config "/usr/bin/${target}.cfg" "$@"
else
exec /usr/bin/$name "$@"
exec "/usr/bin/$name" "$@"
fi

View File

@@ -6,8 +6,8 @@ for l in $(xx-info env); do
export "${l?}"
done
export GOOS=${TARGETOS}
export GOARCH=${TARGETARCH}
export GOOS="${TARGETOS}"
export GOARCH="${TARGETARCH}"
case "$TARGETARCH" in
"amd64")
@@ -67,37 +67,37 @@ ar_set=
pkgconfig_set=
if command -v "$XX_TRIPLE-gcc" >/dev/null 2>/dev/null; then
export CC=$XX_TRIPLE-gcc
export CC="$XX_TRIPLE-gcc"
c_set=1
fi
if command -v "$XX_TRIPLE-g++" >/dev/null 2>/dev/null; then
export CXX=$XX_TRIPLE-g++
export CXX="$XX_TRIPLE-g++"
cxx_set=1
fi
if command -v clang >/dev/null 2>/dev/null; then
triple=$(xx-clang --print-target-triple || true)
if [ -n "$triple" ]; then
export CC=$triple-clang
export CXX=$triple-clang++
export CC="$triple-clang"
export CXX="$triple-clang++"
c_set=1
cxx_set=1
fi
fi
if command -v "$XX_TRIPLE-ar" >/dev/null 2>/dev/null; then
export AR=$XX_TRIPLE-ar
export AR="$XX_TRIPLE-ar"
ar_set=1
fi
if command -v "$XX_TRIPLE-pkg-config" >/dev/null 2>/dev/null; then
export PKG_CONFIG=$XX_TRIPLE-pkg-config
export PKG_CONFIG="$XX_TRIPLE-pkg-config"
pkgconfig_set=1
fi
if [ -z "$GOBIN" ] && [ -n "$GOPATH" ] && [ -n "$GOARCH" ] && [ -n "$GOOS" ]; then
export PATH=${GOPATH}/bin/${GOOS}_${GOARCH}:${PATH}
export PATH="${GOPATH}/bin/${GOOS}_${GOARCH}:${PATH}"
fi
wrap() {

View File

@@ -76,14 +76,14 @@ fi
# break up TARGETPLATFORM if provided
if [ -n "$TARGETPLATFORM" ]; then
os="$(echo $TARGETPLATFORM | cut -d"/" -f1)"
arch="$(echo $TARGETPLATFORM | cut -d"/" -f2)"
os="$(echo "$TARGETPLATFORM" | cut -d"/" -f1)"
arch="$(echo "$TARGETPLATFORM" | cut -d"/" -f2)"
if [ -n "$os" ] && [ -n "$arch" ]; then
TARGETOS="$os"
TARGETARCH="$arch"
case "$arch" in
"amd64")
case "$(echo $TARGETPLATFORM | cut -d"/" -f3)" in
case "$(echo "$TARGETPLATFORM" | cut -d"/" -f3)" in
"v2")
TARGETVARIANT="v2"
;;
@@ -96,7 +96,7 @@ if [ -n "$TARGETPLATFORM" ]; then
esac
;;
"arm")
case "$(echo $TARGETPLATFORM | cut -d"/" -f3)" in
case "$(echo "$TARGETPLATFORM" | cut -d"/" -f3)" in
"v5")
TARGETVARIANT="v5"
;;
@@ -112,7 +112,7 @@ if [ -n "$TARGETPLATFORM" ]; then
esac
;;
"mips"*)
TARGETVARIANT="$(echo $TARGETPLATFORM | cut -d"/" -f3)"
TARGETVARIANT="$(echo "$TARGETPLATFORM" | cut -d"/" -f3)"
;;
esac
fi
@@ -375,31 +375,31 @@ case "$1" in
fi
;;
"arch")
echo $TARGETARCH
echo "$TARGETARCH"
;;
"variant")
echo $TARGETVARIANT
echo "$TARGETVARIANT"
;;
"os")
echo $TARGETOS # TODO:
echo "$TARGETOS" # TODO:
;;
"os-version")
echo "$XX_OS_VERSION"
;;
"march")
echo $XX_MARCH
echo "$XX_MARCH"
;;
"debian-arch")
echo $XX_DEBIAN_ARCH
echo "$XX_DEBIAN_ARCH"
;;
"alpine-arch")
echo $XX_ALPINE_ARCH
echo "$XX_ALPINE_ARCH"
;;
"rhel-arch")
echo $XX_RHEL_ARCH
echo "$XX_RHEL_ARCH"
;;
"pkg-arch")
echo $XX_PKG_ARCH
echo "$XX_PKG_ARCH"
;;
"triple")
echo "$XX_TRIPLE"
@@ -408,7 +408,7 @@ case "$1" in
echo "$XX_VENDOR"
;;
"libc") # this is not abi, just the prefix
echo $XX_LIBC
echo "$XX_LIBC"
;;
"env")
echo "XX_OS=${TARGETOS}"

View File

@@ -360,14 +360,14 @@ else
fi
if [ "$outputf" = "res" ]; then
run cp $resfile $output
run cp "$resfile" "$output"
else
if ! command -v llvm-cvtres 2>/dev/null >/dev/null; then
echo >&2 "llvm-cvtres not installed"
exit 1
fi
run llvm-cvtres -machine:$machine -out:$output $resfile
run llvm-cvtres -machine:$machine "-out:$output" "$resfile"
fi
if [ -f "$tmpfile" ]; then