15516: various fixes:
authorWard Vandewege <wvandewege@veritasgenetics.com>
Tue, 13 Aug 2019 14:36:53 +0000 (10:36 -0400)
committerWard Vandewege <wvandewege@veritasgenetics.com>
Tue, 13 Aug 2019 15:25:19 +0000 (11:25 -0400)
* make it possible to supply --debug to run-build-test-packages-one-target.sh
* replace hardcoded /dev/null in a few places in run-build-packages.sh
* make sure get_complete_package_name() does not abort the program when optional
  parameters are not supplied, in the case where set -e is set

Arvados-DCO-1.1-Signed-off-by: Ward Vandewege <wvandewege@veritasgenetics.com>

build/run-build-packages.sh
build/run-build-test-packages-one-target.sh
build/run-library.sh

index 8df8f981db40f955fc4da206753964f6265c1d1b..ac11971e8b8454401053c2f69a4464767552ae74 100755 (executable)
@@ -409,8 +409,8 @@ if [[ "$?" == "0" ]] ; then
       mv /tmp/x /etc/arvados/config.yml
       perl -p -i -e 'BEGIN{undef $/;} s/WebDAV(.*?):\n( *)ExternalURL: ""/WebDAV$1:\n$2ExternalURL: "example.com"/g' /etc/arvados/config.yml
 
-      RAILS_ENV=production RAILS_GROUPS=assets bundle exec rake npm:install >/dev/null
-      RAILS_ENV=production RAILS_GROUPS=assets bundle exec rake assets:precompile >/dev/null
+      RAILS_ENV=production RAILS_GROUPS=assets bundle exec rake npm:install >"$STDOUT_IF_DEBUG"
+      RAILS_ENV=production RAILS_GROUPS=assets bundle exec rake assets:precompile >"$STDOUT_IF_DEBUG"
 
       # Remove generated configuration files so they don't go in the package.
       rm -rf /etc/arvados/
index 962940b799bd1907cc0540dd60a0f96643ebeb18..d75e2785eca730d748f6e59446f6509a233fa1dd 100755 (executable)
@@ -14,6 +14,8 @@ Syntax:
 --upload
     If the build and test steps are successful, upload the packages
     to a remote apt repository (default: false)
+--debug
+    Output debug information (default: false)
 --rc
     Optional Parameter to build Release Candidate
 --build-version <version>
@@ -42,7 +44,7 @@ if ! [[ -d "$WORKSPACE" ]]; then
 fi
 
 PARSEDOPTS=$(getopt --name "$0" --longoptions \
-    help,upload,rc,target:,build-version: \
+    help,debug,upload,rc,target:,build-version: \
     -- "" "$@")
 if [ $? -ne 0 ]; then
     exit 1
@@ -51,6 +53,7 @@ fi
 TARGET=debian9
 UPLOAD=0
 RC=0
+DEBUG=
 
 declare -a build_args=()
 
@@ -65,6 +68,9 @@ while [ $# -gt 0 ]; do
         --target)
             TARGET="$2"; shift
             ;;
+        --debug)
+            DEBUG=" --debug"
+            ;;
         --upload)
             UPLOAD=1
             ;;
@@ -99,7 +105,7 @@ COLUMNS=80
 title "Start build packages"
 timer_reset
 
-$WORKSPACE/build/run-build-packages-one-target.sh "${build_args[@]}"
+$WORKSPACE/build/run-build-packages-one-target.sh "${build_args[@]}"$DEBUG
 
 checkexit $? "build packages"
 title "End of build packages (`timer`)"
@@ -108,7 +114,7 @@ title "Start test packages"
 timer_reset
 
 if [ ${#failures[@]} -eq 0 ]; then
-  $WORKSPACE/build/run-build-packages-one-target.sh "${build_args[@]}" --test-packages
+  $WORKSPACE/build/run-build-packages-one-target.sh "${build_args[@]}" --test-packages$DEBUG
 else
   echo "Skipping package upload, there were errors building the packages"
 fi
index af95cdc6012cb65b160819fd78042e8d8ba4d4fd..e0b7a0b97480856428892b1384eee032b9595b1b 100755 (executable)
@@ -226,6 +226,12 @@ test_rails_package_presence() {
 }
 
 get_complete_package_name() {
+  # if the errexit flag is set, unset it until this function returns
+  # otherwise, the shift calls below will abort the program if optional arguments are not supplied
+  if [ -o errexit ]; then
+    set +e
+    trap 'set -e' RETURN
+  fi
   local -n __returnvar="$1"; shift
   local pkgname="$1"; shift
   local version="$1"; shift