3 JENKINS_DIR=$(dirname $(readlink -e "$0"))
4 . "$JENKINS_DIR/run-library.sh"
6 read -rd "\000" helpmessage <<EOF
7 $(basename $0): Build Arvados SSO server package
10 WORKSPACE=/path/to/arvados-sso $(basename $0) [options]
15 Output debug information (default: false)
17 Distribution to build packages for (default: debian8)
19 WORKSPACE=path Path to the Arvados SSO source tree to build packages from
24 DEBUG=${ARVADOS_DEBUG:-0}
27 PARSEDOPTS=$(getopt --name "$0" --longoptions \
28 help,build-bundle-packages,debug,target: \
34 eval set -- "$PARSEDOPTS"
35 while [ $# -gt 0 ]; do
38 echo >&2 "$helpmessage"
53 echo >&2 "$0: unrecognized argument '$2'. Try: $0 --help"
61 STDOUT_IF_DEBUG=/dev/null
62 STDERR_IF_DEBUG=/dev/null
64 if [[ "$DEBUG" != 0 ]]; then
65 STDOUT_IF_DEBUG=/dev/stdout
66 STDERR_IF_DEBUG=/dev/stderr
84 echo -e "$0: Unknown target '$TARGET'.\n" >&2
89 if ! [[ -n "$WORKSPACE" ]]; then
90 echo >&2 "$helpmessage"
92 echo >&2 "Error: WORKSPACE environment variable not set"
97 if ! [[ -d "$WORKSPACE" ]]; then
98 echo >&2 "$helpmessage"
100 echo >&2 "Error: $WORKSPACE is not a directory"
106 fpm --version >/dev/null 2>&1
108 if [[ "$?" != 0 ]]; then
109 echo >&2 "$helpmessage"
111 echo >&2 "Error: fpm not found"
116 RUN_BUILD_PACKAGES_PATH="`dirname \"$0\"`"
117 RUN_BUILD_PACKAGES_PATH="`( cd \"$RUN_BUILD_PACKAGES_PATH\" && pwd )`" # absolutized and normalized
118 if [ -z "$RUN_BUILD_PACKAGES_PATH" ] ; then
119 # error; for some reason, the path is not accessible
120 # to the script (e.g. permissions re-evaled after suid)
124 debug_echo "$0 is running from $RUN_BUILD_PACKAGES_PATH"
125 debug_echo "Workspace is $WORKSPACE"
127 if [[ -f /etc/profile.d/rvm.sh ]]; then
128 source /etc/profile.d/rvm.sh
129 GEM="rvm-exec default gem"
134 # Make all files world-readable -- jenkins runs with umask 027, and has checked
135 # out our git tree here
136 chmod o+r "$WORKSPACE" -R
138 # More cleanup - make sure all executables that we'll package are 755
139 # No executables in the sso server package
140 #find -type d -name 'bin' |xargs -I {} find {} -type f |xargs -I {} chmod 755 {}
142 # Now fix our umask to something better suited to building and publishing
146 debug_echo "umask is" `umask`
148 if [[ ! -d "$WORKSPACE/packages/$TARGET" ]]; then
149 mkdir -p "$WORKSPACE/packages/$TARGET"
152 # Build the SSO server package
153 handle_rails_package arvados-sso-server "$WORKSPACE" \
154 "$WORKSPACE/LICENCE" --url="https://arvados.org" \
155 --description="Arvados SSO server - Arvados is a free and open source platform for big data science." \
156 --license="Expat license"