4 read -rd "\000" helpmessage <<EOF
5 $(basename $0): Build Arvados packages and (optionally) upload them.
8 WORKSPACE=/path/to/arvados $(basename $0) [options]
13 Upload packages (default: false)
15 scp user for repository server (only required when --upload is specified)
17 scp host for repository server (only required when --upload is specified)
18 --build-bundle-packages (default: false)
19 Build api server and workbench packages with vendor/bundle included
21 Output debug information (default: false)
23 Distribution to build packages for (default: debian7)
25 WORKSPACE=path Path to the Arvados source tree to build packages from
34 BUILD_BUNDLE_PACKAGES=0
37 PARSEDOPTS=$(getopt --name "$0" --longoptions \
38 help,upload,scp-user:,scp-host:,build-bundle-packages,debug,target: \
44 eval set -- "$PARSEDOPTS"
45 while [ $# -gt 0 ]; do
48 echo >&2 "$helpmessage"
67 --build-bundle-packages)
68 BUILD_BUNDLE_PACKAGES=1
72 echo >&2 "$0: unrecognized argument '$2'. Try: $0 --help"
81 if [[ "$UPLOAD" != '0' && ("$SCPUSER" == '' || "$SCPHOST" == '') ]]; then
82 echo >&2 "$helpmessage"
84 echo >&2 "Error: please specify --scp-user and --scp-host if --upload is set"
89 declare -a PYTHON_BACKPORTS PYTHON3_BACKPORTS
92 PYTHON3_VERSION=$(python3 -c 'import sys; print("{v.major}.{v.minor}".format(v=sys.version_info))')
98 REPO_UPDATE_CMD='freight add *deb apt/wheezy && freight cache && rm -f *deb'
100 PYTHON2_PACKAGE=python$PYTHON2_VERSION
101 PYTHON3_PACKAGE=python$PYTHON3_VERSION
102 PYTHON_BACKPORTS=(python-gflags pyvcf google-api-python-client \
103 oauth2client pyasn1 pyasn1-modules rsa uritemplate httplib2 ws4py \
104 virtualenv pykka apache-libcloud requests six pyexecjs jsonschema \
105 ciso8601 pycrypto backports.ssl_match_hostname pycurl)
106 PYTHON3_BACKPORTS=(docker-py six requests)
111 REPO_UPDATE_CMD='mv *rpm /var/www/rpm.arvados.org/CentOS/6/os/x86_64/ && createrepo /var/www/rpm.arvados.org/CentOS/6/os/x86_64/'
113 PYTHON2_PACKAGE=$(rpm -qf "$(which python$PYTHON2_VERSION)" --queryformat '%{NAME}\n')
114 PYTHON3_PACKAGE=$(rpm -qf "$(which python$PYTHON3_VERSION)" --queryformat '%{NAME}\n')
115 PYTHON_BACKPORTS=(python-gflags pyvcf google-api-python-client \
116 oauth2client pyasn1 pyasn1-modules rsa uritemplate httplib2 ws4py \
117 virtualenv pykka apache-libcloud requests six pyexecjs jsonschema \
118 ciso8601 pycrypto backports.ssl_match_hostname pycurl)
119 PYTHON3_BACKPORTS=(docker-py six requests)
120 export PYCURL_SSL_LIBRARY=nss
123 echo -e "$0: Unknown target '$TARGET'.\n" >&2
129 if ! [[ -n "$WORKSPACE" ]]; then
130 echo >&2 "$helpmessage"
132 echo >&2 "Error: WORKSPACE environment variable not set"
138 fpm --version >/dev/null 2>&1
140 if [[ "$?" != 0 ]]; then
141 echo >&2 "$helpmessage"
143 echo >&2 "Error: fpm not found"
148 find_easy_install() {
149 for version_suffix in "$@"; do
150 if "easy_install$version_suffix" --version >/dev/null 2>&1; then
151 echo "easy_install$version_suffix"
158 Error: easy_install$1 (from Python setuptools module) not found
164 EASY_INSTALL2=$(find_easy_install -$PYTHON2_VERSION "")
165 EASY_INSTALL3=$(find_easy_install -$PYTHON3_VERSION 3)
167 RUN_BUILD_PACKAGES_PATH="`dirname \"$0\"`"
168 RUN_BUILD_PACKAGES_PATH="`( cd \"$RUN_BUILD_PACKAGES_PATH\" && pwd )`" # absolutized and normalized
169 if [ -z "$RUN_BUILD_PACKAGES_PATH" ] ; then
170 # error; for some reason, the path is not accessible
171 # to the script (e.g. permissions re-evaled after suid)
175 if [[ "$DEBUG" != 0 ]]; then
176 echo "$0 is running from $RUN_BUILD_PACKAGES_PATH"
177 echo "Workspace is $WORKSPACE"
181 # Generates a version number from the git log for the current working
182 # directory, and writes it to stdout.
183 local git_ts git_hash
184 declare $(TZ=UTC git log -n1 --first-parent --max-count=1 \
185 --format=format:"git_ts=%ct git_hash=%h" .)
186 echo "0.1.$(date -ud "@$git_ts" +%Y%m%d%H%M%S).$git_hash"
189 timestamp_from_git() {
190 # Generates a version number from the git log for the current working
191 # directory, and writes it to stdout.
192 local git_ts git_hash
193 declare $(TZ=UTC git log -n1 --first-parent --max-count=1 \
194 --format=format:"git_ts=%ct git_hash=%h" .)
198 handle_python_package () {
199 # This function assumes the current working directory is the python package directory
200 if [[ "$UPLOAD" != 0 ]]; then
201 # Make sure only to use sdist - that's the only format pip can deal with (sigh)
202 if [[ "$DEBUG" != 0 ]]; then
203 python setup.py sdist upload
205 python setup.py -q sdist upload
208 # Make sure only to use sdist - that's the only format pip can deal with (sigh)
209 if [[ "$DEBUG" != 0 ]]; then
210 python setup.py sdist
212 python setup.py -q sdist
217 # Build debs for everything
218 fpm_build_and_scp () {
219 # The package source. Depending on the source type, this can be a
220 # path, or the name of the package in an upstream repository (e.g.,
224 # The name of the package to build. Defaults to $PACKAGE.
225 PACKAGE_NAME=${1:-$PACKAGE}
227 # Optional: the vendor of the package. Should be "Curoverse, Inc." for
228 # packages of our own software. Passed to fpm --vendor.
231 # The type of source package. Passed to fpm -s. Default "python".
232 PACKAGE_TYPE=${1:-python}
234 # Optional: the package version number. Passed to fpm -v.
238 case "$PACKAGE_TYPE" in
240 # All Arvados Python2 packages depend on Python 2.7.
241 # Make sure we build with that for consistency.
242 set -- "$@" --python-bin python2.7 \
243 --python-easyinstall "$EASY_INSTALL2"
246 # fpm does not actually support a python3 package type. Instead
247 # we recognize it as a convenience shortcut to add several
248 # necessary arguments to fpm's command line later, after we're
249 # done handling positional arguments.
251 set -- "$@" --python-bin python3 \
252 --python-easyinstall "$EASY_INSTALL3" \
253 --python-package-name-prefix python3 --depends "$PYTHON3_PACKAGE"
257 declare -a COMMAND_ARR=("fpm" "--maintainer=Ward Vandewege <ward@curoverse.com>" "-s" "$PACKAGE_TYPE" "-t" "$FORMAT" "-x" "usr/local/lib/python2.7/dist-packages/tests")
259 if [[ "$PACKAGE_NAME" != "$PACKAGE" ]]; then
260 COMMAND_ARR+=('-n' "$PACKAGE_NAME")
263 if [[ "$VENDOR" != "" ]]; then
264 COMMAND_ARR+=('--vendor' "$VENDOR")
267 if [[ "$VERSION" != "" ]]; then
268 COMMAND_ARR+=('-v' "$VERSION")
271 # Append remaining function arguments directly to fpm's command line.
276 COMMAND_ARR+=("$PACKAGE")
278 if [[ "$DEBUG" != 0 ]]; then
280 echo "${COMMAND_ARR[@]}"
284 FPM_RESULTS=$("${COMMAND_ARR[@]}")
287 fpm_verify_and_scp $FPM_EXIT_CODE $FPM_RESULTS
290 # verify build results and scp debs, if needed
291 fpm_verify_and_scp () {
297 if [[ $FPM_RESULTS =~ ([A-Za-z0-9_\-.]*\.)(deb|rpm) ]]; then
298 FPM_PACKAGE_NAME=${BASH_REMATCH[1]}${BASH_REMATCH[2]}
301 if [[ "$FPM_PACKAGE_NAME" == "" ]]; then
303 echo "Error: $PACKAGE: Unable to figure out package name from fpm results:"
308 if [[ ! $FPM_RESULTS =~ "File already exists" ]]; then
309 if [[ "$FPM_EXIT_CODE" != "0" ]]; then
310 echo "Error building package for $1:\n $FPM_RESULTS"
312 if [[ "$UPLOAD" != 0 ]]; then
313 scp -P2222 $FPM_PACKAGE_NAME $SCPUSER@$SCPHOST:$FPM_OUTDIR/
318 echo "Package $FPM_PACKAGE_NAME exists, not rebuilding"
323 if [[ -f /etc/profile.d/rvm.sh ]]; then
324 source /etc/profile.d/rvm.sh
327 # Make all files world-readable -- jenkins runs with umask 027, and has checked
328 # out our git tree here
329 chmod o+r "$WORKSPACE" -R
331 # More cleanup - make sure all executables that we'll package are 755
332 find -type d -name 'bin' |xargs -I {} find {} -type f |xargs -I {} chmod 755 {}
334 # Now fix our umask to something better suited to building and publishing
338 if [[ "$DEBUG" != 0 ]]; then
339 echo "umask is" `umask`
342 if [[ ! -d "$WORKSPACE/debs" ]]; then
343 mkdir -p $WORKSPACE/debs
347 if [[ "$DEBUG" != 0 ]]; then
348 echo -e "\nPerl packages\n"
351 if [[ "$DEBUG" != 0 ]]; then
357 cd "$WORKSPACE/sdk/perl"
359 if [[ -e Makefile ]]; then
360 make realclean >"$PERL_OUT"
362 find -maxdepth 1 \( -name 'MANIFEST*' -or -name "libarvados-perl*.$FORMAT" \) \
366 perl Makefile.PL INSTALL_BASE=install >"$PERL_OUT" && \
367 make install INSTALLDIRS=perl >"$PERL_OUT" && \
368 fpm_build_and_scp install/lib/=/usr/share libarvados-perl \
369 "Curoverse, Inc." dir "$(version_from_git)" install/man/=/usr/share/man && \
370 mv libarvados-perl*.$FORMAT "$WORKSPACE/debs/"
373 if [[ "$DEBUG" != 0 ]]; then
379 if type rvm-exec >/dev/null 2>&1; then
380 FPM_GEM_PREFIX=$(rvm-exec system gem environment gemdir)
382 FPM_GEM_PREFIX=$(gem environment gemdir)
388 ARVADOS_GEM_EPOCH=`git log -n1 --first-parent --format=%ct`
389 ARVADOS_GEM_DATE=`date --utc --date="@${ARVADOS_GEM_EPOCH}" +%Y%m%d%H%M%S`
390 ARVADOS_GEM_VERSION="0.1.${ARVADOS_GEM_DATE}"
392 # see if this gem needs building/uploading
393 gem search arvados -r -a |grep -q $ARVADOS_GEM_VERSION
395 if [[ "$?" != "0" ]]; then
396 # clean up old packages
397 find -maxdepth 1 \( -name 'arvados-*.gem' -or -name 'rubygem-arvados_*.deb' -or -name 'rubygem-arvados_*.rpm' \) \
400 if [[ "$DEBUG" != 0 ]]; then
401 gem build arvados.gemspec
403 # -q appears to be broken in gem version 2.2.2
404 gem build arvados.gemspec -q >/dev/null 2>&1
407 if [[ "$UPLOAD" != 0 ]]; then
409 gem push arvados-*gem
412 fpm_build_and_scp arvados-*.gem "" "Curoverse, Inc." gem "" \
413 --prefix "$FPM_GEM_PREFIX"
416 # Build arvados-cli GEM
420 ARVADOS_CLI_GEM_EPOCH=`git log -n1 --first-parent --format=%ct`
421 ARVADOS_CLI_GEM_DATE=`date --utc --date="@${ARVADOS_CLI_GEM_EPOCH}" +%Y%m%d%H%M%S`
422 ARVADOS_CLI_GEM_VERSION="0.1.${ARVADOS_CLI_GEM_DATE}"
424 # see if this gem needs building/uploading
425 gem search arvados-cli -r -a |grep -q $ARVADOS_GEM_VERSION
427 if [[ "$?" != "0" ]]; then
429 rm -f arvados-cli*gem
431 if [[ "$DEBUG" != 0 ]]; then
432 gem build arvados-cli.gemspec
434 # -q appears to be broken in gem version 2.2.2
435 gem build arvados-cli.gemspec -q >/dev/null
438 if [[ "$UPLOAD" != 0 ]]; then
440 gem push arvados-cli*gem
445 if [[ "$DEBUG" != 0 ]]; then
447 echo "Python packages"
454 handle_python_package
456 cd ../../services/fuse
457 handle_python_package
459 cd ../../services/nodemanager
460 handle_python_package
463 # We use $WORKSPACE/src-build-dir as the clean directory from which to build the src package
464 if [[ ! -d "$WORKSPACE/src-build-dir" ]]; then
465 mkdir "$WORKSPACE/src-build-dir"
467 if [[ "$DEBUG" != 0 ]]; then
468 git clone https://github.com/curoverse/arvados.git src-build-dir
470 git clone -q https://github.com/curoverse/arvados.git src-build-dir
474 cd "$WORKSPACE/src-build-dir"
475 # just in case, check out master
476 if [[ "$DEBUG" != 0 ]]; then
479 # go into detached-head state
480 git checkout `git log --format=format:%h -n1 .`
482 git checkout -q master
484 # go into detached-head state
485 git checkout -q `git log --format=format:%h -n1 .`
488 git log --format=format:%H -n1 . > git-commit.version
490 # Build arvados src deb package
492 PKG_VERSION=$(version_from_git)
494 fpm_build_and_scp $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"
496 # clean up, check out master and step away from detached-head state
497 cd "$WORKSPACE/src-build-dir"
498 if [[ "$DEBUG" != 0 ]]; then
501 git checkout -q master
505 export GOPATH=$(mktemp -d)
506 mkdir -p "$GOPATH/src/git.curoverse.com"
507 ln -sfn "$WORKSPACE" "$GOPATH/src/git.curoverse.com/arvados.git"
510 cd "$GOPATH/src/git.curoverse.com/arvados.git/services/keepstore"
511 PKG_VERSION=$(version_from_git)
512 go get "git.curoverse.com/arvados.git/services/keepstore"
514 fpm_build_and_scp $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"
517 cd "$GOPATH/src/git.curoverse.com/arvados.git/sdk/go"
518 GO_SDK_VERSION=$(version_from_git)
519 GO_SDK_TIMESTAMP=$(timestamp_from_git)
522 cd "$GOPATH/src/git.curoverse.com/arvados.git/services/keepproxy"
523 KEEPPROXY_VERSION=$(version_from_git)
524 KEEPPROXY_TIMESTAMP=$(timestamp_from_git)
526 if [[ "$GO_SDK_TIMESTAMP" -gt "$KEEPPROXY_TIMESTAMP" ]]; then
527 PKG_VERSION=$GO_SDK_VERSION
529 PKG_VERSION=$KEEPPROXY_VERSION
532 go get "git.curoverse.com/arvados.git/services/keepproxy"
534 fpm_build_and_scp $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"
537 cd "$GOPATH/src/git.curoverse.com/arvados.git/services/datamanager"
538 DATAMANAGER_VERSION=$(version_from_git)
539 DATAMANAGER_TIMESTAMP=$(timestamp_from_git)
541 if [[ "$GO_SDK_TIMESTAMP" -gt "$DATAMANAGER_TIMESTAMP" ]]; then
542 PKG_VERSION=$GO_SDK_VERSION
544 PKG_VERSION=$DATAMANAGER_VERSION
547 go get "git.curoverse.com/arvados.git/services/datamanager"
549 fpm_build_and_scp $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."
552 cd "$GOPATH/src/git.curoverse.com/arvados.git/services/arv-git-httpd"
553 ARVGITHTTPD_VERSION=$(version_from_git)
554 ARVGITHTTPD_TIMESTAMP=$(timestamp_from_git)
556 if [[ "$GO_SDK_TIMESTAMP" -gt "$ARVGITHTTPD_TIMESTAMP" ]]; then
557 PKG_VERSION=$GO_SDK_VERSION
559 PKG_VERSION=$ARVGITHTTPD_VERSION
562 go get "git.curoverse.com/arvados.git/services/arv-git-httpd"
564 fpm_build_and_scp $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."
567 cd "$GOPATH/src/git.curoverse.com/arvados.git/services/crunchstat"
568 PKG_VERSION=$(version_from_git)
569 go get "git.curoverse.com/arvados.git/services/crunchstat"
571 fpm_build_and_scp $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"
574 # Please resist the temptation to add --no-python-fix-name to the fpm call here
575 # (which would remove the python- prefix from the package name), because this
576 # package is a dependency of arvados-fuse, and fpm can not omit the python-
577 # prefix from only one of the dependencies of a package... Maybe I could
578 # whip up a patch and send it upstream, but that will be for another day. Ward,
581 fpm_build_and_scp $WORKSPACE/sdk/python python-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" --depends="$PYTHON2_PACKAGE"
584 # Please see comment about --no-python-fix-name above; we stay consistent and do
585 # not omit the python- prefix first.
587 fpm_build_and_scp $WORKSPACE/services/fuse python-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" --depends="$PYTHON2_PACKAGE"
591 fpm_build_and_scp $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" --depends="$PYTHON2_PACKAGE"
593 # The Docker image cleaner
595 fpm_build_and_scp $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"
598 for deppkg in "${PYTHON_BACKPORTS[@]}"; do
599 fpm_build_and_scp "$deppkg"
602 # Python 3 dependencies
603 for deppkg in "${PYTHON3_BACKPORTS[@]}"; do
604 # The empty string is the vendor argument: these aren't Curoverse software.
605 fpm_build_and_scp "$deppkg" "python3-$deppkg" "" python3
608 # Build the API server package
610 cd "$WORKSPACE/services/api"
612 API_VERSION=$(version_from_git)
613 PACKAGE_NAME=arvados-api-server
615 if [[ ! -d "$WORKSPACE/services/api/tmp" ]]; then
616 mkdir $WORKSPACE/services/api/tmp
619 BUNDLE_OUTPUT=`bundle install --path vendor/bundle`
621 if [[ "$DEBUG" != 0 ]]; then
625 /usr/bin/git rev-parse HEAD > git-commit.version
629 # Annoyingly, we require a database.yml file for rake assets:precompile to work. So for now,
630 # we do that in the upgrade script.
631 # TODO: add bogus database.yml file so we can precompile the assets and put them in the
632 # package. Then remove that database.yml file again. It has to be a valid file though.
633 #RAILS_ENV=production RAILS_GROUPS=assets bundle exec rake assets:precompile
635 # This is the complete package with vendor/bundle included.
636 # It's big, so we do not build it by default.
637 if [[ "$BUILD_BUNDLE_PACKAGES" != 0 ]]; then
638 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")
640 if [[ "$DEBUG" != 0 ]]; then
642 echo "${COMMAND_ARR[@]}"
646 FPM_RESULTS=$("${COMMAND_ARR[@]}")
648 fpm_verify_and_scp $FPM_EXIT_CODE $FPM_RESULTS
651 # Build the 'bare' package without vendor/bundle.
652 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")
654 if [[ "$DEBUG" != 0 ]]; then
656 echo "${COMMAND_ARR[@]}"
660 FPM_RESULTS=$("${COMMAND_ARR[@]}")
662 fpm_verify_and_scp $FPM_EXIT_CODE $FPM_RESULTS
664 # API server package build done
666 # Build the workbench server package
668 cd "$WORKSPACE/apps/workbench"
670 WORKBENCH_VERSION=$(version_from_git)
671 PACKAGE_NAME=arvados-workbench
673 if [[ ! -d "$WORKSPACE/apps/workbench/tmp" ]]; then
674 mkdir $WORKSPACE/apps/workbench/tmp
677 BUNDLE_OUTPUT=`bundle install --path vendor/bundle`
679 if [[ "$DEBUG" != 0 ]]; then
683 /usr/bin/git rev-parse HEAD > git-commit.version
685 # clear the tmp directory; the asset generation step will recreate tmp/cache/assets,
686 # and we want that in the package, so it's easier to not exclude the tmp directory
687 # from the package - empty it instead.
688 rm -rf $WORKSPACE/apps/workbench/tmp/*
690 # Set up application.yml so that asset precompilation works
691 \cp config/application.yml.example config/application.yml -f
692 sed -i 's/secret_token: ~/secret_token: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/' config/application.yml
694 RAILS_ENV=production RAILS_GROUPS=assets bundle exec rake assets:precompile >/dev/null
696 if [[ "$?" != "0" ]]; then
697 echo "ERROR: Asset precompilation failed"
703 # This is the complete package with vendor/bundle included.
704 # It's big, so we do not build it by default.
705 if [[ "$BUILD_BUNDLE_PACKAGES" != 0 ]]; then
707 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")
709 if [[ "$DEBUG" != 0 ]]; then
711 echo "${COMMAND_ARR[@]}"
715 FPM_RESULTS=$("${COMMAND_ARR[@]}")
717 fpm_verify_and_scp $FPM_EXIT_CODE $FPM_RESULTS
720 # Build the 'bare' package without vendor/bundle.
722 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")
724 if [[ "$DEBUG" != 0 ]]; then
726 echo "${COMMAND_ARR[@]}"
730 FPM_RESULTS=$("${COMMAND_ARR[@]}")
732 fpm_verify_and_scp $FPM_EXIT_CODE $FPM_RESULTS
734 # Workbench package build done
736 # Finally, publish the packages, if necessary
737 if [[ "$UPLOAD" != 0 && "$CALL_FREIGHT" != 0 ]]; then
738 ssh -p2222 $SCPUSER@$SCPHOST -t bash - <<EOF
739 if [ -n "\$(find -name "$FPM_OUTDIR/*.$FORMAT" -print -quit)" ]; then
740 cd "$FPM_OUTDIR" && $REPO_UPDATE_CMD
744 if [[ "$UPLOAD" != 0 ]]; then
745 echo "No new packages generated. No freight run necessary."
749 # clean up temporary GOPATH