1

shellcheck

This commit is contained in:
Motiejus Jakštys 2022-10-13 12:48:43 +03:00
parent 7383c4984e
commit 557b726d62
3 changed files with 33 additions and 33 deletions

View File

@ -6,7 +6,7 @@ cd "$(git rev-parse --show-toplevel)"
mapfile -t files < \ mapfile -t files < \
<(git ls-files) <(git ls-files)
mapfile -t scripts < \ mapfile -t scripts < \
<(awk '/#!\/usr\/bin\/env/&&FNR==1{print FILENAME}' "${files[@]}") <(awk '/#!(\/usr\/bin\/env bash|\/bin\/sh)/&&FNR==1{print FILENAME}' "${files[@]}")
mapfile -t buildfiles < \ mapfile -t buildfiles < \
<(find . \( -name 'WORKSPACE' -o -name 'BUILD' -o -name '*.bzl' \)) <(find . \( -name 'WORKSPACE' -o -name 'BUILD' -o -name '*.bzl' \))

View File

@ -1,25 +1,25 @@
#!/bin/bash #!/usr/bin/env bash
set -xeuo pipefail set -xeuo pipefail
zig_version=$(awk -F'"' '/^ZIG_VERSION=/{print $2}' build) zig_version=$(awk -F'"' '/^ZIG_VERSION=/{print $2}' build)
#./build -j$(nproc) x86_64-linux-musl baseline ./build -j"$(nproc)" x86_64-linux-musl baseline
#./build -j$(nproc) x86_64-macos-none baseline ./build -j"$(nproc)" x86_64-macos-none baseline
#./build -j$(nproc) aarch64-linux-musl baseline ./build -j"$(nproc)" aarch64-linux-musl baseline
#./build -j$(nproc) aarch64-macos-none apple_a14 ./build -j"$(nproc)" aarch64-macos-none apple_a14
#./build -j$(nproc) x86_64-windows-gnu baseline ./build -j"$(nproc)" x86_64-windows-gnu baseline
rm -fr zig-linux-x86_64-${zig_version} rm -fr zig-linux-x86_64-"${zig_version}"
rm -fr zig-macos-x86_64-${zig_version} rm -fr zig-macos-x86_64-"${zig_version}"
rm -fr zig-linux-aarch64-${zig_version} rm -fr zig-linux-aarch64-"${zig_version}"
rm -fr zig-macos-aarch64-${zig_version} rm -fr zig-macos-aarch64-"${zig_version}"
rm -fr zig-windows-x86_64-${zig_version} rm -fr zig-windows-x86_64-"${zig_version}"
cp -r out/zig-x86_64-linux-musl-baseline zig-linux-x86_64-${zig_version} cp -r out/zig-x86_64-linux-musl-baseline zig-linux-x86_64-"${zig_version}"
cp -r out/zig-x86_64-macos-none-baseline zig-macos-x86_64-${zig_version} cp -r out/zig-x86_64-macos-none-baseline zig-macos-x86_64-"${zig_version}"
cp -r out/zig-aarch64-linux-musl-baseline zig-linux-aarch64-${zig_version} cp -r out/zig-aarch64-linux-musl-baseline zig-linux-aarch64-"${zig_version}"
cp -r out/zig-aarch64-macos-none-apple_a14 zig-macos-aarch64-${zig_version} cp -r out/zig-aarch64-macos-none-apple_a14 zig-macos-aarch64-"${zig_version}"
cp -r out/zig-x86_64-windows-gnu-baseline zig-windows-x86_64-${zig_version} cp -r out/zig-x86_64-windows-gnu-baseline zig-windows-x86_64-"${zig_version}"
for os_arch in linux-{x86_64,aarch64} macos-{x86_64,aarch64} windows-x86_64; do for os_arch in linux-{x86_64,aarch64} macos-{x86_64,aarch64} windows-x86_64; do
if [[ $os_arch == windows-x86_64 ]]; then if [[ $os_arch == windows-x86_64 ]]; then
@ -27,30 +27,30 @@ for os_arch in linux-{x86_64,aarch64} macos-{x86_64,aarch64} windows-x86_64; do
else else
zig=zig zig=zig
fi fi
mv zig-${os_arch}-${zig_version}/{bin/${zig},} mv zig-${os_arch}-"${zig_version}"/{bin/${zig},}
rmdir zig-${os_arch}-${zig_version}/bin rmdir zig-${os_arch}-"${zig_version}"/bin
# copy some clarifying files for future readers # copy some clarifying files for future readers
mkdir zig-${os_arch}-${zig_version}/patches mkdir zig-${os_arch}-"${zig_version}"/patches
cp README-patched.md zig-${os_arch}-${zig_version}/patches/README.md cp README-patched.md zig-${os_arch}-"${zig_version}"/patches/README.md
cp 13051.patch "$0" zig-${os_arch}-${zig_version}/patches/ cp 13051.patch "$0" zig-${os_arch}-"${zig_version}"/patches/
done done
# x86_64 should have libs in lib/, rather than in lib/zig/. # x86_64 should have libs in lib/, rather than in lib/zig/.
for os in linux macos windows; do for os in linux macos windows; do
mv zig-${os}-x86_64-${zig_version}/{lib,lib2} mv zig-${os}-x86_64-"${zig_version}"/{lib,lib2}
mv zig-${os}-x86_64-${zig_version}/{lib2/zig,lib} mv zig-${os}-x86_64-"${zig_version}"/{lib2/zig,lib}
rmdir zig-${os}-x86_64-${zig_version}/lib2 rmdir zig-${os}-x86_64-"${zig_version}"/lib2
done done
tar cJf zig-linux-x86_64-${zig_version}.tar.xz zig-linux-x86_64-${zig_version}/ & tar cJf zig-linux-x86_64-"${zig_version}".tar.xz zig-linux-x86_64-"${zig_version}"/ &
tar cJf zig-macos-x86_64-${zig_version}.tar.xz zig-macos-x86_64-${zig_version}/ & tar cJf zig-macos-x86_64-"${zig_version}".tar.xz zig-macos-x86_64-"${zig_version}"/ &
tar cJf zig-linux-aarch64-${zig_version}.tar.xz zig-linux-aarch64-${zig_version}/ & tar cJf zig-linux-aarch64-"${zig_version}".tar.xz zig-linux-aarch64-"${zig_version}"/ &
tar cJf zig-macos-aarch64-${zig_version}.tar.xz zig-macos-aarch64-${zig_version}/ & tar cJf zig-macos-aarch64-"${zig_version}".tar.xz zig-macos-aarch64-"${zig_version}"/ &
# 7z is the quickest, so blocking on it first. Then wait for tars to complete. # 7z is the quickest, so blocking on it first. Then wait for tars to complete.
7z a zig-windows-x86_64-${zig_version}.zip zig-windows-x86_64-${zig_version}/ 7z a zig-windows-x86_64-"${zig_version}".zip zig-windows-x86_64-"${zig_version}"/
wait %1 %2 %3 %4 wait %1 %2 %3 %4
sha256sum *.tar.xz *.zip sha256sum ./*.tar.xz ./*.zip
ls -l *.tar.xz *.zip ls -l ./*.tar.xz ./*.zip

View File

@ -7,7 +7,7 @@ want=$WANT
binary=$BINARY binary=$BINARY
got=$($binary) got=$($binary)
if [[ "$got" != "$want" ]]; then if [ "$got" != "$want" ]; then
echo wanted: echo wanted:
echo \ \ "$want" echo \ \ "$want"
echo got: echo got: