[ARVADOS-DEV] updated: 7fa64db2c56414cf9db215a1771266a4f9b6161b

git at public.curoverse.com git at public.curoverse.com
Wed Oct 8 17:24:52 EDT 2014


Summary of changes:
 jenkins/run-build-packages.sh | 204 ++++++++++++++++++++++++++++++++++--------
 1 file changed, 166 insertions(+), 38 deletions(-)

       via  7fa64db2c56414cf9db215a1771266a4f9b6161b (commit)
      from  c1ab6401ba557f8ca015eb462f8bbba692c7b88a (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit 7fa64db2c56414cf9db215a1771266a4f9b6161b
Author: Ward Vandewege <ward at curoverse.com>
Date:   Wed Oct 8 17:22:06 2014 -0400

    Make run-build-packages.sh much more quiet by default. Also make
    uploading optional. Change command line argument syntax to bring it in
    line with run-tests.sh.
    
    No issue #

diff --git a/jenkins/run-build-packages.sh b/jenkins/run-build-packages.sh
index 173943e..e02cc3d 100755
--- a/jenkins/run-build-packages.sh
+++ b/jenkins/run-build-packages.sh
@@ -1,29 +1,80 @@
 #!/bin/bash
 
-EXITCODE=0
-CALL_FREIGHT=0
 
-APTUSER=$1
-APTSERVER=$2
+read -rd "\000" helpmessage <<EOF
+$(basename $0): Build Arvados packages and (optionally) upload them.
 
-if [[ "$APTUSER" == '' ]]; then
-  echo "Syntax: $0 <aptuser> <aptserver>"
-  exit 1
-fi
+Syntax:
+        $(basename $0) WORKSPACE=/path/to/arvados [options]
+
+Options:
+
+--upload               Upload packages (default: false)
+--scp-user USERNAME    Scp user for apt server (only required when --upload is specified)
+--apt-server HOSTNAME  Apt server hostname (only required when --upload is specified)
+--debug                Output debug information (default: false)
+
+WORKSPACE=path         Path to the Arvados source tree to build packages from
 
-if [[ "$APTSERVER" == '' ]]; then
-  echo "Syntax: $0 <aptuser> <aptserver>"
+EOF
+
+EXITCODE=0
+CALL_FREIGHT=0
+
+DEBUG=0
+UPLOAD=0
+
+while [[ -n "$1" ]]
+do
+    arg="$1"; shift
+    case "$arg" in
+        --help)
+            echo >&2 "$helpmessage"
+            echo >&2
+            exit 1
+            ;;
+        --scp-user)
+            APTUSER="$1"; shift
+            ;;
+        --apt-server)
+            APTSERVER="$1"; shift
+            ;;
+        --debug)
+            DEBUG=1
+            ;;
+        --upload)
+            UPLOAD=1
+            ;;
+        *)
+            echo >&2 "$0: Unrecognized option: '$arg'. Try: $0 --help"
+            exit 1
+            ;;
+    esac
+done
+
+# Sanity checks
+if [[ "$UPLOAD" != '0' && ("$APTUSER" == '' || "$APTSERVER" == '') ]]; then
+  echo >&2 "$helpmessage"
+  echo >&2
+  echo >&2 "Error: please specify --scp-user and --apt-server if --upload is set"
+  echo >&2
   exit 1
 fi
 
 # Sanity check
 if ! [[ -n "$WORKSPACE" ]]; then
-  echo "WORKSPACE environment variable not set"
+  echo >&2 "$helpmessage"
+  echo >&2
+  echo >&2 "Error: WORKSPACE environment variable not set"
+  echo >&2
   exit 1
 fi
 
 source /etc/profile.d/rvm.sh
-echo $WORKSPACE
+
+if [[ "$DEBUG" != 0 ]]; then
+  echo "Workspace is $WORKSPACE"
+fi
 
 # Make all files world-readable -- jenkins runs with umask 027, and has checked
 # out our git tree here
@@ -33,31 +84,55 @@ chmod o+r "$WORKSPACE" -R
 # gems and packages
 umask 0022
 
-echo "umask is"
-umask
+if [[ "$DEBUG" != 0 ]]; then
+  echo "umask is" `umask`
+fi
 
 # Build arvados GEM
-echo "Build and publish ruby gem"
+if [[ "$DEBUG" != 0 ]]; then
+  echo "Build and publish ruby gems"
+fi
+
 cd "$WORKSPACE"
 cd sdk/ruby
 # clean up old gems
 rm -f arvados-*gem
-gem build arvados.gemspec
-# publish new gem
-gem push arvados-*gem
+
+if [[ "$DEBUG" != 0 ]]; then
+  gem build arvados.gemspec
+else
+  # -q appears to be broken in gem version 2.2.2
+  gem build arvados.gemspec -q >/dev/null
+fi
+
+if [[ "$UPLOAD" != 0 ]]; then
+  # publish new gem
+  gem push arvados-*gem
+fi
 
 # Build arvados-cli GEM
-echo "Build and publish ruby gem"
 cd "$WORKSPACE"
 cd sdk/cli
 # clean up old gems
 rm -f arvados-cli*gem
-gem build arvados-cli.gemspec
-# publish new gem
-gem push arvados-cli*gem
+
+if [[ "$DEBUG" != 0 ]]; then
+  gem build arvados-cli.gemspec
+else
+  # -q appears to be broken in gem version 2.2.2
+  gem build arvados-cli.gemspec -q >/dev/null
+fi
+
+if [[ "$UPLOAD" != 0 ]]; then
+  # publish new gem
+  gem push arvados-cli*gem
+fi
 
 # Build arvados-python-client Python package
