From 9bf2ba202652163937d79341e855910f8c330d05 Mon Sep 17 00:00:00 2001 From: Ward Vandewege Date: Thu, 31 Mar 2016 21:38:50 -0400 Subject: [PATCH] Add build/run-build-packages-python-and-ruby.sh script to handle upload to pypi and rubygems. refs #8864 --- build/run-build-packages-python-and-ruby.sh | 198 ++++++++++++++++++++ 1 file changed, 198 insertions(+) create mode 100755 build/run-build-packages-python-and-ruby.sh diff --git a/build/run-build-packages-python-and-ruby.sh b/build/run-build-packages-python-and-ruby.sh new file mode 100755 index 0000000000..8d593ac3c7 --- /dev/null +++ b/build/run-build-packages-python-and-ruby.sh @@ -0,0 +1,198 @@ +#!/bin/bash + +COLUMNS=80 + +. `dirname "$(readlink -f "$0")"`/run-library.sh +#. `dirname "$(readlink -f "$0")"`/libcloud-pin + +read -rd "\000" helpmessage <&2 "$helpmessage" + echo >&2 + exit 1 + ;; + --target) + TARGET="$2"; shift + ;; + --upload) + UPLOAD=1 + ;; + --debug) + DEBUG=1 + ;; + --) + if [ $# -gt 1 ]; then + echo >&2 "$0: unrecognized argument '$2'. Try: $0 --help" + exit 1 + fi + ;; + esac + shift +done + +if ! [[ -n "$WORKSPACE" ]]; then + echo >&2 "$helpmessage" + echo >&2 + echo >&2 "Error: WORKSPACE environment variable not set" + echo >&2 + exit 1 +fi + +STDOUT_IF_DEBUG=/dev/null +STDERR_IF_DEBUG=/dev/null +DASHQ_UNLESS_DEBUG=-q +if [[ "$DEBUG" != 0 ]]; then + STDOUT_IF_DEBUG=/dev/stdout + STDERR_IF_DEBUG=/dev/stderr + DASHQ_UNLESS_DEBUG= +fi + +EASY_INSTALL2=$(find_easy_install -$PYTHON2_VERSION "") +EASY_INSTALL3=$(find_easy_install -$PYTHON3_VERSION 3) + +RUN_BUILD_PACKAGES_PATH="`dirname \"$0\"`" +RUN_BUILD_PACKAGES_PATH="`( cd \"$RUN_BUILD_PACKAGES_PATH\" && pwd )`" # absolutized and normalized +if [ -z "$RUN_BUILD_PACKAGES_PATH" ] ; then + # error; for some reason, the path is not accessible + # to the script (e.g. permissions re-evaled after suid) + exit 1 # fail +fi + +debug_echo "$0 is running from $RUN_BUILD_PACKAGES_PATH" +debug_echo "Workspace is $WORKSPACE" + +if [[ -f /etc/profile.d/rvm.sh ]]; then + source /etc/profile.d/rvm.sh + GEM="rvm-exec default gem" +else + GEM=gem +fi + +# Make all files world-readable -- jenkins runs with umask 027, and has checked +# out our git tree here +chmod o+r "$WORKSPACE" -R + +# More cleanup - make sure all executables that we'll package are 755 +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 +# gems and packages +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" + +GEM_BUILD_FAILURES=0 +if [ ${#failures[@]} -ne 0 ]; then + GEM_BUILD_FAILURES=${#failures[@]} +fi + +python_wrapper arvados-pam "$WORKSPACE/sdk/pam" +python_wrapper arvados-python-client "$WORKSPACE/sdk/python" +python_wrapper arvados-cwl-runner "$WORKSPACE/sdk/cwl" +python_wrapper arvados_fuse "$WORKSPACE/services/fuse" +python_wrapper arvados-node-manager "$WORKSPACE/services/nodemanager" + +PYTHON_BUILD_FAILURES=0 +if [ $((${#failures[@]} - $GEM_BUILD_FAILURES)) -ne 0 ]; then + PYTHON_BUILD_FAILURES=${#failures[@]} - $GEM_BUILD_FAILURES +fi + +if [[ "$UPLOAD" != 0 ]]; then + 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 + else + echo "Skipping python packages upload, there were errors building the packages" + fi + checkexit $? "upload python packages" + title "End of upload python packages (`timer`)" + + 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 + else + echo "Skipping ruby gem upload, there were errors building the packages" + fi + checkexit $? "upload ruby gems" + title "End of upload ruby gems (`timer`)" + +fi + +exit_cleanly -- 2.30.2