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 # syntax=docker/dockerfile:1.8
FROM koalaman/shellcheck-alpine:v0.7.2 # check=error=true
FROM koalaman/shellcheck-alpine:v0.10.0
WORKDIR /src WORKDIR /src
COPY src . RUN --mount=type=bind,src=src shellcheck xx-*
RUN shellcheck xx-*

View File

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

View File

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

View File

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

View File

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