Merge remote-tracking branch 'tor-github/pr/1510'

This commit is contained in:
teor 2019-11-06 21:29:18 +10:00
commit 89f52f36e0
No known key found for this signature in database
GPG Key ID: 10FEAA0E7075672A
8 changed files with 33 additions and 23 deletions

3
changes/bug32402 Normal file
View File

@ -0,0 +1,3 @@
o Minor bugfixes (shellcheck):
- Start checking most scripts for shellcheck errors again.
Fixes bug 32402; bugfix on 0.4.2.1-alpha.

View File

@ -0,0 +1,3 @@
o Minor bugfixes (shellcheck):
- Fix minor shellcheck errors in the git-*.sh scripts.
Fixes bug 32402; bugfix on 0.4.2.1-alpha.

View File

@ -1,6 +1,6 @@
#!/usr/bin/env bash #!/usr/bin/env bash
SCRIPT_NAME=`basename $0` SCRIPT_NAME=$(basename "$0")
function usage() function usage()
{ {

View File

@ -1,6 +1,6 @@
#!/usr/bin/env bash #!/usr/bin/env bash
SCRIPT_NAME=`basename $0` SCRIPT_NAME=$(basename "$0")
function usage() function usage()
{ {

View File

@ -1,6 +1,6 @@
#!/usr/bin/env bash #!/usr/bin/env bash
SCRIPT_NAME=`basename $0` SCRIPT_NAME=$(basename "$0")
function usage() function usage()
{ {
@ -257,7 +257,7 @@ if [ "$PUSH_SAME" -eq 0 ]; then
fi fi
done done
if [ "$SKIP_UPSTREAM" ]; then if [ "$SKIP_UPSTREAM" ]; then
printf "Skipping unchanged: %s matching remote: %s\n" \ printf "Skipping unchanged: %s matching remote: %s\\n" \
"$b" "$SKIP_UPSTREAM" "$b" "$SKIP_UPSTREAM"
else else
if [ "$NEW_PUSH_BRANCHES" ]; then if [ "$NEW_PUSH_BRANCHES" ]; then
@ -287,32 +287,38 @@ if [ "$PUSH_DELAY" -le 0 ]; then
$GIT_PUSH "$@" "$UPSTREAM_REMOTE" $PUSH_BRANCHES $GIT_PUSH "$@" "$UPSTREAM_REMOTE" $PUSH_BRANCHES
else else
# Push the branches in optimal CI order, with a delay between each push # Push the branches in optimal CI order, with a delay between each push
PUSH_BRANCHES=$(echo "$PUSH_BRANCHES" | tr " " "\n" | sort -V) PUSH_BRANCHES=$(echo "$PUSH_BRANCHES" | tr " " "\\n" | sort -V)
MASTER_BRANCH=$(echo "$PUSH_BRANCHES" | tr " " "\n" | grep master) \ MASTER_BRANCH=$(echo "$PUSH_BRANCHES" | tr " " "\\n" | grep master) \
|| true # Skipped master branch || true # Skipped master branch
if [ -z "$TEST_BRANCH_PREFIX" ]; then if [ -z "$TEST_BRANCH_PREFIX" ]; then
MAINT_BRANCHES=$(echo "$PUSH_BRANCHES" | tr " " "\n" | grep maint) \ MAINT_BRANCHES=$(echo "$PUSH_BRANCHES" | tr " " "\\n" | grep maint) \
|| true # Skipped all maint branches || true # Skipped all maint branches
RELEASE_BRANCHES=$(echo "$PUSH_BRANCHES" | tr " " "\n" | grep release | \ RELEASE_BRANCHES=$(echo "$PUSH_BRANCHES" | tr " " "\\n" | grep release | \
tr "\n" " ") || true # Skipped all release branches tr "\\n" " ") || true # Skipped all release branches
printf \
"Pushing with %ss delays, so CI runs in this order:\\n%s\\n%s\\n%s\\n" \
"$PUSH_DELAY" "$MASTER_BRANCH" "$MAINT_BRANCHES" "$RELEASE_BRANCHES"
else else
# Actually test branches based on maint branches # Actually test branches based on maint branches
MAINT_BRANCHES=$(echo "$PUSH_BRANCHES" | tr " " "\n" | grep -v master) \ MAINT_BRANCHES=$(echo "$PUSH_BRANCHES" | tr " " "\\n" | grep -v master) \
|| true # Skipped all maint test branches || true # Skipped all maint test branches
printf "Pushing with %ss delays, so CI runs in this order:\\n%s\\n%s\\n" \
"$PUSH_DELAY" "$MASTER_BRANCH" "$MAINT_BRANCHES"
# No release branches # No release branches
RELEASE_BRANCHES= RELEASE_BRANCHES=
fi fi
if [ "$MASTER_BRANCH" ] || [ "$MAINT_BRANCHES" ] \ if [ "$MASTER_BRANCH" ] || [ "$MAINT_BRANCHES" ] \
|| [ "$RELEASE_BRANCHES" ]; then || [ "$RELEASE_BRANCHES" ]; then
printf "Pushing with %ss delays, so CI runs in this order:\n" "$PUSH_DELAY" printf "Pushing with %ss delays, so CI runs in this order:\\n" \
"$PUSH_DELAY"
if [ "$MASTER_BRANCH" ]; then if [ "$MASTER_BRANCH" ]; then
printf "%s\n" "$MASTER_BRANCH" printf "%s\\n" "$MASTER_BRANCH"
fi fi
if [ "$MAINT_BRANCHES" ]; then if [ "$MAINT_BRANCHES" ]; then
printf "%s\n" "$MAINT_BRANCHES" printf "%s\\n" "$MAINT_BRANCHES"
fi fi
if [ "$RELEASE_BRANCHES" ]; then if [ "$RELEASE_BRANCHES" ]; then
printf "%s\n" "$RELEASE_BRANCHES" printf "%s\\n" "$RELEASE_BRANCHES"
fi fi
fi fi
# shellcheck disable=SC2086 # shellcheck disable=SC2086

View File

@ -1,6 +1,6 @@
#!/usr/bin/env bash #!/usr/bin/env bash
SCRIPT_NAME=`basename $0` SCRIPT_NAME=$(basename "$0")
function usage() function usage()
{ {
@ -295,8 +295,10 @@ function add_remote
printf " %s Adding remote %s at %s..." "$MARKER" "$1" "$2" printf " %s Adding remote %s at %s..." "$MARKER" "$1" "$2"
local check_cmd="git remote get-url '$1'" local check_cmd="git remote get-url '$1'"
msg=$( eval "$check_cmd" 2>&1 ) msg=$( eval "$check_cmd" 2>&1 )
ret=$?
# We don't want a remote, so we invert the exit status # We don't want a remote, so we invert the exit status
if validate_ret_skip $[ ! $? ] "Remote already exists for $1 at $msg."; then if validate_ret_skip $(( ! ret )) \
"Remote already exists for $1 at $msg."; then
return return
fi fi
if [ $DRY_RUN -eq 0 ]; then if [ $DRY_RUN -eq 0 ]; then

View File

@ -35,12 +35,8 @@ if [ ! -d "$TOPLEVEL/src" ]; then
fi fi
# Check *.sh scripts, but ignore the ones that we can't fix # Check *.sh scripts, but ignore the ones that we can't fix
find "$TOPLEVEL" \ find "$TOPLEVEL/contrib" "$TOPLEVEL/doc" "$TOPLEVEL/scripts" "$TOPLEVEL/src" \
-name "*.sh" \ -name "*.sh" \
-path "$TOPLEVEL/contrib/*" \
-path "$TOPLEVEL/doc/*" \
-path "$TOPLEVEL/scripts/*" \
-path "$TOPLEVEL/src/*" \
-not -path "$TOPLEVEL/src/ext/*" \ -not -path "$TOPLEVEL/src/ext/*" \
-not -path "$TOPLEVEL/src/rust/registry/*" \ -not -path "$TOPLEVEL/src/rust/registry/*" \
-exec shellcheck {} + -exec shellcheck {} +

View File

@ -88,7 +88,7 @@ TOR_BINARY="$(abspath "$TOR_BINARY")"
echo "TOR BINARY IS ${TOR_BINARY}" echo "TOR BINARY IS ${TOR_BINARY}"
TOR_MODULES_DISABLED="$("$TOR_BINARY" --list-modules | grep ": no" \ TOR_MODULES_DISABLED="$("$TOR_BINARY" --list-modules | grep ": no" \
| cut -d ":" -f1 | sort | tr "\n" "_")" | cut -d ":" -f1 | sort | tr "\\n" "_")"
# Remove the last underscore, if there is one # Remove the last underscore, if there is one
TOR_MODULES_DISABLED=${TOR_MODULES_DISABLED%_} TOR_MODULES_DISABLED=${TOR_MODULES_DISABLED%_}
@ -239,7 +239,7 @@ for dir in "${EXAMPLEDIR}"/*; do
> "${DATA_DIR}/output.${testname}" \ > "${DATA_DIR}/output.${testname}" \
&& die "FAIL: $ERROR: Tor did not report an error." && die "FAIL: $ERROR: Tor did not report an error."
expect_err="$(cat $ERROR)" expect_err="$(cat "$ERROR")"
if grep "${expect_err}" "${DATA_DIR}/output.${testname}" >/dev/null; then if grep "${expect_err}" "${DATA_DIR}/output.${testname}" >/dev/null; then
echo "OK" echo "OK"
else else