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:,apt-server:,build-bundle-packages,debug,target: \
44 eval set -- "$PARSEDOPTS"
45 while [ $# -gt 0 ]; do
48 echo >&2 "$helpmessage"
55 --scp-host|--apt-server)
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
95 REPO_UPDATE_CMD='freight add *deb apt/wheezy && freight cache && rm -f *deb'
96 PYTHON_BACKPORTS=(python-gflags pyvcf google-api-python-client \
97 oauth2client pyasn1 pyasn1-modules rsa uritemplate httplib2 ws4py \
98 virtualenv pykka apache-libcloud requests six pyexecjs jsonschema \
99 ciso8601 pycrypto backports.ssl_match_hostname pycurl)
100 PYTHON3_BACKPORTS=(docker-py six requests)
105 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/'
106 PYTHON_BACKPORTS=(python-gflags pyvcf google-api-python-client \
107 oauth2client pyasn1 pyasn1-modules rsa uritemplate httplib2 ws4py \
108 virtualenv pykka apache-libcloud requests six pyexecjs jsonschema \
109 ciso8601 pycrypto backports.ssl_match_hostname pycurl)
110 PYTHON3_BACKPORTS=(docker-py six requests)
113 echo -e "$0: Unknown target '$TARGET'.\n" >&2
119 if ! [[ -n "$WORKSPACE" ]]; then
120 echo >&2 "$helpmessage"
122 echo >&2 "Error: WORKSPACE environment variable not set"
128 fpm --version >/dev/null 2>&1
130 if [[ "$?" != 0 ]]; then
131 echo >&2 "$helpmessage"
133 echo >&2 "Error: fpm not found"
138 if ! easy_install3 --version >/dev/null; then
142 Error: easy_install3 (from python3-setuptools) not found
148 RUN_BUILD_PACKAGES_PATH="`dirname \"$0\"`"
149 RUN_BUILD_PACKAGES_PATH="`( cd \"$RUN_BUILD_PACKAGES_PATH\" && pwd )`" # absolutized and normalized
150 if [ -z "$RUN_BUILD_PACKAGES_PATH" ] ; then
151 # error; for some reason, the path is not accessible
152 # to the script (e.g. permissions re-evaled after suid)
156 if [[ "$DEBUG" != 0 ]]; then
157 echo "$0 is running from $RUN_BUILD_PACKAGES_PATH"
158 echo "Workspace is $WORKSPACE"
162 # Generates a version number from the git log for the current working
163 # directory, and writes it to stdout.
164 local git_ts git_hash
165 declare $(TZ=UTC git log -n1 --first-parent --max-count=1 \
166 --format=format:"git_ts=%ct git_hash=%h" .)
167 echo "0.1.$(date -ud "@$git_ts" +%Y%m%d%H%M%S).$git_hash"
170 timestamp_from_git() {
171 # Generates a version number from the git log for the current working
172 # directory, and writes it to stdout.
173 local git_ts git_hash
174 declare $(TZ=UTC git log -n1 --first-parent --max-count=1 \
175 --format=format:"git_ts=%ct git_hash=%h" .)
179 handle_python_package () {
180 # This function assumes the current working directory is the python package directory
181 if [[ "$UPLOAD" != 0 ]]; then
182 # Make sure only to use sdist - that's the only format pip can deal with (sigh)
183 if [[ "$DEBUG" != 0 ]]; then
184 python setup.py sdist upload
186 python setup.py -q sdist upload
189 # Make sure only to use sdist - that's the only format pip can deal with (sigh)
190 if [[ "$DEBUG" != 0 ]]; then
191 python setup.py sdist
193 python setup.py -q sdist
198 # Build debs for everything
199 fpm_build_and_scp () {
200 # The package source. Depending on the source type, this can be a
201 # path, or the name of the package in an upstream repository (e.g.,
205 # The name of the package to build. Defaults to $PACKAGE.
206 PACKAGE_NAME=${1:-$PACKAGE}
208 # Optional: the vendor of the package. Should be "Curoverse, Inc." for
209 # packages of our own software. Passed to fpm --vendor.
212 # The type of source package. Passed to fpm -s. Default "python".
213 PACKAGE_TYPE=${1:-python}
215 # Optional: the package version number. Passed to fpm -v.
219 case "$PACKAGE_TYPE" in
221 # All Arvados Python2 packages depend on Python 2.7.
222 # Make sure we build with that for consistency.
223 set -- "$@" --python-bin python2.7 \
224 --python-easyinstall easy_install-2.7
227 # fpm does not actually support a python3 package type. Instead
228 # we recognize it as a convenience shortcut to add several
229 # necessary arguments to fpm's command line later, after we're
230 # done handling positional arguments.
232 set -- "$@" --python-bin python3 --python-easyinstall easy_install3 \
233 --python-package-name-prefix python3 --depends python3
237 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")
239 if [[ "$PACKAGE_NAME" != "$PACKAGE" ]]; then
240 COMMAND_ARR+=('-n' "$PACKAGE_NAME")
243 if [[ "$VENDOR" != "" ]]; then
244 COMMAND_ARR+=('--vendor' "$VENDOR")
247 if [[ "$VERSION" != "" ]]; then
248 COMMAND_ARR+=('-v' "$VERSION")
251 # Append remaining function arguments directly to fpm's command line.
256 COMMAND_ARR+=("$PACKAGE")
258 if [[ "$DEBUG" != 0 ]]; then
260 echo "${COMMAND_ARR[@]}"
264 FPM_RESULTS=$("${COMMAND_ARR[@]}")
267 fpm_verify_and_scp $FPM_EXIT_CODE $FPM_RESULTS
270 # verify build results and scp debs, if needed
271 fpm_verify_and_scp () {
277 if [[ $FPM_RESULTS =~ ([A-Za-z0-9_\-.]*\.)(deb|rpm) ]]; then
278 FPM_PACKAGE_NAME=${BASH_REMATCH[1]}${BASH_REMATCH[2]}
281 if [[ "$FPM_PACKAGE_NAME" == "" ]]; then
283 echo "Error: $PACKAGE: Unable to figure out package name from fpm results:"
288 if [[ ! $FPM_RESULTS =~ "File already exists" ]]; then
289 if [[ "$FPM_EXIT_CODE" != "0" ]]; then
290 echo "Error building package for $1:\n $FPM_RESULTS"
292 if [[ "$UPLOAD" != 0 ]]; then
293 scp -P2222 $FPM_PACKAGE_NAME $SCPUSER@$SCPHOST:$FPM_OUTDIR/
298 echo "Package $FPM_PACKAGE_NAME exists, not rebuilding"
303 if [[ -f /etc/profile.d/rvm.sh ]]; then
304 source /etc/profile.d/rvm.sh
307 # Make all files world-readable -- jenkins runs with umask 027, and has checked
308 # out our git tree here
309 chmod o+r "$WORKSPACE" -R
311 # More cleanup - make sure all executables that we'll package are 755
312 find -type d -name 'bin' |xargs -I {} find {} -type f |xargs -I {} chmod 755 {}
314 # Now fix our umask to something better suited to building and publishing
318 if [[ "$DEBUG" != 0 ]]; then
319 echo "umask is" `umask`
322 if [[ ! -d "$WORKSPACE/debs" ]]; then
323 mkdir -p $WORKSPACE/debs
327 if [[ "$DEBUG" != 0 ]]; then
328 echo -e "\nPerl packages\n"
331 if [[ "$DEBUG" != 0 ]]; then
337 cd "$WORKSPACE/sdk/perl"
339 if [[ -e Makefile ]]; then
340 make realclean >"$PERL_OUT"
342 find -maxdepth 1 \( -name 'MANIFEST*' -or -name "libarvados-perl*.$FORMAT" \) \
346 perl Makefile.PL INSTALL_BASE=install >"$PERL_OUT" && \
347 make install INSTALLDIRS=perl >"$PERL_OUT" && \
348 fpm_build_and_scp install/lib/=/usr/share libarvados-perl \
349 "Curoverse, Inc." dir "$(version_from_git)" install/man/=/usr/share/man && \
350 mv libarvados-perl*.$FORMAT "$WORKSPACE/debs/"
353 if [[ "$DEBUG" != 0 ]]; then
359 if type rvm-exec >/dev/null 2>&1; then
360 FPM_GEM_PREFIX=$(rvm-exec system gem environment gemdir)
362 FPM_GEM_PREFIX=$(gem environment gemdir)
368 ARVADOS_GEM_EPOCH=`git log -n1 --first-parent --format=%ct`
369 ARVADOS_GEM_DATE=`date --utc --date="@${ARVADOS_GEM_EPOCH}" +%Y%m%d%H%M%S`
370 ARVADOS_GEM_VERSION="0.1.${ARVADOS_GEM_DATE}"
372 # see if this gem needs building/uploading
373 gem search arvados -r -a |grep -q $ARVADOS_GEM_VERSION
375 if [[ "$?" != "0" ]]; then
376 # clean up old packages
377 find -maxdepth 1 \( -name 'arvados-*.gem' -or -name 'rubygem-arvados_*.deb' -or -name 'rubygem-arvados_*.rpm' \) \
380 if [[ "$DEBUG" != 0 ]]; then
381 gem build arvados.gemspec
383 # -q appears to be broken in gem version 2.2.2
384 gem build arvados.gemspec -q >/dev/null 2>&1
387 if [[ "$UPLOAD" != 0 ]]; then
389 gem push arvados-*gem
392 fpm_build_and_scp arvados-*.gem "" "Curoverse, Inc." gem "" \
393 --prefix "$FPM_GEM_PREFIX"
396 # Build arvados-cli GEM
400 ARVADOS_CLI_GEM_EPOCH=`git log -n1 --first-parent --format=%ct`
401 ARVADOS_CLI_GEM_DATE=`date --utc --date="@${ARVADOS_CLI_GEM_EPOCH}" +%Y%m%d%H%M%S`
402 ARVADOS_CLI_GEM_VERSION="0.1.${ARVADOS_CLI_GEM_DATE}"
404 # see if this gem needs building/uploading
405 gem search arvados-cli -r -a |grep -q $ARVADOS_GEM_VERSION
407 if [[ "$?" != "0" ]]; then
409 rm -f arvados-cli*gem
411 if [[ "$DEBUG" != 0 ]]; then
412 gem build arvados-cli.gemspec
414 # -q appears to be broken in gem version 2.2.2
415 gem build arvados-cli.gemspec -q >/dev/null
418 if [[ "$UPLOAD" != 0 ]]; then
420 gem push arvados-cli*gem
425 if [[ "$DEBUG" != 0 ]]; then
427 echo "Python packages"
434 handle_python_package
436 cd ../../services/fuse
437 handle_python_package
439 cd ../../services/nodemanager
440 handle_python_package
443 # We use $WORKSPACE/src-build-dir as the clean directory from which to build the src package
444 if [[ ! -d "$WORKSPACE/src-build-dir" ]]; then
445 mkdir "$WORKSPACE/src-build-dir"
447 if [[ "$DEBUG" != 0 ]]; then
448 git clone https://github.com/curoverse/arvados.git src-build-dir
450 git clone -q https://github.com/curoverse/arvados.git src-build-dir
454 cd "$WORKSPACE/src-build-dir"
455 # just in case, check out master
456 if [[ "$DEBUG" != 0 ]]; then
459 # go into detached-head state
460 git checkout `git log --format=format:%h -n1 .`
462 git checkout -q master
464 # go into detached-head state
465 git checkout -q `git log --format=format:%h -n1 .`
468 git log --format=format:%H -n1 . > git-commit.version
470 # Build arvados src deb package
472 PKG_VERSION=$(version_from_git)
474 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"
476 # clean up, check out master and step away from detached-head state
477 cd "$WORKSPACE/src-build-dir"
478 if [[ "$DEBUG" != 0 ]]; then
481 git checkout -q master
485 export GOPATH=$(mktemp -d)
486 mkdir -p "$GOPATH/src/git.curoverse.com"
487 ln -sfn "$WORKSPACE" "$GOPATH/src/git.curoverse.com/arvados.git"
490 cd "$GOPATH/src/git.curoverse.com/arvados.git/services/keepstore"
491 PKG_VERSION=$(version_from_git)
492 go get "git.curoverse.com/arvados.git/services/keepstore"
494 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"
497 cd "$GOPATH/src/git.curoverse.com/arvados.git/sdk/go"
498 GO_SDK_VERSION=$(version_from_git)
499 GO_SDK_TIMESTAMP=$(timestamp_from_git)
502 cd "$GOPATH/src/git.curoverse.com/arvados.git/services/keepproxy"
503 KEEPPROXY_VERSION=$(version_from_git)
504 KEEPPROXY_TIMESTAMP=$(timestamp_from_git)
506 if [[ "$GO_SDK_TIMESTAMP" -gt "$KEEPPROXY_TIMESTAMP" ]]; then
507 PKG_VERSION=$GO_SDK_VERSION
509 PKG_VERSION=$KEEPPROXY_VERSION
512 go get "git.curoverse.com/arvados.git/services/keepproxy"
514 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"
517 cd "$GOPATH/src/git.curoverse.com/arvados.git/services/datamanager"
518 DATAMANAGER_VERSION=$(version_from_git)
519 DATAMANAGER_TIMESTAMP=$(timestamp_from_git)
521 if [[ "$GO_SDK_TIMESTAMP" -gt "$DATAMANAGER_TIMESTAMP" ]]; then
522 PKG_VERSION=$GO_SDK_VERSION
524 PKG_VERSION=$DATAMANAGER_VERSION
527 go get "git.curoverse.com/arvados.git/services/datamanager"
529 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."
532 cd "$GOPATH/src/git.curoverse.com/arvados.git/services/arv-git-httpd"
533 ARVGITHTTPD_VERSION=$(version_from_git)
534 ARVGITHTTPD_TIMESTAMP=$(timestamp_from_git)
536 if [[ "$GO_SDK_TIMESTAMP" -gt "$ARVGITHTTPD_TIMESTAMP" ]]; then
537 PKG_VERSION=$GO_SDK_VERSION
539 PKG_VERSION=$ARVGITHTTPD_VERSION
542 go get "git.curoverse.com/arvados.git/services/arv-git-httpd"
544 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."
547 cd "$GOPATH/src/git.curoverse.com/arvados.git/services/crunchstat"
548 PKG_VERSION=$(version_from_git)
549 go get "git.curoverse.com/arvados.git/services/crunchstat"
551 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"
554 # Please resist the temptation to add --no-python-fix-name to the fpm call here
555 # (which would remove the python- prefix from the package name), because this
556 # package is a dependency of arvados-fuse, and fpm can not omit the python-
557 # prefix from only one of the dependencies of a package... Maybe I could
558 # whip up a patch and send it upstream, but that will be for another day. Ward,
561 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.7
564 # Please see comment about --no-python-fix-name above; we stay consistent and do
565 # not omit the python- prefix first.
567 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.7
571 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.7
573 # The Docker image cleaner
575 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"
578 for deppkg in "${PYTHON_BACKPORTS[@]}"; do
579 fpm_build_and_scp "$deppkg"
582 # Python 3 dependencies
583 for deppkg in "${PYTHON3_BACKPORTS[@]}"; do
584 # The empty string is the vendor argument: these aren't Curoverse software.
585 fpm_build_and_scp "$deppkg" "python3-$deppkg" "" python3
588 # Build the API server package
590 cd "$WORKSPACE/services/api"
592 API_VERSION=$(version_from_git)
593 PACKAGE_NAME=arvados-api-server
595 if [[ ! -d "$WORKSPACE/services/api/tmp" ]]; then
596 mkdir $WORKSPACE/services/api/tmp
599 BUNDLE_OUTPUT=`bundle install --path vendor/bundle`
601 if [[ "$DEBUG" != 0 ]]; then
605 /usr/bin/git rev-parse HEAD > git-commit.version
609 # Annoyingly, we require a database.yml file for rake assets:precompile to work. So for now,
610 # we do that in the upgrade script.
611 # TODO: add bogus database.yml file so we can precompile the assets and put them in the
612 # package. Then remove that database.yml file again. It has to be a valid file though.
613 #RAILS_ENV=production RAILS_GROUPS=assets bundle exec rake assets:precompile
615 # This is the complete package with vendor/bundle included.
616 # It's big, so we do not build it by default.
617 if [[ "$BUILD_BUNDLE_PACKAGES" != 0 ]]; then
618 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")
620 if [[ "$DEBUG" != 0 ]]; then
622 echo "${COMMAND_ARR[@]}"
626 FPM_RESULTS=$("${COMMAND_ARR[@]}")
628 fpm_verify_and_scp $FPM_EXIT_CODE $FPM_RESULTS
631 # Build the 'bare' package without vendor/bundle.
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}" "-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")
634 if [[ "$DEBUG" != 0 ]]; then
636 echo "${COMMAND_ARR[@]}"
640 FPM_RESULTS=$("${COMMAND_ARR[@]}")
642 fpm_verify_and_scp $FPM_EXIT_CODE $FPM_RESULTS
644 # API server package build done
646 # Build the workbench server package
648 cd "$WORKSPACE/apps/workbench"
650 WORKBENCH_VERSION=$(version_from_git)
651 PACKAGE_NAME=arvados-workbench
653 if [[ ! -d "$WORKSPACE/apps/workbench/tmp" ]]; then
654 mkdir $WORKSPACE/apps/workbench/tmp
657 BUNDLE_OUTPUT=`bundle install --path vendor/bundle`
659 if [[ "$DEBUG" != 0 ]]; then
663 /usr/bin/git rev-parse HEAD > git-commit.version
665 # clear the tmp directory; the asset generation step will recreate tmp/cache/assets,
666 # and we want that in the package, so it's easier to not exclude the tmp directory
667 # from the package - empty it instead.
668 rm -rf $WORKSPACE/apps/workbench/tmp/*
670 # Set up application.yml so that asset precompilation works
671 \cp config/application.yml.example config/application.yml -f
672 sed -i 's/secret_token: ~/secret_token: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/' config/application.yml
674 RAILS_ENV=production RAILS_GROUPS=assets bundle exec rake assets:precompile >/dev/null
676 if [[ "$?" != "0" ]]; then
677 echo "ERROR: Asset precompilation failed"
683 # This is the complete package with vendor/bundle included.
684 # It's big, so we do not build it by default.
685 if [[ "$BUILD_BUNDLE_PACKAGES" != 0 ]]; then
687 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")
689 if [[ "$DEBUG" != 0 ]]; then
691 echo "${COMMAND_ARR[@]}"
695 FPM_RESULTS=$("${COMMAND_ARR[@]}")
697 fpm_verify_and_scp $FPM_EXIT_CODE $FPM_RESULTS
700 # Build the 'bare' package without vendor/bundle.
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}" "-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")
704 if [[ "$DEBUG" != 0 ]]; then
706 echo "${COMMAND_ARR[@]}"
710 FPM_RESULTS=$("${COMMAND_ARR[@]}")
712 fpm_verify_and_scp $FPM_EXIT_CODE $FPM_RESULTS
714 # Workbench package build done
716 # Finally, publish the packages, if necessary
717 if [[ "$UPLOAD" != 0 && "$CALL_FREIGHT" != 0 ]]; then
718 ssh -p2222 $SCPUSER@$SCPHOST -t bash - <<EOF
719 if [ -n "\$(find -name "$FPM_OUTDIR/*.$FORMAT" -print -quit)" ]; then
720 cd "$FPM_OUTDIR" && $REPO_UPDATE_CMD
724 if [[ "$UPLOAD" != 0 ]]; then
725 echo "No new packages generated. No freight run necessary."
729 # clean up temporary GOPATH