4 read -rd "\000" helpmessage <<EOF
5 $(basename $0): Build Arvados packages
8 WORKSPACE=/path/to/arvados $(basename $0) [options]
12 --build-bundle-packages (default: false)
13 Build api server and workbench packages with vendor/bundle included
15 Output debug information (default: false)
17 Distribution to build packages for (default: debian7)
19 WORKSPACE=path Path to the Arvados source tree to build packages from
24 DEBUG=${ARVADOS_DEBUG:-0}
25 BUILD_BUNDLE_PACKAGES=0
28 PARSEDOPTS=$(getopt --name "$0" --longoptions \
29 help,build-bundle-packages,debug,target: \
35 eval set -- "$PARSEDOPTS"
36 while [ $# -gt 0 ]; do
39 echo >&2 "$helpmessage"
49 --build-bundle-packages)
50 BUILD_BUNDLE_PACKAGES=1
54 echo >&2 "$0: unrecognized argument '$2'. Try: $0 --help"
62 declare -a PYTHON_BACKPORTS PYTHON3_BACKPORTS
65 PYTHON3_VERSION=$(python3 -c 'import sys; print("{v.major}.{v.minor}".format(v=sys.version_info))')
70 PYTHON2_PACKAGE=python$PYTHON2_VERSION
71 PYTHON2_PKG_PREFIX=python
72 PYTHON3_PACKAGE=python$PYTHON3_VERSION
73 PYTHON3_PKG_PREFIX=python3
74 PYTHON_BACKPORTS=(python-gflags pyvcf google-api-python-client \
75 oauth2client pyasn1==0.1.7 pyasn1-modules==0.0.5 \
76 rsa uritemplate httplib2 ws4py \
77 virtualenv pykka apache-libcloud requests six pyexecjs jsonschema \
78 ciso8601 pycrypto backports.ssl_match_hostname pycurl llfuse)
79 PYTHON3_BACKPORTS=(docker-py six requests websocket-client)
83 PYTHON2_PACKAGE=python$PYTHON2_VERSION
84 PYTHON2_PKG_PREFIX=python
85 PYTHON3_PACKAGE=python$PYTHON3_VERSION
86 PYTHON3_PKG_PREFIX=python3
87 PYTHON_BACKPORTS=(python-gflags pyvcf google-api-python-client \
88 oauth2client pyasn1==0.1.7 pyasn1-modules==0.0.5 \
89 rsa uritemplate httplib2 ws4py \
90 virtualenv pykka apache-libcloud requests six pyexecjs jsonschema \
91 ciso8601 pycrypto backports.ssl_match_hostname pycurl llfuse)
92 PYTHON3_BACKPORTS=(docker-py six requests websocket-client)
96 PYTHON2_PACKAGE=python$PYTHON2_VERSION
97 PYTHON2_PKG_PREFIX=python
98 PYTHON3_PACKAGE=python$PYTHON3_VERSION
99 PYTHON3_PKG_PREFIX=python3
100 PYTHON_BACKPORTS=(python-gflags pyvcf google-api-python-client \
101 oauth2client pyasn1==0.1.7 pyasn1-modules==0.0.5 \
102 rsa uritemplate httplib2 ws4py \
103 virtualenv pykka apache-libcloud requests six pyexecjs jsonschema \
104 ciso8601 pycrypto backports.ssl_match_hostname pycurl llfuse)
105 PYTHON3_BACKPORTS=(docker-py six requests websocket-client)
109 PYTHON2_PACKAGE=python$PYTHON2_VERSION
110 PYTHON2_PKG_PREFIX=python
111 PYTHON3_PACKAGE=python$PYTHON3_VERSION
112 PYTHON3_PKG_PREFIX=python3
113 PYTHON_BACKPORTS=(pyasn1==0.1.7 pyasn1-modules==0.0.5 llfuse ciso8601 \
114 google-api-python-client six uritemplate oauth2client httplib2 \
115 rsa apache-libcloud pycurl backports.ssl_match_hostname)
116 PYTHON3_BACKPORTS=(docker-py requests websocket-client)
120 PYTHON2_PACKAGE=$(rpm -qf "$(which python$PYTHON2_VERSION)" --queryformat '%{NAME}\n')
121 PYTHON2_PKG_PREFIX=$PYTHON2_PACKAGE
122 PYTHON3_PACKAGE=$(rpm -qf "$(which python$PYTHON3_VERSION)" --queryformat '%{NAME}\n')
123 PYTHON3_PKG_PREFIX=$PYTHON3_PACKAGE
124 PYTHON_BACKPORTS=(python-gflags pyvcf google-api-python-client \
125 oauth2client pyasn1==0.1.7 pyasn1-modules==0.0.5 \
126 rsa uritemplate httplib2 ws4py \
127 pykka apache-libcloud requests six pyexecjs jsonschema \
128 ciso8601 pycrypto backports.ssl_match_hostname pycurl
129 python-daemon lockfile llfuse)
130 PYTHON3_BACKPORTS=(docker-py six requests)
131 export PYCURL_SSL_LIBRARY=nss
134 echo -e "$0: Unknown target '$TARGET'.\n" >&2
140 if ! [[ -n "$WORKSPACE" ]]; then
141 echo >&2 "$helpmessage"
143 echo >&2 "Error: WORKSPACE environment variable not set"
149 fpm --version >/dev/null 2>&1
151 if [[ "$?" != 0 ]]; then
152 echo >&2 "$helpmessage"
154 echo >&2 "Error: fpm not found"
159 find_easy_install() {
160 for version_suffix in "$@"; do
161 if "easy_install$version_suffix" --version >/dev/null 2>&1; then
162 echo "easy_install$version_suffix"
169 Error: easy_install$1 (from Python setuptools module) not found
175 EASY_INSTALL2=$(find_easy_install -$PYTHON2_VERSION "")
176 EASY_INSTALL3=$(find_easy_install -$PYTHON3_VERSION 3)
178 RUN_BUILD_PACKAGES_PATH="`dirname \"$0\"`"
179 RUN_BUILD_PACKAGES_PATH="`( cd \"$RUN_BUILD_PACKAGES_PATH\" && pwd )`" # absolutized and normalized
180 if [ -z "$RUN_BUILD_PACKAGES_PATH" ] ; then
181 # error; for some reason, the path is not accessible
182 # to the script (e.g. permissions re-evaled after suid)
186 if [[ "$DEBUG" != 0 ]]; then
187 echo "$0 is running from $RUN_BUILD_PACKAGES_PATH"
188 echo "Workspace is $WORKSPACE"
191 format_last_commit_here() {
192 local format=$1; shift
193 TZ=UTC git log -n1 --first-parent "--format=format:$format" .
197 # Generates a version number from the git log for the current working
198 # directory, and writes it to stdout.
199 local git_ts git_hash
200 declare $(format_last_commit_here "git_ts=%ct git_hash=%h")
201 echo "0.1.$(date -ud "@$git_ts" +%Y%m%d%H%M%S).$git_hash"
204 nohash_version_from_git() {
205 version_from_git | cut -d. -f1-3
208 timestamp_from_git() {
209 format_last_commit_here "%ct"
212 handle_python_package () {
213 # This function assumes the current working directory is the python package directory
214 if [ -n "$(find dist -name "*-$(nohash_version_from_git).tar.gz" -print -quit)" ]; then
215 # This package doesn't need rebuilding.
218 # Make sure only to use sdist - that's the only format pip can deal with (sigh)
219 if [[ "$DEBUG" != 0 ]]; then
220 python setup.py sdist
222 python setup.py -q sdist
227 local gem_name=$1; shift
228 local gem_version=$(nohash_version_from_git)
230 if [ -e "${gem_name}-${gem_version}.gem" ]; then
231 # This gem doesn't need rebuilding.
235 find -maxdepth 1 -name "${gem_name}-*.gem" -delete
237 if [[ "$DEBUG" != 0 ]]; then
238 gem build "$gem_name.gemspec"
240 # -q appears to be broken in gem version 2.2.2
241 gem build "$gem_name.gemspec" -q >/dev/null 2>&1
244 fpm_build "$gem_name"-*.gem "" "Curoverse, Inc." gem "" \
245 --prefix "$FPM_GEM_PREFIX"
246 mv -t "$WORKSPACE/packages/$TARGET/" "$gem_name"*."$FORMAT"
249 # Build packages for everything
251 # The package source. Depending on the source type, this can be a
252 # path, or the name of the package in an upstream repository (e.g.,
256 # The name of the package to build. Defaults to $PACKAGE.
257 PACKAGE_NAME=${1:-$PACKAGE}
259 # Optional: the vendor of the package. Should be "Curoverse, Inc." for
260 # packages of our own software. Passed to fpm --vendor.
263 # The type of source package. Passed to fpm -s. Default "python".
264 PACKAGE_TYPE=${1:-python}
266 # Optional: the package version number. Passed to fpm -v.
270 case "$PACKAGE_TYPE" in
272 # All Arvados Python2 packages depend on Python 2.7.
273 # Make sure we build with that for consistency.
274 set -- "$@" --python-bin python2.7 \
275 --python-easyinstall "$EASY_INSTALL2" \
276 --python-package-name-prefix "$PYTHON2_PKG_PREFIX" \
277 --depends "$PYTHON2_PACKAGE"
280 # fpm does not actually support a python3 package type. Instead
281 # we recognize it as a convenience shortcut to add several
282 # necessary arguments to fpm's command line later, after we're
283 # done handling positional arguments.
285 set -- "$@" --python-bin python3 \
286 --python-easyinstall "$EASY_INSTALL3" \
287 --python-package-name-prefix "$PYTHON3_PKG_PREFIX" \
288 --depends "$PYTHON3_PACKAGE"
292 declare -a COMMAND_ARR=("fpm" "--maintainer=Ward Vandewege <ward@curoverse.com>" "-s" "$PACKAGE_TYPE" "-t" "$FORMAT")
293 if [ python = "$PACKAGE_TYPE" ]; then
294 COMMAND_ARR+=(--exclude=\*/{dist,site}-packages/tests/\*)
297 if [[ "$PACKAGE_NAME" != "$PACKAGE" ]]; then
298 COMMAND_ARR+=('-n' "$PACKAGE_NAME")
301 if [[ "$VENDOR" != "" ]]; then
302 COMMAND_ARR+=('--vendor' "$VENDOR")
305 if [[ "$VERSION" != "" ]]; then
306 COMMAND_ARR+=('-v' "$VERSION")
309 # Append remaining function arguments directly to fpm's command line.
314 COMMAND_ARR+=("$PACKAGE")
316 if [[ "$DEBUG" != 0 ]]; then
318 echo "${COMMAND_ARR[@]}"
322 FPM_RESULTS=$("${COMMAND_ARR[@]}")
325 fpm_verify $FPM_EXIT_CODE $FPM_RESULTS
328 # verify build results
335 if [[ $FPM_RESULTS =~ ([A-Za-z0-9_\.-]*\.)(deb|rpm) ]]; then
336 FPM_PACKAGE_NAME=${BASH_REMATCH[1]}${BASH_REMATCH[2]}
339 if [[ "$FPM_PACKAGE_NAME" == "" ]]; then
341 echo "Error: $PACKAGE: Unable to figure out package name from fpm results:"
345 elif [[ "$FPM_RESULTS" =~ "File already exists" ]]; then
346 echo "Package $FPM_PACKAGE_NAME exists, not rebuilding"
347 elif [[ 0 -ne "$FPM_EXIT_CODE" ]]; then
348 echo "Error building package for $1:\n $FPM_RESULTS"
352 if [[ -f /etc/profile.d/rvm.sh ]]; then
353 source /etc/profile.d/rvm.sh
356 # Make all files world-readable -- jenkins runs with umask 027, and has checked
357 # out our git tree here
358 chmod o+r "$WORKSPACE" -R
360 # More cleanup - make sure all executables that we'll package are 755
361 find -type d -name 'bin' |xargs -I {} find {} -type f |xargs -I {} chmod 755 {}
363 # Now fix our umask to something better suited to building and publishing
367 if [[ "$DEBUG" != 0 ]]; then
368 echo "umask is" `umask`
371 if [[ ! -d "$WORKSPACE/packages/$TARGET" ]]; then
372 mkdir -p $WORKSPACE/packages/$TARGET
376 if [[ "$DEBUG" != 0 ]]; then
377 echo -e "\nPerl packages\n"
380 if [[ "$DEBUG" != 0 ]]; then
386 cd "$WORKSPACE/sdk/perl"
388 if [[ -e Makefile ]]; then
389 make realclean >"$PERL_OUT"
391 find -maxdepth 1 \( -name 'MANIFEST*' -or -name "libarvados-perl*.$FORMAT" \) \
395 perl Makefile.PL INSTALL_BASE=install >"$PERL_OUT" && \
396 make install INSTALLDIRS=perl >"$PERL_OUT" && \
397 fpm_build install/lib/=/usr/share libarvados-perl \
398 "Curoverse, Inc." dir "$(version_from_git)" install/man/=/usr/share/man && \
399 mv libarvados-perl*.$FORMAT "$WORKSPACE/packages/$TARGET/"
402 if [[ "$DEBUG" != 0 ]]; then
408 if type rvm-exec >/dev/null 2>&1; then
409 FPM_GEM_PREFIX=$(rvm-exec system gem environment gemdir)
411 FPM_GEM_PREFIX=$(gem environment gemdir)
414 cd "$WORKSPACE/sdk/ruby"
415 handle_ruby_gem arvados
417 cd "$WORKSPACE/sdk/cli"
418 handle_ruby_gem arvados-cli
421 if [[ "$DEBUG" != 0 ]]; then
423 echo "Python packages"
427 cd "$WORKSPACE/sdk/pam"
428 handle_python_package
430 cd "$WORKSPACE/sdk/python"
431 handle_python_package
433 cd "$WORKSPACE/services/fuse"
434 handle_python_package
436 cd "$WORKSPACE/services/nodemanager"
437 handle_python_package
440 # We use $WORKSPACE/src-build-dir as the clean directory from which to build the src package
441 if [[ ! -d "$WORKSPACE/src-build-dir" ]]; then
442 mkdir "$WORKSPACE/src-build-dir"
444 if [[ "$DEBUG" != 0 ]]; then
445 git clone https://github.com/curoverse/arvados.git src-build-dir
447 git clone -q https://github.com/curoverse/arvados.git src-build-dir
451 # Get the commit hash we're building against, from the working directory
453 MASTER_COMMIT_HASH=$(format_last_commit_here "%H")
455 # Make sure we check out that commit in the clean $WORKSPACE/src-build-dir directory
456 cd "$WORKSPACE/src-build-dir"
457 # just in case, check out master
458 if [[ "$DEBUG" != 0 ]]; then
461 # go into detached-head state
462 git checkout "$MASTER_COMMIT_HASH"
464 git checkout -q master
466 # go into detached-head state
467 git checkout -q "$MASTER_COMMIT_HASH"
469 echo "$MASTER_COMMIT_HASH" >git-commit.version
471 # Build arvados src deb package
473 PKG_VERSION=$(version_from_git)
474 cd $WORKSPACE/packages/$TARGET
475 fpm_build $WORKSPACE/src-build-dir/=/usr/local/arvados/src arvados-src 'Curoverse, Inc.' 'dir' "$PKG_VERSION" "--exclude=usr/local/arvados/src/.git" "--url=https://arvados.org" "--license=GNU Affero General Public License, version 3.0" "--description=The Arvados source code" "--architecture=all"
477 # clean up, check out master and step away from detached-head state
478 cd "$WORKSPACE/src-build-dir"
479 if [[ "$DEBUG" != 0 ]]; then
482 git checkout -q master
486 export GOPATH=$(mktemp -d)
487 mkdir -p "$GOPATH/src/git.curoverse.com"
488 ln -sfn "$WORKSPACE" "$GOPATH/src/git.curoverse.com/arvados.git"
491 cd "$GOPATH/src/git.curoverse.com/arvados.git/services/keepstore"
492 PKG_VERSION=$(version_from_git)
493 go get "git.curoverse.com/arvados.git/services/keepstore"
494 cd $WORKSPACE/packages/$TARGET
495 fpm_build $GOPATH/bin/keepstore=/usr/bin/keepstore keepstore 'Curoverse, Inc.' 'dir' "$PKG_VERSION" "--url=https://arvados.org" "--license=GNU Affero General Public License, version 3.0" "--description=Keepstore is the Keep storage daemon, accessible to clients on the LAN"
498 cd "$GOPATH/src/git.curoverse.com/arvados.git/sdk/go"
499 GO_SDK_VERSION=$(version_from_git)
500 GO_SDK_TIMESTAMP=$(timestamp_from_git)
503 cd "$GOPATH/src/git.curoverse.com/arvados.git/services/keepproxy"
504 KEEPPROXY_VERSION=$(version_from_git)
505 KEEPPROXY_TIMESTAMP=$(timestamp_from_git)
507 if [[ "$GO_SDK_TIMESTAMP" -gt "$KEEPPROXY_TIMESTAMP" ]]; then
508 PKG_VERSION=$GO_SDK_VERSION
510 PKG_VERSION=$KEEPPROXY_VERSION
513 go get "git.curoverse.com/arvados.git/services/keepproxy"
514 cd $WORKSPACE/packages/$TARGET
515 fpm_build $GOPATH/bin/keepproxy=/usr/bin/keepproxy keepproxy 'Curoverse, Inc.' 'dir' "$PKG_VERSION" "--url=https://arvados.org" "--license=GNU Affero General Public License, version 3.0" "--description=Keepproxy makes a Keep cluster accessible to clients that are not on the LAN"
518 cd "$GOPATH/src/git.curoverse.com/arvados.git/services/datamanager"
519 DATAMANAGER_VERSION=$(version_from_git)
520 DATAMANAGER_TIMESTAMP=$(timestamp_from_git)
522 if [[ "$GO_SDK_TIMESTAMP" -gt "$DATAMANAGER_TIMESTAMP" ]]; then
523 PKG_VERSION=$GO_SDK_VERSION
525 PKG_VERSION=$DATAMANAGER_VERSION
528 go get "git.curoverse.com/arvados.git/services/datamanager"
529 cd $WORKSPACE/packages/$TARGET
530 fpm_build $GOPATH/bin/datamanager=/usr/bin/arvados-data-manager arvados-data-manager 'Curoverse, Inc.' 'dir' "$PKG_VERSION" "--url=https://arvados.org" "--license=GNU Affero General Public License, version 3.0" "--description=Datamanager ensures block replication levels, reports on disk usage and determines which blocks should be deleted when space is needed."
533 cd "$GOPATH/src/git.curoverse.com/arvados.git/services/arv-git-httpd"
534 ARVGITHTTPD_VERSION=$(version_from_git)
535 ARVGITHTTPD_TIMESTAMP=$(timestamp_from_git)
537 if [[ "$GO_SDK_TIMESTAMP" -gt "$ARVGITHTTPD_TIMESTAMP" ]]; then
538 PKG_VERSION=$GO_SDK_VERSION
540 PKG_VERSION=$ARVGITHTTPD_VERSION
543 go get "git.curoverse.com/arvados.git/services/arv-git-httpd"
544 cd $WORKSPACE/packages/$TARGET
545 fpm_build $GOPATH/bin/arv-git-httpd=/usr/bin/arvados-git-httpd arvados-git-httpd 'Curoverse, Inc.' 'dir' "$PKG_VERSION" "--url=https://arvados.org" "--license=GNU Affero General Public License, version 3.0" "--description=Provides authenticated http access to Arvados-hosted git repositories."
548 cd "$GOPATH/src/git.curoverse.com/arvados.git/services/crunchstat"
549 PKG_VERSION=$(version_from_git)
550 go get "git.curoverse.com/arvados.git/services/crunchstat"
551 cd $WORKSPACE/packages/$TARGET
552 fpm_build $GOPATH/bin/crunchstat=/usr/bin/crunchstat crunchstat 'Curoverse, Inc.' 'dir' "$PKG_VERSION" "--url=https://arvados.org" "--license=GNU Affero General Public License, version 3.0" "--description=Crunchstat gathers cpu/memory/network statistics of running Crunch jobs"
555 # Please resist the temptation to add --no-python-fix-name to the fpm call here
556 # (which would remove the python- prefix from the package name), because this
557 # package is a dependency of arvados-fuse, and fpm can not omit the python-
558 # prefix from only one of the dependencies of a package... Maybe I could
559 # whip up a patch and send it upstream, but that will be for another day. Ward,
561 cd $WORKSPACE/packages/$TARGET
562 rm -rf "$WORKSPACE/sdk/python/build"
563 fpm_build $WORKSPACE/sdk/python "${PYTHON2_PKG_PREFIX}-arvados-python-client" 'Curoverse, Inc.' 'python' "$(awk '($1 == "Version:"){print $2}' $WORKSPACE/sdk/python/arvados_python_client.egg-info/PKG-INFO)" "--url=https://arvados.org" "--description=The Arvados Python SDK" --deb-recommends=git
566 if [[ $TARGET =~ debian|ubuntu ]]; then
567 cd $WORKSPACE/packages/$TARGET
568 rm -rf "$WORKSPACE/sdk/pam/build"
569 fpm_build $WORKSPACE/sdk/pam libpam-arvados 'Curoverse, Inc.' 'python' "$(awk '($1 == "Version:"){print $2}' $WORKSPACE/sdk/pam/arvados_pam.egg-info/PKG-INFO)" "--url=https://arvados.org" "--description=PAM module for authenticating shell logins using Arvados API tokens" --depends libpam-python
573 # Please see comment about --no-python-fix-name above; we stay consistent and do
574 # not omit the python- prefix first.
575 cd $WORKSPACE/packages/$TARGET
576 rm -rf "$WORKSPACE/services/fuse/build"
577 fpm_build $WORKSPACE/services/fuse "${PYTHON2_PKG_PREFIX}-arvados-fuse" 'Curoverse, Inc.' 'python' "$(awk '($1 == "Version:"){print $2}' $WORKSPACE/services/fuse/arvados_fuse.egg-info/PKG-INFO)" "--url=https://arvados.org" "--description=The Keep FUSE driver"
580 cd $WORKSPACE/packages/$TARGET
581 rm -rf "$WORKSPACE/services/nodemanager/build"
582 fpm_build $WORKSPACE/services/nodemanager arvados-node-manager 'Curoverse, Inc.' 'python' "$(awk '($1 == "Version:"){print $2}' $WORKSPACE/services/nodemanager/arvados_node_manager.egg-info/PKG-INFO)" "--url=https://arvados.org" "--description=The Arvados node manager"
584 # The Docker image cleaner
585 cd $WORKSPACE/packages/$TARGET
586 rm -rf "$WORKSPACE/services/dockercleaner/build"
587 fpm_build $WORKSPACE/services/dockercleaner arvados-docker-cleaner 'Curoverse, Inc.' 'python3' "$(awk '($1 == "Version:"){print $2}' $WORKSPACE/services/dockercleaner/arvados_docker_cleaner.egg-info/PKG-INFO)" "--url=https://arvados.org" "--description=The Arvados Docker image cleaner"
590 for deppkg in "${PYTHON_BACKPORTS[@]}"; do
591 outname=$(echo "$deppkg" | sed -e 's/^python-//' -e 's/[<=>].*//' -e 's/_/-/g' -e "s/^/${PYTHON2_PKG_PREFIX}-/")
592 fpm_build "$deppkg" "$outname"
595 # Python 3 dependencies
596 for deppkg in "${PYTHON3_BACKPORTS[@]}"; do
597 outname=$(echo "$deppkg" | sed -e 's/^python-//' -e 's/[<=>].*//' -e 's/_/-/g' -e "s/^/${PYTHON3_PKG_PREFIX}-/")
598 # The empty string is the vendor argument: these aren't Curoverse software.
599 fpm_build "$deppkg" "$outname" "" python3
602 # Build the API server package
604 cd "$WORKSPACE/services/api"
606 API_VERSION=$(version_from_git)
607 PACKAGE_NAME=arvados-api-server
609 if [[ ! -d "$WORKSPACE/services/api/tmp" ]]; then
610 mkdir $WORKSPACE/services/api/tmp
613 BUNDLE_OUTPUT=`bundle install --path vendor/bundle`
615 if [[ "$DEBUG" != 0 ]]; then
619 /usr/bin/git rev-parse HEAD > git-commit.version
621 cd $WORKSPACE/packages/$TARGET
623 # Annoyingly, we require a database.yml file for rake assets:precompile to work. So for now,
624 # we do that in the upgrade script.
625 # TODO: add bogus database.yml file so we can precompile the assets and put them in the
626 # package. Then remove that database.yml file again. It has to be a valid file though.
627 #RAILS_ENV=production RAILS_GROUPS=assets bundle exec rake assets:precompile
629 # This is the complete package with vendor/bundle included.
630 # It's big, so we do not build it by default.
631 if [[ "$BUILD_BUNDLE_PACKAGES" != 0 ]]; then
632 declare -a COMMAND_ARR=("fpm" "--maintainer=Ward Vandewege <ward@curoverse.com>" "--vendor='Curoverse, Inc.'" "--url='https://arvados.org'" "--description='Arvados API server - Arvados is a free and open source platform for big data science.'" "--license='GNU Affero General Public License, version 3.0'" "-s" "dir" "-t" "$FORMAT" "-n" "${PACKAGE_NAME}-with-bundle" "-v" "$API_VERSION" "-x" "var/www/arvados-api/current/tmp" "-x" "var/www/arvados-api/current/log" "-x" "var/www/arvados-api/current/vendor/cache/*" "-x" "var/www/arvados-api/current/coverage" "-x" "var/www/arvados-api/current/Capfile*" "-x" "var/www/arvados-api/current/config/deploy*" "--after-install=$RUN_BUILD_PACKAGES_PATH/arvados-api-server-extras/postinst.sh" "$WORKSPACE/services/api/=/var/www/arvados-api/current" "$RUN_BUILD_PACKAGES_PATH/arvados-api-server-extras/arvados-api-server-upgrade.sh=/usr/local/bin/arvados-api-server-upgrade.sh")
634 if [[ "$DEBUG" != 0 ]]; then
636 echo "${COMMAND_ARR[@]}"
640 FPM_RESULTS=$("${COMMAND_ARR[@]}")
642 fpm_verify $FPM_EXIT_CODE $FPM_RESULTS
645 # Build the 'bare' package without vendor/bundle.
646 declare -a COMMAND_ARR=("fpm" "--maintainer=Ward Vandewege <ward@curoverse.com>" "--vendor='Curoverse, Inc.'" "--url='https://arvados.org'" "--description='Arvados API server - Arvados is a free and open source platform for big data science.'" "--license='GNU Affero General Public License, version 3.0'" "-s" "dir" "-t" "$FORMAT" "-n" "${PACKAGE_NAME}" "-v" "$API_VERSION" "-x" "var/www/arvados-api/current/tmp" "-x" "var/www/arvados-api/current/log" "-x" "var/www/arvados-api/current/vendor/bundle" "-x" "var/www/arvados-api/current/vendor/cache/*" "-x" "var/www/arvados-api/current/coverage" "-x" "var/www/arvados-api/current/Capfile*" "-x" "var/www/arvados-api/current/config/deploy*" "--after-install=$RUN_BUILD_PACKAGES_PATH/arvados-api-server-extras/postinst.sh" "$WORKSPACE/services/api/=/var/www/arvados-api/current" "$RUN_BUILD_PACKAGES_PATH/arvados-api-server-extras/arvados-api-server-upgrade.sh=/usr/local/bin/arvados-api-server-upgrade.sh")
648 if [[ "$DEBUG" != 0 ]]; then
650 echo "${COMMAND_ARR[@]}"
654 FPM_RESULTS=$("${COMMAND_ARR[@]}")
656 fpm_verify $FPM_EXIT_CODE $FPM_RESULTS
658 # API server package build done
660 # Build the workbench server package
662 cd "$WORKSPACE/apps/workbench"
664 WORKBENCH_VERSION=$(version_from_git)
665 PACKAGE_NAME=arvados-workbench
667 if [[ ! -d "$WORKSPACE/apps/workbench/tmp" ]]; then
668 mkdir $WORKSPACE/apps/workbench/tmp
671 BUNDLE_OUTPUT=`bundle install --path vendor/bundle`
673 if [[ "$DEBUG" != 0 ]]; then
677 /usr/bin/git rev-parse HEAD > git-commit.version
679 # clear the tmp directory; the asset generation step will recreate tmp/cache/assets,
680 # and we want that in the package, so it's easier to not exclude the tmp directory
681 # from the package - empty it instead.
682 rm -rf $WORKSPACE/apps/workbench/tmp/*
684 # Set up application.yml and production.rb so that asset precompilation works
685 \cp config/application.yml.example config/application.yml -f
686 \cp config/environments/production.rb.example config/environments/production.rb -f
687 sed -i 's/secret_token: ~/secret_token: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/' config/application.yml
689 RAILS_ENV=production RAILS_GROUPS=assets bundle exec rake assets:precompile >/dev/null
691 if [[ "$?" != "0" ]]; then
692 echo "ERROR: Asset precompilation failed"
696 cd $WORKSPACE/packages/$TARGET
698 # This is the complete package with vendor/bundle included.
699 # It's big, so we do not build it by default.
700 if [[ "$BUILD_BUNDLE_PACKAGES" != 0 ]]; then
702 declare -a COMMAND_ARR=("fpm" "--maintainer=Ward Vandewege <ward@curoverse.com>" "--vendor='Curoverse, Inc.'" "--url='https://arvados.org'" "--description='Arvados Workbench - Arvados is a free and open source platform for big data science.'" "--license='GNU Affero General Public License, version 3.0'" "-s" "dir" "-t" "$FORMAT" "-n" "${PACKAGE_NAME}-with-bundle" "-v" "$WORKBENCH_VERSION" "-x" "var/www/arvados-workbench/current/log" "-x" "var/www/arvados-workbench/current/vendor/cache/*" "-x" "var/www/arvados-workbench/current/coverage" "-x" "var/www/arvados-workbench/current/Capfile*" "-x" "var/www/arvados-workbench/current/config/deploy*" "--after-install=$RUN_BUILD_PACKAGES_PATH/arvados-workbench-extras/postinst.sh" "$WORKSPACE/apps/workbench/=/var/www/arvados-workbench/current" "$RUN_BUILD_PACKAGES_PATH/arvados-workbench-extras/arvados-workbench-upgrade.sh=/usr/local/bin/arvados-workbench-upgrade.sh")
704 if [[ "$DEBUG" != 0 ]]; then
706 echo "${COMMAND_ARR[@]}"
710 FPM_RESULTS=$("${COMMAND_ARR[@]}")
712 fpm_verify $FPM_EXIT_CODE $FPM_RESULTS
715 # Build the 'bare' package without vendor/bundle.
717 declare -a COMMAND_ARR=("fpm" "--maintainer=Ward Vandewege <ward@curoverse.com>" "--vendor='Curoverse, Inc.'" "--url='https://arvados.org'" "--description='Arvados Workbench - Arvados is a free and open source platform for big data science.'" "--license='GNU Affero General Public License, version 3.0'" "-s" "dir" "-t" "$FORMAT" "-n" "${PACKAGE_NAME}" "-v" "$WORKBENCH_VERSION" "-x" "var/www/arvados-workbench/current/log" "-x" "var/www/arvados-workbench/current/vendor/bundle" "-x" "var/www/arvados-workbench/current/vendor/cache/*" "-x" "var/www/arvados-workbench/current/coverage" "-x" "var/www/arvados-workbench/current/Capfile*" "-x" "var/www/arvados-workbench/current/config/deploy*" "--after-install=$RUN_BUILD_PACKAGES_PATH/arvados-workbench-extras/postinst.sh" "$WORKSPACE/apps/workbench/=/var/www/arvados-workbench/current" "$RUN_BUILD_PACKAGES_PATH/arvados-workbench-extras/arvados-workbench-upgrade.sh=/usr/local/bin/arvados-workbench-upgrade.sh")
719 if [[ "$DEBUG" != 0 ]]; then
721 echo "${COMMAND_ARR[@]}"
725 FPM_RESULTS=$("${COMMAND_ARR[@]}")
727 fpm_verify $FPM_EXIT_CODE $FPM_RESULTS
729 # Workbench package build done
730 # clean up temporary GOPATH