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==0.1.7 pyasn1-modules==0.0.5 \
104 rsa uritemplate httplib2 ws4py \
105 virtualenv pykka apache-libcloud requests six pyexecjs jsonschema \
106 ciso8601 pycrypto backports.ssl_match_hostname pycurl)
107 PYTHON3_BACKPORTS=(docker-py six requests)
112 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/'
114 PYTHON2_PACKAGE=$(rpm -qf "$(which python$PYTHON2_VERSION)" --queryformat '%{NAME}\n')
115 PYTHON3_PACKAGE=$(rpm -qf "$(which python$PYTHON3_VERSION)" --queryformat '%{NAME}\n')
116 PYTHON_BACKPORTS=(python-gflags pyvcf google-api-python-client \
117 oauth2client pyasn1==0.1.7 pyasn1-modules==0.0.5 \
118 rsa uritemplate httplib2 ws4py \
119 pykka apache-libcloud requests six pyexecjs jsonschema \
120 ciso8601 pycrypto backports.ssl_match_hostname pycurl)
121 PYTHON3_BACKPORTS=(docker-py six requests)
122 export PYCURL_SSL_LIBRARY=nss
125 echo -e "$0: Unknown target '$TARGET'.\n" >&2
131 if ! [[ -n "$WORKSPACE" ]]; then
132 echo >&2 "$helpmessage"
134 echo >&2 "Error: WORKSPACE environment variable not set"
140 fpm --version >/dev/null 2>&1
142 if [[ "$?" != 0 ]]; then
143 echo >&2 "$helpmessage"
145 echo >&2 "Error: fpm not found"
150 find_easy_install() {
151 for version_suffix in "$@"; do
152 if "easy_install$version_suffix" --version >/dev/null 2>&1; then
153 echo "easy_install$version_suffix"
160 Error: easy_install$1 (from Python setuptools module) not found
166 EASY_INSTALL2=$(find_easy_install -$PYTHON2_VERSION "")
167 EASY_INSTALL3=$(find_easy_install -$PYTHON3_VERSION 3)
169 RUN_BUILD_PACKAGES_PATH="`dirname \"$0\"`"
170 RUN_BUILD_PACKAGES_PATH="`( cd \"$RUN_BUILD_PACKAGES_PATH\" && pwd )`" # absolutized and normalized
171 if [ -z "$RUN_BUILD_PACKAGES_PATH" ] ; then
172 # error; for some reason, the path is not accessible
173 # to the script (e.g. permissions re-evaled after suid)
177 if [[ "$DEBUG" != 0 ]]; then
178 echo "$0 is running from $RUN_BUILD_PACKAGES_PATH"
179 echo "Workspace is $WORKSPACE"
183 # Generates a version number from the git log for the current working
184 # directory, and writes it to stdout.
185 local git_ts git_hash
186 declare $(TZ=UTC git log -n1 --first-parent --max-count=1 \
187 --format=format:"git_ts=%ct git_hash=%h" .)
188 echo "0.1.$(date -ud "@$git_ts" +%Y%m%d%H%M%S).$git_hash"
191 timestamp_from_git() {
192 # Generates a version number from the git log for the current working
193 # directory, and writes it to stdout.
194 local git_ts git_hash
195 declare $(TZ=UTC git log -n1 --first-parent --max-count=1 \
196 --format=format:"git_ts=%ct git_hash=%h" .)
200 handle_python_package () {
201 # This function assumes the current working directory is the python package directory
202 if [[ "$UPLOAD" != 0 ]]; then
203 # Make sure only to use sdist - that's the only format pip can deal with (sigh)
204 if [[ "$DEBUG" != 0 ]]; then
205 python setup.py sdist upload
207 python setup.py -q sdist upload
210 # Make sure only to use sdist - that's the only format pip can deal with (sigh)
211 if [[ "$DEBUG" != 0 ]]; then
212 python setup.py sdist
214 python setup.py -q sdist
219 # Build debs for everything
220 fpm_build_and_scp () {
221 # The package source. Depending on the source type, this can be a
222 # path, or the name of the package in an upstream repository (e.g.,
226 # The name of the package to build. Defaults to $PACKAGE.
227 PACKAGE_NAME=${1:-$PACKAGE}
229 # Optional: the vendor of the package. Should be "Curoverse, Inc." for
230 # packages of our own software. Passed to fpm --vendor.
233 # The type of source package. Passed to fpm -s. Default "python".
234 PACKAGE_TYPE=${1:-python}
236 # Optional: the package version number. Passed to fpm -v.
240 case "$PACKAGE_TYPE" in
242 # All Arvados Python2 packages depend on Python 2.7.
243 # Make sure we build with that for consistency.
244 set -- "$@" --python-bin python2.7 \
245 --python-easyinstall "$EASY_INSTALL2"
248 # fpm does not actually support a python3 package type. Instead
249 # we recognize it as a convenience shortcut to add several
250 # necessary arguments to fpm's command line later, after we're
251 # done handling positional arguments.
253 set -- "$@" --python-bin python3 \
254 --python-easyinstall "$EASY_INSTALL3" \
255 --python-package-name-prefix python3 --depends "$PYTHON3_PACKAGE"
259 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")
261 if [[ "$PACKAGE_NAME" != "$PACKAGE" ]]; then
262 COMMAND_ARR+=('-n' "$PACKAGE_NAME")
265 if [[ "$VENDOR" != "" ]]; then
266 COMMAND_ARR+=('--vendor' "$VENDOR")
269 if [[ "$VERSION" != "" ]]; then
270 COMMAND_ARR+=('-v' "$VERSION")
273 # Append remaining function arguments directly to fpm's command line.
278 COMMAND_ARR+=("$PACKAGE")
280 if [[ "$DEBUG" != 0 ]]; then
282 echo "${COMMAND_ARR[@]}"
286 FPM_RESULTS=$("${COMMAND_ARR[@]}")
289 fpm_verify_and_scp $FPM_EXIT_CODE $FPM_RESULTS
292 # verify build results and scp debs, if needed
293 fpm_verify_and_scp () {
299 if [[ $FPM_RESULTS =~ ([A-Za-z0-9_\-.]*\.)(deb|rpm) ]]; then
300 FPM_PACKAGE_NAME=${BASH_REMATCH[1]}${BASH_REMATCH[2]}
303 if [[ "$FPM_PACKAGE_NAME" == "" ]]; then
305 echo "Error: $PACKAGE: Unable to figure out package name from fpm results:"
310 if [[ ! $FPM_RESULTS =~ "File already exists" ]]; then
311 if [[ "$FPM_EXIT_CODE" != "0" ]]; then
312 echo "Error building package for $1:\n $FPM_RESULTS"
314 if [[ "$UPLOAD" != 0 ]]; then
315 scp -P2222 $FPM_PACKAGE_NAME $SCPUSER@$SCPHOST:$FPM_OUTDIR/
320 echo "Package $FPM_PACKAGE_NAME exists, not rebuilding"
325 if [[ -f /etc/profile.d/rvm.sh ]]; then
326 source /etc/profile.d/rvm.sh
329 # Make all files world-readable -- jenkins runs with umask 027, and has checked
330 # out our git tree here
331 chmod o+r "$WORKSPACE" -R
333 # More cleanup - make sure all executables that we'll package are 755
334 find -type d -name 'bin' |xargs -I {} find {} -type f |xargs -I {} chmod 755 {}
336 # Now fix our umask to something better suited to building and publishing
340 if [[ "$DEBUG" != 0 ]]; then
341 echo "umask is" `umask`
344 if [[ ! -d "$WORKSPACE/debs" ]]; then
345 mkdir -p $WORKSPACE/debs
349 if [[ "$DEBUG" != 0 ]]; then
350 echo -e "\nPerl packages\n"
353 if [[ "$DEBUG" != 0 ]]; then
359 cd "$WORKSPACE/sdk/perl"
361 if [[ -e Makefile ]]; then
362 make realclean >"$PERL_OUT"
364 find -maxdepth 1 \( -name 'MANIFEST*' -or -name "libarvados-perl*.$FORMAT" \) \
368 perl Makefile.PL INSTALL_BASE=install >"$PERL_OUT" && \
369 make install INSTALLDIRS=perl >"$PERL_OUT" && \
370 fpm_build_and_scp install/lib/=/usr/share libarvados-perl \
371 "Curoverse, Inc." dir "$(version_from_git)" install/man/=/usr/share/man && \
372 mv libarvados-perl*.$FORMAT "$WORKSPACE/debs/"
375 if [[ "$DEBUG" != 0 ]]; then
381 if type rvm-exec >/dev/null 2>&1; then
382 FPM_GEM_PREFIX=$(rvm-exec system gem environment gemdir)
384 FPM_GEM_PREFIX=$(gem environment gemdir)
390 ARVADOS_GEM_EPOCH=`git log -n1 --first-parent --format=%ct`
391 ARVADOS_GEM_DATE=`date --utc --date="@${ARVADOS_GEM_EPOCH}" +%Y%m%d%H%M%S`
392 ARVADOS_GEM_VERSION="0.1.${ARVADOS_GEM_DATE}"
394 # see if this gem needs building/uploading
395 gem search arvados -r -a |grep -q $ARVADOS_GEM_VERSION
397 if [[ "$?" != "0" ]]; then
398 # clean up old packages
399 find -maxdepth 1 \( -name 'arvados-*.gem' -or -name 'rubygem-arvados_*.deb' -or -name 'rubygem-arvados_*.rpm' \) \
402 if [[ "$DEBUG" != 0 ]]; then
403 gem build arvados.gemspec
405 # -q appears to be broken in gem version 2.2.2
406 gem build arvados.gemspec -q >/dev/null 2>&1
409 if [[ "$UPLOAD" != 0 ]]; then
411 gem push arvados-*gem
414 fpm_build_and_scp arvados-*.gem "" "Curoverse, Inc." gem "" \
415 --prefix "$FPM_GEM_PREFIX"
418 # Build arvados-cli GEM
422 ARVADOS_CLI_GEM_EPOCH=`git log -n1 --first-parent --format=%ct`
423 ARVADOS_CLI_GEM_DATE=`date --utc --date="@${ARVADOS_CLI_GEM_EPOCH}" +%Y%m%d%H%M%S`
424 ARVADOS_CLI_GEM_VERSION="0.1.${ARVADOS_CLI_GEM_DATE}"
426 # see if this gem needs building/uploading
427 gem search arvados-cli -r -a |grep -q $ARVADOS_GEM_VERSION
429 if [[ "$?" != "0" ]]; then
431 rm -f arvados-cli*gem
433 if [[ "$DEBUG" != 0 ]]; then
434 gem build arvados-cli.gemspec
436 # -q appears to be broken in gem version 2.2.2
437 gem build arvados-cli.gemspec -q >/dev/null
440 if [[ "$UPLOAD" != 0 ]]; then
442 gem push arvados-cli*gem
447 if [[ "$DEBUG" != 0 ]]; then
449 echo "Python packages"
456 handle_python_package
458 cd ../../services/fuse
459 handle_python_package
461 cd ../../services/nodemanager
462 handle_python_package
465 # We use $WORKSPACE/src-build-dir as the clean directory from which to build the src package
466 if [[ ! -d "$WORKSPACE/src-build-dir" ]]; then
467 mkdir "$WORKSPACE/src-build-dir"
469 if [[ "$DEBUG" != 0 ]]; then
470 git clone https://github.com/curoverse/arvados.git src-build-dir
472 git clone -q https://github.com/curoverse/arvados.git src-build-dir
476 cd "$WORKSPACE/src-build-dir"
477 # just in case, check out master
478 if [[ "$DEBUG" != 0 ]]; then
481 # go into detached-head state
482 git checkout `git log --format=format:%h -n1 .`
484 git checkout -q master
486 # go into detached-head state
487 git checkout -q `git log --format=format:%h -n1 .`
490 git log --format=format:%H -n1 . > git-commit.version
492 # Build arvados src deb package
494 PKG_VERSION=$(version_from_git)
496 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"
498 # clean up, check out master and step away from detached-head state
499 cd "$WORKSPACE/src-build-dir"
500 if [[ "$DEBUG" != 0 ]]; then
503 git checkout -q master
507 export GOPATH=$(mktemp -d)
508 mkdir -p "$GOPATH/src/git.curoverse.com"
509 ln -sfn "$WORKSPACE" "$GOPATH/src/git.curoverse.com/arvados.git"
512 cd "$GOPATH/src/git.curoverse.com/arvados.git/services/keepstore"
513 PKG_VERSION=$(version_from_git)
514 go get "git.curoverse.com/arvados.git/services/keepstore"
516 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"
519 cd "$GOPATH/src/git.curoverse.com/arvados.git/sdk/go"
520 GO_SDK_VERSION=$(version_from_git)
521 GO_SDK_TIMESTAMP=$(timestamp_from_git)
524 cd "$GOPATH/src/git.curoverse.com/arvados.git/services/keepproxy"
525 KEEPPROXY_VERSION=$(version_from_git)
526 KEEPPROXY_TIMESTAMP=$(timestamp_from_git)
528 if [[ "$GO_SDK_TIMESTAMP" -gt "$KEEPPROXY_TIMESTAMP" ]]; then
529 PKG_VERSION=$GO_SDK_VERSION
531 PKG_VERSION=$KEEPPROXY_VERSION
534 go get "git.curoverse.com/arvados.git/services/keepproxy"
536 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"
539 cd "$GOPATH/src/git.curoverse.com/arvados.git/services/datamanager"
540 DATAMANAGER_VERSION=$(version_from_git)
541 DATAMANAGER_TIMESTAMP=$(timestamp_from_git)
543 if [[ "$GO_SDK_TIMESTAMP" -gt "$DATAMANAGER_TIMESTAMP" ]]; then
544 PKG_VERSION=$GO_SDK_VERSION
546 PKG_VERSION=$DATAMANAGER_VERSION
549 go get "git.curoverse.com/arvados.git/services/datamanager"
551 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."
554 cd "$GOPATH/src/git.curoverse.com/arvados.git/services/arv-git-httpd"
555 ARVGITHTTPD_VERSION=$(version_from_git)
556 ARVGITHTTPD_TIMESTAMP=$(timestamp_from_git)
558 if [[ "$GO_SDK_TIMESTAMP" -gt "$ARVGITHTTPD_TIMESTAMP" ]]; then
559 PKG_VERSION=$GO_SDK_VERSION
561 PKG_VERSION=$ARVGITHTTPD_VERSION
564 go get "git.curoverse.com/arvados.git/services/arv-git-httpd"
566 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."
569 cd "$GOPATH/src/git.curoverse.com/arvados.git/services/crunchstat"
570 PKG_VERSION=$(version_from_git)
571 go get "git.curoverse.com/arvados.git/services/crunchstat"
573 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"
576 # Please resist the temptation to add --no-python-fix-name to the fpm call here
577 # (which would remove the python- prefix from the package name), because this
578 # package is a dependency of arvados-fuse, and fpm can not omit the python-
579 # prefix from only one of the dependencies of a package... Maybe I could
580 # whip up a patch and send it upstream, but that will be for another day. Ward,
583 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"
586 # Please see comment about --no-python-fix-name above; we stay consistent and do
587 # not omit the python- prefix first.
589 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"
593 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"
595 # The Docker image cleaner
597 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"
600 for deppkg in "${PYTHON_BACKPORTS[@]}"; do
601 fpm_build_and_scp "$deppkg"
604 # Python 3 dependencies
605 for deppkg in "${PYTHON3_BACKPORTS[@]}"; do
606 # The empty string is the vendor argument: these aren't Curoverse software.
607 fpm_build_and_scp "$deppkg" "python3-$deppkg" "" python3
610 # Build the API server package
612 cd "$WORKSPACE/services/api"
614 API_VERSION=$(version_from_git)
615 PACKAGE_NAME=arvados-api-server
617 if [[ ! -d "$WORKSPACE/services/api/tmp" ]]; then
618 mkdir $WORKSPACE/services/api/tmp
621 BUNDLE_OUTPUT=`bundle install --path vendor/bundle`
623 if [[ "$DEBUG" != 0 ]]; then
627 /usr/bin/git rev-parse HEAD > git-commit.version
631 # Annoyingly, we require a database.yml file for rake assets:precompile to work. So for now,
632 # we do that in the upgrade script.
633 # TODO: add bogus database.yml file so we can precompile the assets and put them in the
634 # package. Then remove that database.yml file again. It has to be a valid file though.
635 #RAILS_ENV=production RAILS_GROUPS=assets bundle exec rake assets:precompile
637 # This is the complete package with vendor/bundle included.
638 # It's big, so we do not build it by default.
639 if [[ "$BUILD_BUNDLE_PACKAGES" != 0 ]]; then
640 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")
642 if [[ "$DEBUG" != 0 ]]; then
644 echo "${COMMAND_ARR[@]}"
648 FPM_RESULTS=$("${COMMAND_ARR[@]}")
650 fpm_verify_and_scp $FPM_EXIT_CODE $FPM_RESULTS
653 # Build the 'bare' package without vendor/bundle.
654 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")
656 if [[ "$DEBUG" != 0 ]]; then
658 echo "${COMMAND_ARR[@]}"
662 FPM_RESULTS=$("${COMMAND_ARR[@]}")
664 fpm_verify_and_scp $FPM_EXIT_CODE $FPM_RESULTS
666 # API server package build done
668 # Build the workbench server package
670 cd "$WORKSPACE/apps/workbench"
672 WORKBENCH_VERSION=$(version_from_git)
673 PACKAGE_NAME=arvados-workbench
675 if [[ ! -d "$WORKSPACE/apps/workbench/tmp" ]]; then
676 mkdir $WORKSPACE/apps/workbench/tmp
679 BUNDLE_OUTPUT=`bundle install --path vendor/bundle`
681 if [[ "$DEBUG" != 0 ]]; then
685 /usr/bin/git rev-parse HEAD > git-commit.version
687 # clear the tmp directory; the asset generation step will recreate tmp/cache/assets,
688 # and we want that in the package, so it's easier to not exclude the tmp directory
689 # from the package - empty it instead.
690 rm -rf $WORKSPACE/apps/workbench/tmp/*
692 # Set up application.yml so that asset precompilation works
693 \cp config/application.yml.example config/application.yml -f
694 sed -i 's/secret_token: ~/secret_token: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/' config/application.yml
696 RAILS_ENV=production RAILS_GROUPS=assets bundle exec rake assets:precompile >/dev/null
698 if [[ "$?" != "0" ]]; then
699 echo "ERROR: Asset precompilation failed"
705 # This is the complete package with vendor/bundle included.
706 # It's big, so we do not build it by default.
707 if [[ "$BUILD_BUNDLE_PACKAGES" != 0 ]]; then
709 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")
711 if [[ "$DEBUG" != 0 ]]; then
713 echo "${COMMAND_ARR[@]}"
717 FPM_RESULTS=$("${COMMAND_ARR[@]}")
719 fpm_verify_and_scp $FPM_EXIT_CODE $FPM_RESULTS
722 # Build the 'bare' package without vendor/bundle.
724 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")
726 if [[ "$DEBUG" != 0 ]]; then
728 echo "${COMMAND_ARR[@]}"
732 FPM_RESULTS=$("${COMMAND_ARR[@]}")
734 fpm_verify_and_scp $FPM_EXIT_CODE $FPM_RESULTS
736 # Workbench package build done
738 # Finally, publish the packages, if necessary
739 if [[ "$UPLOAD" != 0 && "$CALL_FREIGHT" != 0 ]]; then
740 ssh -p2222 $SCPUSER@$SCPHOST -t bash - <<EOF
741 if [ -n "\$(find -name "$FPM_OUTDIR/*.$FORMAT" -print -quit)" ]; then
742 cd "$FPM_OUTDIR" && $REPO_UPDATE_CMD
746 if [[ "$UPLOAD" != 0 ]]; then
747 echo "No new packages generated. No freight run necessary."
751 # clean up temporary GOPATH