Skip to content

Clean up scripts with shellcheck #77376

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 11 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -61,5 +61,5 @@ cd $PACKAGE_ROOT/develop/lib
ln -s ../../lib/libgcc_s.so libgcc_s.so

# Clean up
rm -rf "$BUILDTOOLS" "$HAIKU" $OUTPUT/Jamfile $OUTPUT/attributes $OUTPUT/build \
$OUTPUT/build_packages $OUTPUT/download $OUTPUT/objects
rm -rf "$BUILDTOOLS" "$HAIKU" "$OUTPUT"/Jamfile "$OUTPUT"/attributes "$OUTPUT"/build \
"$OUTPUT"/build_packages "$OUTPUT"/download "$OUTPUT"/objects
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ curl -Lf $url | tar xzf -
cd crosstool-ng-crosstool-ng-1.24.0
./bootstrap
./configure --prefix=/usr/local
make -j"$(nproc)"
make -j$(nproc)
make install
cd ..
rm -rf crosstool-ng-crosstool-ng-1.24.0
2 changes: 1 addition & 1 deletion src/ci/docker/scripts/android-start-emulator.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ export SHELL=/bin/bash
# classic engine the emulator starts with the current date and the tests run
# fine. If another image is used, this need to be evaluated again.
nohup nohup emulator @armeabi-v7a-18 \
-engine classic -no-window -partition-size 2047 0<&- 2>&1 /dev/null &
-engine classic -no-window -partition-size 2047 0<&- 2>&1 > /dev/null &

exec "$@"
2 changes: 1 addition & 1 deletion src/ci/init_repo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ ci_dir=$(cd "$(dirname "$0")" && pwd)
REPO_DIR="$1"
CACHE_DIR="$2"

if [ ! -d "$REPO_DIR" ] || [ ! -d "$REPO_DIR/.git" ]; then
if ! { [ -d "$REPO_DIR" ] && [ -d "$REPO_DIR/.git" ] }; then
echo "Error: $REPO_DIR does not exist or is not a git repo"
exit 1
fi
Expand Down
20 changes: 10 additions & 10 deletions src/ci/shared.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,18 @@ function retry {
local n=1
local max=5
while true; do
if "$@"; then
break
else
if [[ $n -lt $max ]]; then
sleep $n # don't retry immediately
((n++))
echo "Command failed. Attempt $n/$max:"
if "$@"; then
break
else
echo "The command has failed after $n attempts."
return 1
if [[ $n -lt $max ]]; then
sleep $n # don't retry immediately
((n++))
echo "Command failed. Attempt $n/$max:"
else
echo "The command has failed after $n attempts."
return 1
fi
fi
fi
done
}

Expand Down
2 changes: 1 addition & 1 deletion src/test/run-make/git_clone_sha1.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash -x
#!/usr/bin/env bash

# Usage: $0 project_name url sha1
# Get the crate with the specified sha1.
Expand Down
4 changes: 2 additions & 2 deletions src/test/run-make/thumb-none-qemu/script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ CRATE=example
env | sort
mkdir -p "$WORK_DIR"
pushd "$WORK_DIR"
rm -rf "$CRATE" || echo OK
cp -a "$HERE"/example .
rm -rf "$CRATE"
cp -a "$HERE"/"$CRATE" .
pushd "$CRATE"
# HACK(eddyb) sets `RUSTC_BOOTSTRAP=1` so Cargo can accept nightly features.
# These come from the top-level Rust workspace, that this crate is not a
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ function build {
mkdir -p "$WORK_DIR"
pushd "$WORK_DIR"
rm -rf "$CRATE"
cp -a "$TEST_DIR"/enclave .
cp -a "$TEST_DIR"/"$CRATE" .
pushd "$CRATE"
echo "${WORK_DIR}"
# HACK(eddyb) sets `RUSTC_BOOTSTRAP=1` so Cargo can accept nightly features.
Expand Down
4 changes: 2 additions & 2 deletions src/tools/clippy/.github/driver.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ diff normalized.stderr tests/ui/cstring.stderr


# make sure "clippy-driver --rustc --arg" and "rustc --arg" behave the same
SYSROOT=$(rustc --print sysroot)
diff <(LD_LIBRARY_PATH=${SYSROOT}/lib ./target/debug/clippy-driver --rustc --version --verbose) <(rustc --version --verbose)
SYSROOT="$(rustc --print sysroot)"
diff <(LD_LIBRARY_PATH="${SYSROOT}"/lib ./target/debug/clippy-driver --rustc --version --verbose) <(rustc --version --verbose)


echo "fn main() {}" > target/driver_test.rs
Expand Down