From a57a60d92c9197bd23c1d4efbc89476a1872a48d Mon Sep 17 00:00:00 2001 From: Michael Jeanson Date: Mon, 17 Oct 2016 15:21:17 -0400 Subject: [PATCH] jjb: build scripts cleanups Signed-off-by: Michael Jeanson --- scripts/babeltrace/build.sh | 9 +++++-- scripts/common/coverity.sh | 44 +++++++++++++++++--------------- scripts/common/scan-build.sh | 2 +- scripts/liburcu/build.sh | 13 +++++++--- scripts/lttng-analyses/build.sh | 2 +- scripts/lttng-analyses/pylint.sh | 2 +- scripts/lttng-ust/build.sh | 15 +++++++---- 7 files changed, 52 insertions(+), 35 deletions(-) diff --git a/scripts/babeltrace/build.sh b/scripts/babeltrace/build.sh index 4dc939d..18532cb 100755 --- a/scripts/babeltrace/build.sh +++ b/scripts/babeltrace/build.sh @@ -16,6 +16,11 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +# Required parameters +arch=${arch:-} +conf=${conf:-} +build=${build:-} + SRCDIR="$WORKSPACE/src/babeltrace" TMPDIR="$WORKSPACE/tmp" @@ -109,7 +114,7 @@ case "$build" in dist) echo "Distribution out of tree build" - BUILD_PATH="`mktemp -d`" + BUILD_PATH="$(mktemp -d)" # Initial configure and generate tarball MAKE=$MAKE BISON="$BISON" YACC="$YACC" "$SRCDIR/configure" @@ -138,7 +143,7 @@ case "$build" in esac # BUILD! -$MAKE -j `$NPROC` V=1 +$MAKE -j "$($NPROC)" V=1 $MAKE install # Run tests diff --git a/scripts/common/coverity.sh b/scripts/common/coverity.sh index 89e0a2c..7b2e946 100755 --- a/scripts/common/coverity.sh +++ b/scripts/common/coverity.sh @@ -1,4 +1,4 @@ -#!/bin/sh -xue +#!/bin/bash -exu # # Copyright (C) 2015 - Michael Jeanson # Jonathan Rajotte-Julien @@ -100,17 +100,17 @@ fi # Verify upload is permitted set +x -AUTH_RES=`curl -s --form project="$COVERITY_SCAN_PROJECT_NAME" --form token="$COVERITY_SCAN_TOKEN" $SCAN_URL/api/upload_permitted` +AUTH_RES=$(curl -s --form project="$COVERITY_SCAN_PROJECT_NAME" --form token="$COVERITY_SCAN_TOKEN" $SCAN_URL/api/upload_permitted) set -x if [ "$AUTH_RES" = "Access denied" ]; then echo -e "\033[33;1mCoverity Scan API access denied. Check COVERITY_SCAN_PROJECT_NAME and COVERITY_SCAN_TOKEN.\033[0m" exit 1 else - AUTH=`echo $AUTH_RES | jq .upload_permitted` + AUTH=$(echo "$AUTH_RES" | jq .upload_permitted) if [ "$AUTH" = "true" ]; then echo -e "\033[33;1mCoverity Scan analysis authorized per quota.\033[0m" else - WHEN=`echo $AUTH_RES | jq .next_upload_permitted_at` + WHEN=$(echo "$AUTH_RES" | jq .next_upload_permitted_at) echo -e "\033[33;1mCoverity Scan analysis NOT authorized until $WHEN.\033[0m" exit 1 fi @@ -118,28 +118,28 @@ fi # Download Coverity Scan Analysis Tool -if [ ! -d $TOOL_BASE ]; then - if [ ! -e $TOOL_ARCHIVE ]; then +if [ ! -d "$TOOL_BASE" ]; then + if [ ! -e "$TOOL_ARCHIVE" ]; then echo -e "\033[33;1mDownloading Coverity Scan Analysis Tool...\033[0m" set +x - wget -nv -O $TOOL_ARCHIVE $TOOL_URL --post-data "project=$COVERITY_SCAN_PROJECT_NAME&token=$COVERITY_SCAN_TOKEN" + wget -nv -O "$TOOL_ARCHIVE" "$TOOL_URL" --post-data "project=$COVERITY_SCAN_PROJECT_NAME&token=$COVERITY_SCAN_TOKEN" set -x fi # Extract Coverity Scan Analysis Tool echo -e "\033[33;1mExtracting Coverity Scan Analysis Tool...\033[0m" - mkdir -p $TOOL_BASE - cd $TOOL_BASE - tar xzf $TOOL_ARCHIVE + mkdir -p "$TOOL_BASE" + cd "$TOOL_BASE" || exit 1 + tar xzf "$TOOL_ARCHIVE" cd - fi -TOOL_DIR=`find $TOOL_BASE -type d -name 'cov-analysis*'` +TOOL_DIR=$(find "$TOOL_BASE" -type d -name 'cov-analysis*') export PATH=$TOOL_DIR/bin:$PATH cd "$SRCDIR" -COVERITY_SCAN_VERSION=`git describe --always | sed 's|-|.|g'` +COVERITY_SCAN_VERSION=$(git describe --always | sed 's|-|.|g') # Prepare build dir if [ -f "./bootstrap" ]; then @@ -149,8 +149,8 @@ fi # Build echo -e "\033[33;1mRunning Coverity Scan Analysis Tool...\033[0m" -cov-build --dir $RESULTS_DIR $COVERITY_SCAN_BUILD_OPTIONS make -j$NPROC V=1 -cov-import-scm --dir $RESULTS_DIR --scm git --log $RESULTS_DIR/scm_log.txt +cov-build --dir "$RESULTS_DIR" $COVERITY_SCAN_BUILD_OPTIONS make -j"$NPROC" V=1 +cov-import-scm --dir "$RESULTS_DIR" --scm git --log "$RESULTS_DIR/scm_log.txt" cd "${WORKSPACE}" @@ -163,13 +163,13 @@ echo -e "\033[33;1mUploading Coverity Scan Analysis results...\033[0m" set +x response=$(curl \ --silent --write-out "\n%{http_code}\n" \ - --form project=$COVERITY_SCAN_PROJECT_NAME \ - --form token=$COVERITY_SCAN_TOKEN \ - --form email=$COVERITY_SCAN_NOTIFICATION_EMAIL \ - --form file=@$RESULTS_ARCHIVE \ - --form version=$COVERITY_SCAN_VERSION \ - --form description=$COVERITY_SCAN_DESCRIPTION \ - $UPLOAD_URL) + --form project="$COVERITY_SCAN_PROJECT_NAME" \ + --form token="$COVERITY_SCAN_TOKEN" \ + --form email="$COVERITY_SCAN_NOTIFICATION_EMAIL" \ + --form file=@"$RESULTS_ARCHIVE" \ + --form version="$COVERITY_SCAN_VERSION" \ + --form description="$COVERITY_SCAN_DESCRIPTION" \ + "$UPLOAD_URL") set -x status_code=$(echo "$response" | sed -n '$p') if [ "$status_code" != "201" ]; then @@ -177,3 +177,5 @@ if [ "$status_code" != "201" ]; then echo -e "\033[33;1mCoverity Scan upload failed: $TEXT.\033[0m" exit 1 fi + +# EOF diff --git a/scripts/common/scan-build.sh b/scripts/common/scan-build.sh index 8ff8304..e46a520 100755 --- a/scripts/common/scan-build.sh +++ b/scripts/common/scan-build.sh @@ -1,4 +1,4 @@ -#!/bin/sh -exu +#!/bin/bash -exu # # Copyright (C) 2015 - Jonathan Rajotte-Julien # 2016 - Michael Jeanson diff --git a/scripts/liburcu/build.sh b/scripts/liburcu/build.sh index 8a699ea..796f4aa 100755 --- a/scripts/liburcu/build.sh +++ b/scripts/liburcu/build.sh @@ -69,6 +69,11 @@ verne() { [ "$res" -ne "0" ] } +# Required parameters +arch=${arch:-} +conf=${conf:-} +build=${build:-} + SRCDIR="$WORKSPACE/src/liburcu" TMPDIR="$WORKSPACE/tmp" @@ -124,7 +129,7 @@ static) CONF_OPTS="--enable-static --disable-shared" ;; -tls_fallback) +tls_fallback) echo "Using pthread_getspecific() to emulate TLS" CONF_OPTS="--disable-compiler-tls" ;; @@ -143,7 +148,7 @@ cd "$SRCDIR" ./bootstrap # Get source version from configure script -eval `grep '^PACKAGE_VERSION=' ./configure` +eval "$(grep '^PACKAGE_VERSION=' ./configure)" # Build type @@ -165,7 +170,7 @@ oot) dist) echo "Distribution out of tree build" - BUILD_PATH=`mktemp -d` + BUILD_PATH=$(mktemp -d) # Initial configure and generate tarball MAKE=$MAKE "$SRCDIR/configure" @@ -187,7 +192,7 @@ dist) esac # BUILD! -$MAKE -j `$NPROC` V=1 +$MAKE -j "$($NPROC)" V=1 $MAKE install # Run tests diff --git a/scripts/lttng-analyses/build.sh b/scripts/lttng-analyses/build.sh index ef19043..a0f5e89 100755 --- a/scripts/lttng-analyses/build.sh +++ b/scripts/lttng-analyses/build.sh @@ -1,4 +1,4 @@ -#!/bin/sh -exu +#!/bin/bash -exu # # Copyright (C) 2015 - Michael Jeanson # diff --git a/scripts/lttng-analyses/pylint.sh b/scripts/lttng-analyses/pylint.sh index 47947cf..fb10d46 100755 --- a/scripts/lttng-analyses/pylint.sh +++ b/scripts/lttng-analyses/pylint.sh @@ -1,4 +1,4 @@ -#!/bin/sh -exu +#!/bin/bash -exu # # Copyright (C) 2015 - Michael Jeanson # diff --git a/scripts/lttng-ust/build.sh b/scripts/lttng-ust/build.sh index ccb3683..733e9d0 100755 --- a/scripts/lttng-ust/build.sh +++ b/scripts/lttng-ust/build.sh @@ -16,6 +16,11 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +# Required parameters +arch=${arch:-} +conf=${conf:-} +build=${build:-} + # liburcu URCU_INCS="$WORKSPACE/deps/liburcu/build/include/" @@ -37,9 +42,9 @@ case "$arch" in MAKE=make TAR=tar NPROC=nproc - BISON="bison" - YACC="$BISON -y" - CFLAGS="" + #BISON="bison" + #YACC="$BISON -y" + #CFLAGS="" ;; esac @@ -101,7 +106,7 @@ oot) dist) echo "Distribution out of tree build" - BUILD_PATH="`mktemp -d`" + BUILD_PATH="$(mktemp -d)" # Initial configure and generate tarball "$SRCDIR/configure" @@ -124,7 +129,7 @@ dist) esac # BUILD! -$MAKE -j "`$NPROC`" V=1 +$MAKE -j "$($NPROC)" V=1 $MAKE install # Run tests -- 2.34.1