Skip to content

Commit

Permalink
Revert "shellcheck autofix"
Browse files Browse the repository at this point in the history
This reverts commit dba8667.
  • Loading branch information
straight-shoota committed Oct 31, 2024
1 parent fc88d57 commit 3e81104
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 28 deletions.
8 changes: 4 additions & 4 deletions bin/ci
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ prepare_build() {

# Install a recent bash version for nix-shell.
# macos ships with an ancient one.
if [ $(uname) = "Darwin" ]; then
if [ `uname` = "Darwin" ]; then
on_nix_shell "brew install bash"
fi
# initialize nix environment
Expand All @@ -172,7 +172,7 @@ prepare_build() {

verify_version() {
# If building a tag, check it matches with file
FILE_VERSION=$(cat ./src/VERSION)
FILE_VERSION=`cat ./src/VERSION`

if [ "$FILE_VERSION" != "$CURRENT_TAG" ]
then
Expand Down Expand Up @@ -206,7 +206,7 @@ with_build_env() {
on_linux docker run \
--rm -t \
-u $(id -u) \
-v "$PWD":/mnt \
-v $PWD:/mnt \
-v /etc/passwd:/etc/passwd \
-v /etc/group:/etc/group \
-w /mnt \
Expand All @@ -222,7 +222,7 @@ with_build_env() {
CRYSTAL_CACHE_DIR="/tmp/crystal" \
/bin/sh -c "'$command'"

on_nix_shell nix-shell --pure "$CI_NIX_SHELL_ARGS" --run "'TZ=$TZ $command'"
on_nix_shell nix-shell --pure $CI_NIX_SHELL_ARGS --run "'TZ=$TZ $command'"

on_github echo "::endgroup::"
}
Expand Down
2 changes: 1 addition & 1 deletion bin/crystal
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ fi
# CRYSTAL_PATH has all symlinks resolved. In order to avoid issues with duplicate file
# paths when the working directory is a symlink, we cd into the current directory
# with symlinks resolved as well (see https://github.com/crystal-lang/crystal/issues/12969).
cd "$(realpath "$(pwd)")" || exit
cd "$(realpath "$(pwd)")"

case "$(uname -s)" in
CYGWIN*|MSYS_NT*|MINGW32_NT*|MINGW64_NT*)
Expand Down
4 changes: 2 additions & 2 deletions scripts/release-update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@ sed -i -E "s|crystal: \"[0-9.]+\"|crystal: \"$CRYSTAL_VERSION\"|g" .github/workf

# Edit shell.nix latestCrystalBinary using nix-prefetch-url --unpack <url>
darwin_url="https://github.com/crystal-lang/crystal/releases/download/$CRYSTAL_VERSION/crystal-$CRYSTAL_VERSION-1-darwin-universal.tar.gz"
darwin_sha=$(nix-prefetch-url --unpack "$darwin_url")
darwin_sha=$(nix-prefetch-url --unpack $darwin_url)

sed -i -E "s|https://github.com/crystal-lang/crystal/releases/download/[0-9.]+/crystal-[0-9.]+-[0-9]-darwin-universal.tar.gz|$darwin_url|" shell.nix
sed -i -E "/darwin-universal\.tar\.gz/ {n;s|sha256:[^\"]+|sha256:$darwin_sha|}" shell.nix

linux_url="https://github.com/crystal-lang/crystal/releases/download/$CRYSTAL_VERSION/crystal-$CRYSTAL_VERSION-1-linux-x86_64.tar.gz"
linux_sha=$(nix-prefetch-url --unpack "$linux_url")
linux_sha=$(nix-prefetch-url --unpack $linux_url)

sed -i -E "s|https://github.com/crystal-lang/crystal/releases/download/[0-9.]+/crystal-[0-9.]+-[0-9]-linux-x86_64.tar.gz|$linux_url|" shell.nix
sed -i -E "/linux-x86_64\.tar\.gz/ {n;s|sha256:[^\"]+|sha256:$linux_sha|}" shell.nix
8 changes: 4 additions & 4 deletions scripts/update-changelog.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ branch="changelog/$VERSION"
current_changelog="CHANGELOG.$VERSION.md"

echo "Generating $current_changelog..."
scripts/github-changelog.cr "$VERSION" > "$current_changelog"
scripts/github-changelog.cr $VERSION > $current_changelog

echo "Switching to branch $branch"
git switch "$branch" 2>/dev/null || git switch -c "$branch";
git switch $branch 2>/dev/null || git switch -c $branch;

# Write release version into src/VERSION
echo "${VERSION}" > src/VERSION
Expand All @@ -49,7 +49,7 @@ sed -i -E "s/version: .*/version: ${VERSION}/" shard.yml
git add shard.yml

# Write release date into src/SOURCE_DATE_EPOCH
release_date=$(head -n1 "$current_changelog" | grep -o -P '(?<=\()[^)]+')
release_date=$(head -n1 $current_changelog | grep -o -P '(?<=\()[^)]+')
echo "$(date --utc --date="${release_date}" +%s)" > src/SOURCE_DATE_EPOCH
git add src/SOURCE_DATE_EPOCH

Expand All @@ -70,7 +70,7 @@ else

git add CHANGELOG.md
git commit -m "Add changelog for $VERSION"
git push -u upstream "$branch"
git push -u upstream $branch

gh pr create --draft --base "$base_branch" \
--body "Preview: https://github.com/crystal-lang/crystal/blob/$branch/CHANGELOG.md" \
Expand Down
4 changes: 2 additions & 2 deletions scripts/update-distribution-scripts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@ branch="${2:-"ci/update-distribution-scripts"}"
git switch -C "$branch" master

old_reference=$(sed -n "/distribution-scripts-version:/{n;n;n;p}" .circleci/config.yml | grep -o -P '(?<=default: ")[^"]+')
echo "$old_reference".."$reference"
echo $old_reference..$reference

sed -i -E "/distribution-scripts-version:/{n;n;n;s/default: \".*\"/default: \"$reference\"/}" .circleci/config.yml

git add .circleci/config.yml

message="Updates \`distribution-scripts\` dependency to https://github.com/crystal-lang/distribution-scripts/commit/$reference"
log=$($GIT_DS log "$old_reference".."$reference" --format="%s" | sed "s/.*(/crystal-lang\/distribution-scripts/;s/^/* /;s/)$//")
log=$($GIT_DS log $old_reference..$reference --format="%s" | sed "s/.*(/crystal-lang\/distribution-scripts/;s/^/* /;s/)$//")
message=$(printf "%s\n\nThis includes the following changes:\n\n%s" "$message" "$log")

git commit -m "Update distribution-scripts" -m "$message"
Expand Down
14 changes: 7 additions & 7 deletions spec/debug/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ BUILD_DIR=$SCRIPT_ROOT/../../.build
crystal=${CRYSTAL_SPEC_COMPILER_BIN:-$SCRIPT_ROOT/../../bin/crystal}
debugger=${1:-lldb}
driver=$BUILD_DIR/debug_driver
mkdir -p "$BUILD_DIR"
"$crystal" build "$SCRIPT_ROOT"/driver.cr -o "$driver"
mkdir -p $BUILD_DIR
"$crystal" build $SCRIPT_ROOT/driver.cr -o $driver

$driver "$SCRIPT_ROOT"/top_level.cr "$debugger"
$driver "$SCRIPT_ROOT"/strings.cr "$debugger"
$driver "$SCRIPT_ROOT"/arrays.cr "$debugger"
$driver "$SCRIPT_ROOT"/blocks.cr "$debugger"
$driver "$SCRIPT_ROOT"/large_enums.cr "$debugger"
$driver $SCRIPT_ROOT/top_level.cr $debugger
$driver $SCRIPT_ROOT/strings.cr $debugger
$driver $SCRIPT_ROOT/arrays.cr $debugger
$driver $SCRIPT_ROOT/blocks.cr $debugger
$driver $SCRIPT_ROOT/large_enums.cr $debugger
2 changes: 1 addition & 1 deletion spec/generate_wasm32_spec.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ set +x

WORK_DIR=$(mktemp -d)
function cleanup {
rm -rf "$WORK_DIR"
rm -rf $WORK_DIR
}
trap cleanup EXIT

Expand Down
14 changes: 7 additions & 7 deletions spec/llvm-ir/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ SCRIPT_PATH="$(realpath "$0")"
SCRIPT_ROOT="$(dirname "$SCRIPT_PATH")"

BUILD_DIR=$SCRIPT_ROOT/../../.build
LLVM_CONFIG="$(basename $("$SCRIPT_ROOT"/../../src/llvm/ext/find-llvm-config))"
LLVM_CONFIG="$(basename $($SCRIPT_ROOT/../../src/llvm/ext/find-llvm-config))"
FILE_CHECK=FileCheck-"${LLVM_CONFIG#llvm-config-}"
crystal=${CRYSTAL_SPEC_COMPILER_BIN:-$SCRIPT_ROOT/../../bin/crystal}

mkdir -p "$BUILD_DIR"
mkdir -p $BUILD_DIR

function test() {
echo "test: $@"
Expand All @@ -26,14 +26,14 @@ function test() {
# $BUILD_DIR/test-ir is never used
# pushd $BUILD_DIR + $output_ll is a workaround due to the fact that we can't control
# the filename generated by --emit=llvm-ir
"$crystal" build --single-module --no-color --emit=llvm-ir "$2" -o "$BUILD_DIR"/test-ir "$input_cr"
$FILE_CHECK "$input_cr" --input-file "$output_ll" "$check_prefix"
"$crystal" build --single-module --no-color --emit=llvm-ir $2 -o $BUILD_DIR/test-ir $input_cr
$FILE_CHECK $input_cr --input-file $output_ll $check_prefix

rm "$BUILD_DIR"/test-ir.o
rm "$output_ll"
rm $BUILD_DIR/test-ir.o
rm $output_ll
}

pushd "$BUILD_DIR" >/dev/null
pushd $BUILD_DIR >/dev/null

test argless-initialize-debug-loc.cr "--cross-compile --target x86_64-unknown-linux-gnu --prelude=empty"
test proc-call-debug-loc.cr "--cross-compile --target x86_64-unknown-linux-gnu --prelude=empty"
Expand Down

0 comments on commit 3e81104

Please sign in to comment.