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"
430 handle_python_package
432 cd ../../services/fuse
433 handle_python_package
435 cd ../../services/nodemanager
436 handle_python_package
439 # We use $WORKSPACE/src-build-dir as the clean directory from which to build the src package
440 if [[ ! -d "$WORKSPACE/src-build-dir" ]]; then
441 mkdir "$WORKSPACE/src-build-dir"
443 if [[ "$DEBUG" != 0 ]]; then
444 git clone https://github.com/curoverse/arvados.git src-build-dir
446 git clone -q https://github.com/curoverse/arvados.git src-build-dir
450 cd "$WORKSPACE/src-build-dir"
451 # just in case, check out master
452 if [[ "$DEBUG" != 0 ]]; then
455 # go into detached-head state
456 MASTER_COMMIT_HASH=$(format_last_commit_here "%H")
457 git checkout "$MASTER_COMMIT_HASH"
459 git checkout -q master
461 # go into detached-head state
462 MASTER_COMMIT_HASH=$(format_last_commit_here "%H")
463 git checkout -q "$MASTER_COMMIT_HASH"
465 echo "$MASTER_COMMIT_HASH" >git-commit.version
467 # Build arvados src deb package
469 PKG_VERSION=$(version_from_git)
470 cd $WORKSPACE/packages/$TARGET
471 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"
473 # clean up, check out master and step away from detached-head state
474 cd "$WORKSPACE/src-build-dir"
475 if [[ "$DEBUG" != 0 ]]; then
478 git checkout -q master
482 export GOPATH=$(mktemp -d)
483 mkdir -p "$GOPATH/src/git.curoverse.com"
484 ln -sfn "$WORKSPACE" "$GOPATH/src/git.curoverse.com/arvados.git"
487 cd "$GOPATH/src/git.curoverse.com/arvados.git/services/keepstore"
488 PKG_VERSION=$(version_from_git)
489 go get "git.curoverse.com/arvados.git/services/keepstore"
490 cd $WORKSPACE/packages/$TARGET
491 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"
494 cd "$GOPATH/src/git.curoverse.com/arvados.git/sdk/go"
495 GO_SDK_VERSION=$(version_from_git)
496 GO_SDK_TIMESTAMP=$(timestamp_from_git)
499 cd "$GOPATH/src/git.curoverse.com/arvados.git/services/keepproxy"
500 KEEPPROXY_VERSION=$(version_from_git)
501 KEEPPROXY_TIMESTAMP=$(timestamp_from_git)
503 if [[ "$GO_SDK_TIMESTAMP" -gt "$KEEPPROXY_TIMESTAMP" ]]; then
504 PKG_VERSION=$GO_SDK_VERSION
506 PKG_VERSION=$KEEPPROXY_VERSION
509 go get "git.curoverse.com/arvados.git/services/keepproxy"
510 cd $WORKSPACE/packages/$TARGET
511 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"
514 cd "$GOPATH/src/git.curoverse.com/arvados.git/services/datamanager"
515 DATAMANAGER_VERSION=$(version_from_git)
516 DATAMANAGER_TIMESTAMP=$(timestamp_from_git)
518 if [[ "$GO_SDK_TIMESTAMP" -gt "$DATAMANAGER_TIMESTAMP" ]]; then
519 PKG_VERSION=$GO_SDK_VERSION
521 PKG_VERSION=$DATAMANAGER_VERSION
524 go get "git.curoverse.com/arvados.git/services/datamanager"
525 cd $WORKSPACE/packages/$TARGET
526 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."
529 cd "$GOPATH/src/git.curoverse.com/arvados.git/services/arv-git-httpd"
530 ARVGITHTTPD_VERSION=$(version_from_git)
531 ARVGITHTTPD_TIMESTAMP=$(timestamp_from_git)
533 if [[ "$GO_SDK_TIMESTAMP" -gt "$ARVGITHTTPD_TIMESTAMP" ]]; then
534 PKG_VERSION=$GO_SDK_VERSION
536 PKG_VERSION=$ARVGITHTTPD_VERSION
539 go get "git.curoverse.com/arvados.git/services/arv-git-httpd"
540 cd $WORKSPACE/packages/$TARGET
541 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."
544 cd "$GOPATH/src/git.curoverse.com/arvados.git/services/crunchstat"
545 PKG_VERSION=$(version_from_git)
546 go get "git.curoverse.com/arvados.git/services/crunchstat"
547 cd $WORKSPACE/packages/$TARGET
548 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"
551 # Please resist the temptation to add --no-python-fix-name to the fpm call here
552 # (which would remove the python- prefix from the package name), because this
553 # package is a dependency of arvados-fuse, and fpm can not omit the python-
554 # prefix from only one of the dependencies of a package... Maybe I could
555 # whip up a patch and send it upstream, but that will be for another day. Ward,
557 cd $WORKSPACE/packages/$TARGET
558 rm -rf "$WORKSPACE/sdk/python/build"
559 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
562 # Please see comment about --no-python-fix-name above; we stay consistent and do
563 # not omit the python- prefix first.
564 cd $WORKSPACE/packages/$TARGET
565 rm -rf "$WORKSPACE/services/fuse/build"
566 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"
569 cd $WORKSPACE/packages/$TARGET
570 rm -rf "$WORKSPACE/services/nodemanager/build"
571 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"
573 # The Docker image cleaner
574 cd $WORKSPACE/packages/$TARGET
575 rm -rf "$WORKSPACE/services/dockercleaner/build"
576 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"
579 for deppkg in "${PYTHON_BACKPORTS[@]}"; do
580 outname=$(echo "$deppkg" | sed -e 's/^python-//' -e 's/[<=>].*//' -e 's/_/-/g' -e "s/^/${PYTHON2_PKG_PREFIX}-/")
581 fpm_build "$deppkg" "$outname"
584 # Python 3 dependencies
585 for deppkg in "${PYTHON3_BACKPORTS[@]}"; do
586 outname=$(echo "$deppkg" | sed -e 's/^python-//' -e 's/[<=>].*//' -e 's/_/-/g' -e "s/^/${PYTHON3_PKG_PREFIX}-/")
587 # The empty string is the vendor argument: these aren't Curoverse software.
588 fpm_build "$deppkg" "$outname" "" python3
592 cd $WORKSPACE/sdk/pam
593 PKG_VERSION=$(version_from_git)
594 cd $WORKSPACE/packages/$TARGET
596 if [[ "$FORMAT" == "deb" ]]; then
597 fpm_build $WORKSPACE/sdk/pam/debian/shellinabox=/etc/pam.d/shellinabox libpam-arvados 'Curoverse, Inc.' 'dir' "$PKG_VERSION" "--url=https://arvados.org" "--license=Apache License, Version 2.0" "--description=PAM module for Arvados" "--config-files=/etc/default" "-d libpam-python" $WORKSPACE/sdk/pam/arvados_pam.py=/usr/bin/arvados_pam.py $WORKSPACE/sdk/pam/debian/arvados_pam=/etc/default/arvados_pam
599 # FIXME enable and test once we have the centos pam.d file
600 #fpm_build $WORKSPACE/sdk/pam/centos/shellinabox=/etc/pam.d/shellinabox libpam-arvados 'Curoverse, Inc.' 'dir' "$PKG_VERSION" "--url=https://arvados.org" "--license=Apache License, Version 2.0" "--description=PAM module for Arvados" "--config-files=/etc/default" "-d libpam-python" $WORKSPACE/sdk/pam/arvados_pam.py=/usr/bin/arvados_pam.py $WORKSPACE/sdk/pam/centos/arvados_pam=/etc/default/arvados_pam
603 # Build the API server package
605 cd "$WORKSPACE/services/api"
607 API_VERSION=$(version_from_git)
608 PACKAGE_NAME=arvados-api-server
610 if [[ ! -d "$WORKSPACE/services/api/tmp" ]]; then
611 mkdir $WORKSPACE/services/api/tmp
614 BUNDLE_OUTPUT=`bundle install --path vendor/bundle`
616 if [[ "$DEBUG" != 0 ]]; then
620 /usr/bin/git rev-parse HEAD > git-commit.version
622 cd $WORKSPACE/packages/$TARGET
624 # Annoyingly, we require a database.yml file for rake assets:precompile to work. So for now,
625 # we do that in the upgrade script.
626 # TODO: add bogus database.yml file so we can precompile the assets and put them in the
627 # package. Then remove that database.yml file again. It has to be a valid file though.
628 #RAILS_ENV=production RAILS_GROUPS=assets bundle exec rake assets:precompile
630 # This is the complete package with vendor/bundle included.
631 # It's big, so we do not build it by default.
632 if [[ "$BUILD_BUNDLE_PACKAGES" != 0 ]]; then
633 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")
635 if [[ "$DEBUG" != 0 ]]; then
637 echo "${COMMAND_ARR[@]}"
641 FPM_RESULTS=$("${COMMAND_ARR[@]}")
643 fpm_verify $FPM_EXIT_CODE $FPM_RESULTS
646 # Build the 'bare' package without vendor/bundle.
647 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")
649 if [[ "$DEBUG" != 0 ]]; then
651 echo "${COMMAND_ARR[@]}"
655 FPM_RESULTS=$("${COMMAND_ARR[@]}")
657 fpm_verify $FPM_EXIT_CODE $FPM_RESULTS
659 # API server package build done
661 # Build the workbench server package
663 cd "$WORKSPACE/apps/workbench"
665 WORKBENCH_VERSION=$(version_from_git)
666 PACKAGE_NAME=arvados-workbench
668 if [[ ! -d "$WORKSPACE/apps/workbench/tmp" ]]; then
669 mkdir $WORKSPACE/apps/workbench/tmp
672 BUNDLE_OUTPUT=`bundle install --path vendor/bundle`
674 if [[ "$DEBUG" != 0 ]]; then
678 /usr/bin/git rev-parse HEAD > git-commit.version
680 # clear the tmp directory; the asset generation step will recreate tmp/cache/assets,
681 # and we want that in the package, so it's easier to not exclude the tmp directory
682 # from the package - empty it instead.
683 rm -rf $WORKSPACE/apps/workbench/tmp/*
685 # Set up application.yml and production.rb so that asset precompilation works
686 \cp config/application.yml.example config/application.yml -f
687 \cp config/environments/production.rb.example config/environments/production.rb -f
688 sed -i 's/secret_token: ~/secret_token: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/' config/application.yml
690 RAILS_ENV=production RAILS_GROUPS=assets bundle exec rake assets:precompile >/dev/null
692 if [[ "$?" != "0" ]]; then
693 echo "ERROR: Asset precompilation failed"
697 cd $WORKSPACE/packages/$TARGET
699 # This is the complete package with vendor/bundle included.
700 # It's big, so we do not build it by default.
701 if [[ "$BUILD_BUNDLE_PACKAGES" != 0 ]]; then
703 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")
705 if [[ "$DEBUG" != 0 ]]; then
707 echo "${COMMAND_ARR[@]}"
711 FPM_RESULTS=$("${COMMAND_ARR[@]}")
713 fpm_verify $FPM_EXIT_CODE $FPM_RESULTS
716 # Build the 'bare' package without vendor/bundle.
718 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")
720 if [[ "$DEBUG" != 0 ]]; then
722 echo "${COMMAND_ARR[@]}"
726 FPM_RESULTS=$("${COMMAND_ARR[@]}")
728 fpm_verify $FPM_EXIT_CODE $FPM_RESULTS
730 # Workbench package build done
731 # clean up temporary GOPATH