2 # Copyright (C) The Arvados Authors. All rights reserved.
4 # SPDX-License-Identifier: AGPL-3.0
6 JENKINS_DIR=$(dirname $(readlink -e "$0"))
7 . "$JENKINS_DIR/run-library.sh"
9 read -rd "\000" helpmessage <<EOF
10 $(basename $0): Build Arvados SSO server package
13 WORKSPACE=/path/to/arvados-sso $(basename $0) [options]
18 Output debug information (default: false)
20 Distribution to build packages for (default: debian8)
22 WORKSPACE=path Path to the Arvados SSO source tree to build packages from
27 DEBUG=${ARVADOS_DEBUG:-0}
30 PARSEDOPTS=$(getopt --name "$0" --longoptions \
31 help,build-bundle-packages,debug,target: \
37 eval set -- "$PARSEDOPTS"
38 while [ $# -gt 0 ]; do
41 echo >&2 "$helpmessage"
56 echo >&2 "$0: unrecognized argument '$2'. Try: $0 --help"
64 STDOUT_IF_DEBUG=/dev/null
65 STDERR_IF_DEBUG=/dev/null
67 if [[ "$DEBUG" != 0 ]]; then
68 STDOUT_IF_DEBUG=/dev/stdout
69 STDERR_IF_DEBUG=/dev/stderr
90 echo -e "$0: Unknown target '$TARGET'.\n" >&2
95 if ! [[ -n "$WORKSPACE" ]]; then
96 echo >&2 "$helpmessage"
98 echo >&2 "Error: WORKSPACE environment variable not set"
103 if ! [[ -d "$WORKSPACE" ]]; then
104 echo >&2 "$helpmessage"
106 echo >&2 "Error: $WORKSPACE is not a directory"
112 fpm --version >/dev/null 2>&1
114 if [[ "$?" != 0 ]]; then
115 echo >&2 "$helpmessage"
117 echo >&2 "Error: fpm not found"
122 RUN_BUILD_PACKAGES_PATH="`dirname \"$0\"`"
123 RUN_BUILD_PACKAGES_PATH="`( cd \"$RUN_BUILD_PACKAGES_PATH\" && pwd )`" # absolutized and normalized
124 if [ -z "$RUN_BUILD_PACKAGES_PATH" ] ; then
125 # error; for some reason, the path is not accessible
126 # to the script (e.g. permissions re-evaled after suid)
130 debug_echo "$0 is running from $RUN_BUILD_PACKAGES_PATH"
131 debug_echo "Workspace is $WORKSPACE"
133 if [[ -f /etc/profile.d/rvm.sh ]]; then
134 source /etc/profile.d/rvm.sh
135 GEM="rvm-exec default gem"
140 # Make all files world-readable -- jenkins runs with umask 027, and has checked
141 # out our git tree here
142 chmod o+r "$WORKSPACE" -R
144 # More cleanup - make sure all executables that we'll package are 755
145 # No executables in the sso server package
146 #find -type d -name 'bin' |xargs -I {} find {} -type f |xargs -I {} chmod 755 {}
148 # Now fix our umask to something better suited to building and publishing
152 debug_echo "umask is" `umask`
154 if [[ ! -d "$WORKSPACE/packages/$TARGET" ]]; then
155 mkdir -p "$WORKSPACE/packages/$TARGET"
158 # Build the SSO server package
159 handle_rails_package arvados-sso-server "$WORKSPACE" \
160 "$WORKSPACE/LICENCE" --url="https://arvados.org" \
161 --description="Arvados SSO server - Arvados is a free and open source platform for big data science." \
162 --license="Expat license"