Merge branch '8784-dir-listings'
[arvados.git] / build / run-build-packages-python-and-ruby.sh
index 8d593ac3c7e6d8d4035d30ee2cc3f298f89084a8..35f8104450339c80c4f9e2ff92f50cd200f2b1cc 100755 (executable)
@@ -1,9 +1,12 @@
 #!/bin/bash
+# Copyright (C) The Arvados Authors. All rights reserved.
+#
+# SPDX-License-Identifier: AGPL-3.0
 
 COLUMNS=80
 
 . `dirname "$(readlink -f "$0")"`/run-library.sh
-#. `dirname "$(readlink -f "$0")"`/libcloud-pin
+#. `dirname "$(readlink -f "$0")"`/libcloud-pin.sh
 
 read -rd "\000" helpmessage <<EOF
 $(basename $0): Build Arvados Python packages and Ruby gems
@@ -23,12 +26,10 @@ WORKSPACE=path         Path to the Arvados source tree to build packages from
 
 EOF
 
-EXITCODE=0
-
 exit_cleanly() {
     trap - INT
     report_outcomes
-    exit $EXITCODE
+    exit ${#failures[@]}
 }
 
 gem_wrapper() {
@@ -53,6 +54,9 @@ python_wrapper() {
   timer_reset
 
   cd "$package_directory"
+  if [[ $DEBUG > 0 ]]; then
+    echo `pwd`
+  fi
   handle_python_package
 
   checkexit $? "$package_name python package build"
@@ -140,6 +144,7 @@ fi
 chmod o+r "$WORKSPACE" -R
 
 # More cleanup - make sure all executables that we'll package are 755
+cd "$WORKSPACE"
 find -type d -name 'bin' |xargs -I {} find {} -type f |xargs -I {} chmod 755 {}
 
 # Now fix our umask to something better suited to building and publishing
@@ -148,8 +153,6 @@ umask 0022
 
 debug_echo "umask is" `umask`
 
-FPM_GEM_PREFIX=$($GEM environment gemdir)
-
 gem_wrapper arvados "$WORKSPACE/sdk/ruby"
 gem_wrapper arvados-cli "$WORKSPACE/sdk/cli"
 gem_wrapper arvados-login-sync "$WORKSPACE/services/login-sync"
@@ -171,11 +174,22 @@ if [ $((${#failures[@]} - $GEM_BUILD_FAILURES)) -ne 0 ]; then
 fi
 
 if [[ "$UPLOAD" != 0 ]]; then
+
+  if [[ $DEBUG > 0 ]]; then
+    EXTRA_UPLOAD_FLAGS=" --verbose"
+  else
+    EXTRA_UPLOAD_FLAGS=""
+  fi
+
+  if [[ ! -e "$WORKSPACE/packages" ]]; then
+    mkdir -p "$WORKSPACE/packages"
+  fi
+
   title "Start upload python packages"
   timer_reset
 
-  if [ "$GEM_BUILD_FAILURES" -eq 0 ]; then
-    /usr/local/arvados-dev/jenkins/run_upload_packages.py --workspace $WORKSPACE python
+  if [ "$PYTHON_BUILD_FAILURES" -eq 0 ]; then
+    /usr/local/arvados-dev/jenkins/run_upload_packages.py $EXTRA_UPLOAD_FLAGS --workspace $WORKSPACE python
   else
     echo "Skipping python packages upload, there were errors building the packages"
   fi
@@ -185,8 +199,8 @@ if [[ "$UPLOAD" != 0 ]]; then
   title "Start upload ruby gems"
   timer_reset
 
-  if [ "$PYTHON_BUILD_FAILURES" -eq 0 ]; then
-    /usr/local/arvados-dev/jenkins/run_upload_packages.py --workspace $WORKSPACE gems
+  if [ "$GEM_BUILD_FAILURES" -eq 0 ]; then
+    /usr/local/arvados-dev/jenkins/run_upload_packages.py $EXTRA_UPLOAD_FLAGS --workspace $WORKSPACE gems
   else
     echo "Skipping ruby gem upload, there were errors building the packages"
   fi