From 52eb5a521c093601e3fba856599288bad7a5d96f Mon Sep 17 00:00:00 2001 From: David Spickett Date: Wed, 22 Apr 2020 15:24:49 +0100 Subject: Shellcheck fixes round 2 Also update the sanity check script to include .job files. Change-Id: Ibf72d9ff346ff7b012d4e282a6ac8f3b7e73590d --- jenkins.sh | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) (limited to 'jenkins.sh') diff --git a/jenkins.sh b/jenkins.sh index 7ce2e872..4be4bd04 100755 --- a/jenkins.sh +++ b/jenkins.sh @@ -54,6 +54,7 @@ upload_to_logserver() # Copy over the build logs makelog_list=($(read_var ${user_workspace}/build-artifacts.txt 'log_make_[^=]*')) + # shellcheck disable=SC2154 if test x"${canadian}" = x"true"; then makelog_list+=($(read_var ${user_workspace}/canadian-build1-artifacts.txt 'log_make_[^=]*')) makelog_list+=($(read_var ${user_workspace}/canadian-build2-artifacts.txt 'log_make_[^=]*')) @@ -194,9 +195,9 @@ clean_lock_on_exit=false # anything because the build was already performed. something_to_upload=true -orig_parameters="$@" +orig_parameters=( "$@" ) -OPTS="$(getopt -o s:g:w:o:l:rt:b:h -l override:,gcc-branch:,snapshots:,gitrepo:,abedir:,workspace:,options:,logserver:,logname:,languages:,runtests,target:,testcontainer:,bootstrap,help,excludecheck:,norebuild,extraconfig:,send-results-to: -- "$@")" +getopt -o s:g:w:o:l:rt:b:h -l override:,gcc-branch:,snapshots:,gitrepo:,abedir:,workspace:,options:,logserver:,logname:,languages:,runtests,target:,testcontainer:,bootstrap,help,excludecheck:,norebuild,extraconfig:,send-results-to: -Q -- "$@" while test $# -gt 0; do case $1 in --gcc-branch) change="$change gcc=$2"; shift ;; @@ -257,7 +258,7 @@ logopts="${logport:+-o Port=$logport}" trap "exit_handler" EXIT # Check status of logs on $logserver and rebuild if appropriate. -[ x"$logserver" != x"" ] && ssh $logopts $logserver mkdir -p $(dirname $basedir/$dir) +[ x"$logserver" != x"" ] && ssh $logopts $logserver mkdir -p "$(dirname $basedir/$dir)" # Loop and wait until we successfully grabbed the lock. The while condition is, # effectively, "while true;" with a provision to skip if $logserver is not set. @@ -327,11 +328,14 @@ done # Test the config parameters from the Jenkins Build Now page # See if we're supposed to build a source tarball +# (if tarsrc is set true, or user used --tarsrc option) +# shellcheck disable=SC2154 if test x"${tarsrc}" = xtrue -o "$(echo $user_options | grep -c -- --tarsrc)" -gt 0; then tars="--tarsrc" fi # See if we're supposed to build a binary tarball +# shellcheck disable=SC2154 if test x"${tarbin}" = xtrue -o "$(echo $user_options | grep -c -- --tarbin)" -gt 0; then tars="${tars} --tarbin " fi @@ -346,19 +350,24 @@ if test "$(echo $user_options | grep -c -- --release)" -gt 0; then fi # Get the versions of dependant components to use +# shellcheck disable=SC2154 if test x"${gmp_snapshot}" != x"latest" -a x"${gmp_snapshot}" != x; then change="${change} gmp=${gmp_snapshot}" fi +# shellcheck disable=SC2154 if test x"${mpc_snapshot}" != x"latest" -a x"${mpc_snapshot}" != x; then change="${change} mpc=${mpc_snapshot}" fi +# shellcheck disable=SC2154 if test x"${mpfr_snapshot}" != x"latest" -a x"${mpfr_snapshot}" != x; then change="${change} mpfr=${mpfr_snapshot}" fi +# shellcheck disable=SC2154 if test x"${binutils_snapshot}" != x"latest" -a x"${binutils_snapshot}" != x; then change="${change} binutils=${binutils_snapshot}" fi +# shellcheck disable=SC2154 if test x"${linux_snapshot}" != x"latest" -a x"${linux_snapshot}" != x; then change="${change} linux=${linux_snapshot}" fi @@ -367,6 +376,7 @@ if test x"${target}" != x"native" -a x"${target}" != x; then platform="--target ${target}" fi +# shellcheck disable=SC2154 if test x"${libc}" != x; then # ELF based targets are bare metal only case ${target} in @@ -392,12 +402,13 @@ pushd ${user_workspace}/_build # default of dash as some configure scripts go into an infinite loop with # dash. Not good... export CONFIG_SHELL="/bin/bash" +# shellcheck disable=SC2154 if test x"${debug}" = x"true"; then export CONFIG_SHELL="/bin/bash -x" fi # Print some information about the build machine -echo Running on $(hostname) +echo Running on "$(hostname)" uname -a lsb_release -a lscpu @@ -497,7 +508,7 @@ else date=${release} fi -echo "Build parameters: $orig_parameters" +echo "Build parameters: ${orig_parameters[*]}" # Canadian Crosses are a win32 hosted cross toolchain built on a Linux # machine. -- cgit v1.2.3