jjb: build scripts cleanups
authorMichael Jeanson <mjeanson@efficios.com>
Mon, 17 Oct 2016 19:21:17 +0000 (15:21 -0400)
committerMichael Jeanson <mjeanson@efficios.com>
Mon, 17 Oct 2016 19:21:17 +0000 (15:21 -0400)
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
scripts/babeltrace/build.sh
scripts/common/coverity.sh
scripts/common/scan-build.sh
scripts/liburcu/build.sh
scripts/lttng-analyses/build.sh
scripts/lttng-analyses/pylint.sh
scripts/lttng-ust/build.sh

index 4dc939d1b1637f12c501e672ab737b4e79974455..18532cbd1f1699bb1f4c826c515f9780b2c76393 100755 (executable)
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
+# 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
index 89e0a2c0a409818ea7c678476f12f3e455d64292..7b2e946516a18e434a6140f608f918a70fa96f16 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/sh -xue
+#!/bin/bash -exu
 #
 # Copyright (C) 2015 - Michael Jeanson <mjeanson@efficios.com>
 #                      Jonathan Rajotte-Julien <jonathan.rajotte-julien@efficios.com>
@@ -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
index 8ff83044215a8bab782561f2a9450a832ed27549..e46a52034062717f62cff050fc8760f738b2d87f 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/sh -exu
+#!/bin/bash -exu
 #
 # Copyright (C) 2015 - Jonathan Rajotte-Julien <jonathan.rajotte-julien@efficios.com>
 #               2016 - Michael Jeanson <mjeanson@efficios.com>
index 8a699ea92bcd4691d37c1b68abd45b328fbb50dc..796f4aa02a4a2ac91a213d1ed0b9da3bdd9f669f 100755 (executable)
@@ -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
index ef19043d64836f194b2ffb1450cb06fa65107e1d..a0f5e8922adcc903ada9c0e0e1917776cffa1f90 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/sh -exu
+#!/bin/bash -exu
 #
 # Copyright (C) 2015 - Michael Jeanson <mjeanson@efficios.com>
 #
index 47947cf66aab169822b966f21cc100ce9d2d8f0d..fb10d465276764c3331ee0f220a0cb0e712005b3 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/sh -exu
+#!/bin/bash -exu
 #
 # Copyright (C) 2015 - Michael Jeanson <mjeanson@efficios.com>
 #
index ccb3683bdb4d4a798bf5c352c5abb5a95867def7..733e9d0ddcb259e822f198d6420a3a301cc53237 100755 (executable)
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
+# 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
This page took 0.028352 seconds and 4 git commands to generate.