-echo "Build and publish arvados-python-client package"
+if [[ "$DEBUG" != 0 ]]; then
+  echo "Build and publish arvados-python-client package"
+fi
+
 cd "$WORKSPACE"
 
 GIT_HASH=`git log --format=format:%ct.%h -n1 .`
@@ -65,12 +140,40 @@ GIT_HASH=`git log --format=format:%ct.%h -n1 .`
 cd sdk/python
 
 # Make sure only to use sdist - that's the only format pip can deal with (sigh)
-python setup.py sdist upload
+
+if [[ "$UPLOAD" != 0 ]]; then
+  # Make sure only to use sdist - that's the only format pip can deal with (sigh)
+  if [[ "$DEBUG" != 0 ]]; then
+    python setup.py sdist upload
+  else
+    python setup.py -q sdist upload
+  fi
+else
+  # Make sure only to use sdist - that's the only format pip can deal with (sigh)
+  if [[ "$DEBUG" != 0 ]]; then
+    python setup.py sdist
+  else
+    python setup.py -q sdist
+  fi
+fi
 
 cd ../../services/fuse
 
-# Make sure only to use sdist - that's the only format pip can deal with (sigh)
-python setup.py sdist upload
+if [[ "$UPLOAD" != 0 ]]; then
+  # Make sure only to use sdist - that's the only format pip can deal with (sigh)
+  if [[ "$DEBUG" != 0 ]]; then
+    python setup.py sdist upload
+  else
+    python setup.py -q sdist upload
+  fi
+else
+  # Make sure only to use sdist - that's the only format pip can deal with (sigh)
+  if [[ "$DEBUG" != 0 ]]; then
+    python setup.py sdist
+  else
+    python setup.py -q sdist
+  fi
+fi
 
 # Build debs for everything
 build_and_scp_deb () {
@@ -113,6 +216,13 @@ build_and_scp_deb () {
 
   COMMAND_ARR+=("$PACKAGE")
 
+  if [[ "$DEBUG" != 0 ]]; then
+    echo
+    echo "Fpm command:"
+    echo "${COMMAND_ARR[@]}"
+    echo
+  fi
+
   FPM_RESULTS=$("${COMMAND_ARR[@]}")
   FPM_EXIT_CODE=$?
 
@@ -123,14 +233,16 @@ build_and_scp_deb () {
 
   if [[ "$FPM_PACKAGE_NAME" == "" ]]; then
     EXITCODE=1
-    echo "Error: Unabled figure out package name from fpm results:\n $FPM_RESULTS"
+    echo "Error: Unable to figure out package name from fpm results:\n $FPM_RESULTS"
   else
     if [[ ! $FPM_RESULTS =~ "File already exists" ]]; then
       if [[ "$FPM_EXIT_CODE" != "0" ]]; then
         echo "Error building debian package for $1:\n $FPM_RESULTS"
       else
-        scp -P2222 $FPM_PACKAGE_NAME $APTUSER@$APTSERVER:tmp/
-        CALL_FREIGHT=1
+        if [[ "$UPLOAD" != 0 ]]; then
+          scp -P2222 $FPM_PACKAGE_NAME $APTUSER@$APTSERVER:tmp/
+          CALL_FREIGHT=1
+        fi
       fi
     else
       echo "Debian package $FPM_PACKAGE_NAME exists, not rebuilding"
@@ -147,16 +259,26 @@ fi
 if [[ ! -d "$WORKSPACE/src-build-dir" ]]; then
   mkdir "$WORKSPACE/src-build-dir"
   cd "$WORKSPACE"
-  git clone https://github.com/curoverse/arvados.git src-build-dir
+  if [[ "$DEBUG" != 0 ]]; then
+    git clone https://github.com/curoverse/arvados.git src-build-dir
+  else
+    git clone -q https://github.com/curoverse/arvados.git src-build-dir
+  fi
 fi
 
 cd "$WORKSPACE/src-build-dir"
 # just in case, check out master
-git checkout master
-git pull
-
-# go into detached-head state
-git checkout `git log --format=format:%h -n1 .`
+if [[ "$DEBUG" != 0 ]]; then
+  git checkout master
+  git pull
+  # go into detached-head state
+  git checkout `git log --format=format:%h -n1 .`
+else
+  git checkout -q master
+  git pull -q
+  # go into detached-head state
+  git checkout -q `git log --format=format:%h -n1 .`
+fi
 
 # Build arvados src deb package
 cd $WORKSPACE/debs
@@ -164,7 +286,11 @@ build_and_scp_deb $WORKSPACE/src-build-dir/=/usr/local/arvados/src arvados-src '
 
 # clean up, check out master and step away from detached-head state
 cd "$WORKSPACE/src-build-dir"
-git checkout master
+if [[ "$DEBUG" != 0 ]]; then
+  git checkout master
+else
+  git checkout -q master
+fi
 
 # Keep
 export GOPATH=$(mktemp -d)
@@ -211,10 +337,12 @@ build_and_scp_deb ws4py
 build_and_scp_deb virtualenv
 
 # Finally, publish the packages, if necessary
-if [[ "$CALL_FREIGHT" != "0" ]]; then
+if [[ "$UPLOAD" != 0 && "$CALL_FREIGHT" != 0 ]]; then
   ssh -p2222 $APTUSER@$APTSERVER -t "cd tmp && ls -laF *deb && freight add *deb apt/wheezy && freight cache && rm -f *deb"
 else
-  echo "No new packages generated. No freight run necessary."
+  if [[ "$UPLOAD" != 0 ]]; then
+    echo "No new packages generated. No freight run necessary."
+  fi
 fi
 
 # clean up temporary GOPATH

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list