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 PYTHON2_PKG_PREFIX=python
102 PYTHON3_PACKAGE=python$PYTHON3_VERSION
103 PYTHON3_PKG_PREFIX=python3
104 PYTHON_BACKPORTS=(python-gflags pyvcf google-api-python-client \
105 oauth2client pyasn1==0.1.7 pyasn1-modules==0.0.5 \
106 rsa uritemplate httplib2 ws4py \
107 virtualenv pykka apache-libcloud requests six pyexecjs jsonschema \
108 ciso8601 pycrypto backports.ssl_match_hostname pycurl llfuse)
109 PYTHON3_BACKPORTS=(docker-py six requests websocket-client)
114 REPO_UPDATE_CMD='freight add *deb apt/jessie && freight cache && rm -f *deb'
116 PYTHON2_PACKAGE=python$PYTHON2_VERSION
117 PYTHON2_PKG_PREFIX=python
118 PYTHON3_PACKAGE=python$PYTHON3_VERSION
119 PYTHON3_PKG_PREFIX=python3
120 PYTHON_BACKPORTS=(python-gflags pyvcf google-api-python-client \
121 oauth2client pyasn1==0.1.7 pyasn1-modules==0.0.5 \
122 rsa uritemplate httplib2 ws4py \
123 virtualenv pykka apache-libcloud requests six pyexecjs jsonschema \
124 ciso8601 pycrypto backports.ssl_match_hostname pycurl llfuse)
125 PYTHON3_BACKPORTS=(docker-py six requests websocket-client)
130 REPO_UPDATE_CMD='freight add *deb apt/precise && freight cache && rm -f *deb'
132 PYTHON2_PACKAGE=python$PYTHON2_VERSION
133 PYTHON2_PKG_PREFIX=python
134 PYTHON3_PACKAGE=python$PYTHON3_VERSION
135 PYTHON3_PKG_PREFIX=python3
136 PYTHON_BACKPORTS=(python-gflags pyvcf google-api-python-client \
137 oauth2client pyasn1==0.1.7 pyasn1-modules==0.0.5 \
138 rsa uritemplate httplib2 ws4py \
139 virtualenv pykka apache-libcloud requests six pyexecjs jsonschema \
140 ciso8601 pycrypto backports.ssl_match_hostname pycurl llfuse)
141 PYTHON3_BACKPORTS=(docker-py six requests websocket-client)
146 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/'
148 PYTHON2_PACKAGE=$(rpm -qf "$(which python$PYTHON2_VERSION)" --queryformat '%{NAME}\n')
149 PYTHON2_PKG_PREFIX=$PYTHON2_PACKAGE
150 PYTHON3_PACKAGE=$(rpm -qf "$(which python$PYTHON3_VERSION)" --queryformat '%{NAME}\n')
151 PYTHON3_PKG_PREFIX=$PYTHON3_PACKAGE
152 PYTHON_BACKPORTS=(python-gflags pyvcf google-api-python-client \
153 oauth2client pyasn1==0.1.7 pyasn1-modules==0.0.5 \
154 rsa uritemplate httplib2 ws4py \
155 pykka apache-libcloud requests six pyexecjs jsonschema \
156 ciso8601 pycrypto backports.ssl_match_hostname pycurl
157 python-daemon lockfile llfuse)
158 PYTHON3_BACKPORTS=(docker-py six requests)
159 export PYCURL_SSL_LIBRARY=nss
162 echo -e "$0: Unknown target '$TARGET'.\n" >&2
168 if ! [[ -n "$WORKSPACE" ]]; then
169 echo >&2 "$helpmessage"
171 echo >&2 "Error: WORKSPACE environment variable not set"
177 fpm --version >/dev/null 2>&1
179 if [[ "$?" != 0 ]]; then
180 echo >&2 "$helpmessage"
182 echo >&2 "Error: fpm not found"
187 find_easy_install() {
188 for version_suffix in "$@"; do
189 if "easy_install$version_suffix" --version >/dev/null 2>&1; then
190 echo "easy_install$version_suffix"
197 Error: easy_install$1 (from Python setuptools module) not found
203 EASY_INSTALL2=$(find_easy_install -$PYTHON2_VERSION "")
204 EASY_INSTALL3=$(find_easy_install -$PYTHON3_VERSION 3)
206 RUN_BUILD_PACKAGES_PATH="`dirname \"$0\"`"
207 RUN_BUILD_PACKAGES_PATH="`( cd \"$RUN_BUILD_PACKAGES_PATH\" && pwd )`" # absolutized and normalized
208 if [ -z "$RUN_BUILD_PACKAGES_PATH" ] ; then
209 # error; for some reason, the path is not accessible
210 # to the script (e.g. permissions re-evaled after suid)
214 if [[ "$DEBUG" != 0 ]]; then
215 echo "$0 is running from $RUN_BUILD_PACKAGES_PATH"
216 echo "Workspace is $WORKSPACE"
220 # Generates a version number from the git log for the current working
221 # directory, and writes it to stdout.
222 local git_ts git_hash
223 declare $(TZ=UTC git log -n1 --first-parent \
224 --format=format:"git_ts=%ct git_hash=%h" .)
225 echo "0.1.$(date -ud "@$git_ts" +%Y%m%d%H%M%S).$git_hash"
228 timestamp_from_git() {
229 # Generates a version number from the git log for the current working
230 # directory, and writes it to stdout.
231 local git_ts git_hash
232 declare $(TZ=UTC git log -n1 --first-parent \
233 --format=format:"git_ts=%ct git_hash=%h" .)
237 handle_python_package () {
238 # This function assumes the current working directory is the python package directory
239 if [[ "$UPLOAD" != 0 ]]; then
240 # Make sure only to use sdist - that's the only format pip can deal with (sigh)
241 if [[ "$DEBUG" != 0 ]]; then
242 python setup.py sdist upload
244 python setup.py -q sdist upload
247 # Make sure only to use sdist - that's the only format pip can deal with (sigh)
248 if [[ "$DEBUG" != 0 ]]; then
249 python setup.py sdist
251 python setup.py -q sdist
256 # Build packages for everything
257 fpm_build_and_scp () {
258 # The package source. Depending on the source type, this can be a
259 # path, or the name of the package in an upstream repository (e.g.,
263 # The name of the package to build. Defaults to $PACKAGE.
264 PACKAGE_NAME=${1:-$PACKAGE}
266 # Optional: the vendor of the package. Should be "Curoverse, Inc." for
267 # packages of our own software. Passed to fpm --vendor.
270 # The type of source package. Passed to fpm -s. Default "python".
271 PACKAGE_TYPE=${1:-python}
273 # Optional: the package version number. Passed to fpm -v.
277 case "$PACKAGE_TYPE" in
279 # All Arvados Python2 packages depend on Python 2.7.
280 # Make sure we build with that for consistency.
281 set -- "$@" --python-bin python2.7 \
282 --python-easyinstall "$EASY_INSTALL2" \
283 --python-package-name-prefix "$PYTHON2_PKG_PREFIX" \
284 --depends "$PYTHON2_PACKAGE"
287 # fpm does not actually support a python3 package type. Instead
288 # we recognize it as a convenience shortcut to add several
289 # necessary arguments to fpm's command line later, after we're
290 # done handling positional arguments.
292 set -- "$@" --python-bin python3 \
293 --python-easyinstall "$EASY_INSTALL3" \
294 --python-package-name-prefix "$PYTHON3_PKG_PREFIX" \
295 --depends "$PYTHON3_PACKAGE"
299 declare -a COMMAND_ARR=("fpm" "--maintainer=Ward Vandewege <ward@curoverse.com>" "-s" "$PACKAGE_TYPE" "-t" "$FORMAT")
300 if [ python = "$PACKAGE_TYPE" ]; then
301 COMMAND_ARR+=(--exclude=\*/{dist,site}-packages/tests/\*)
304 if [[ "$PACKAGE_NAME" != "$PACKAGE" ]]; then
305 COMMAND_ARR+=('-n' "$PACKAGE_NAME")
308 if [[ "$VENDOR" != "" ]]; then
309 COMMAND_ARR+=('--vendor' "$VENDOR")
312 if [[ "$VERSION" != "" ]]; then
313 COMMAND_ARR+=('-v' "$VERSION")
316 # Append remaining function arguments directly to fpm's command line.
321 COMMAND_ARR+=("$PACKAGE")
323 if [[ "$DEBUG" != 0 ]]; then
325 echo "${COMMAND_ARR[@]}"
329 FPM_RESULTS=$("${COMMAND_ARR[@]}")
332 fpm_verify_and_scp $FPM_EXIT_CODE $FPM_RESULTS
335 # verify build results and scp packages, if needed
336 fpm_verify_and_scp () {
342 if [[ $FPM_RESULTS =~ ([A-Za-z0-9_\.-]*\.)(deb|rpm) ]]; then
343 FPM_PACKAGE_NAME=${BASH_REMATCH[1]}${BASH_REMATCH[2]}
346 if [[ "$FPM_PACKAGE_NAME" == "" ]]; then
348 echo "Error: $PACKAGE: Unable to figure out package name from fpm results:"
353 if [[ ! $FPM_RESULTS =~ "File already exists" ]]; then
354 if [[ "$FPM_EXIT_CODE" != "0" ]]; then
355 echo "Error building package for $1:\n $FPM_RESULTS"
357 if [[ "$UPLOAD" != 0 ]]; then
358 scp -P2222 $FPM_PACKAGE_NAME $SCPUSER@$SCPHOST:$FPM_OUTDIR/
363 echo "Package $FPM_PACKAGE_NAME exists, not rebuilding"
368 if [[ -f /etc/profile.d/rvm.sh ]]; then
369 source /etc/profile.d/rvm.sh
372 # Make all files world-readable -- jenkins runs with umask 027, and has checked
373 # out our git tree here
374 chmod o+r "$WORKSPACE" -R
376 # More cleanup - make sure all executables that we'll package are 755
377 find -type d -name 'bin' |xargs -I {} find {} -type f |xargs -I {} chmod 755 {}
379 # Now fix our umask to something better suited to building and publishing
383 if [[ "$DEBUG" != 0 ]]; then
384 echo "umask is" `umask`
387 if [[ ! -d "$WORKSPACE/packages/$TARGET" ]]; then
388 mkdir -p $WORKSPACE/packages/$TARGET
392 if [[ "$DEBUG" != 0 ]]; then
393 echo -e "\nPerl packages\n"
396 if [[ "$DEBUG" != 0 ]]; then
402 cd "$WORKSPACE/sdk/perl"
404 if [[ -e Makefile ]]; then
405 make realclean >"$PERL_OUT"
407 find -maxdepth 1 \( -name 'MANIFEST*' -or -name "libarvados-perl*.$FORMAT" \) \
411 perl Makefile.PL INSTALL_BASE=install >"$PERL_OUT" && \
412 make install INSTALLDIRS=perl >"$PERL_OUT" && \
413 fpm_build_and_scp install/lib/=/usr/share libarvados-perl \
414 "Curoverse, Inc." dir "$(version_from_git)" install/man/=/usr/share/man && \
415 mv libarvados-perl*.$FORMAT "$WORKSPACE/packages/$TARGET/"
418 if [[ "$DEBUG" != 0 ]]; then
424 if type rvm-exec >/dev/null 2>&1; then
425 FPM_GEM_PREFIX=$(rvm-exec system gem environment gemdir)
427 FPM_GEM_PREFIX=$(gem environment gemdir)
433 ARVADOS_GEM_EPOCH=`git log -n1 --first-parent --format=%ct`
434 ARVADOS_GEM_DATE=`date --utc --date="@${ARVADOS_GEM_EPOCH}" +%Y%m%d%H%M%S`
435 ARVADOS_GEM_VERSION="0.1.${ARVADOS_GEM_DATE}"
437 # see if this gem needs building/uploading
438 gem search arvados -r -a |grep -q $ARVADOS_GEM_VERSION
440 if [[ "$?" != "0" ]]; then
441 # clean up old packages
442 find -maxdepth 1 \( -name 'arvados-*.gem' -or -name 'rubygem-arvados_*.deb' -or -name 'rubygem-arvados_*.rpm' \) \
445 if [[ "$DEBUG" != 0 ]]; then
446 gem build arvados.gemspec
448 # -q appears to be broken in gem version 2.2.2
449 gem build arvados.gemspec -q >/dev/null 2>&1
452 if [[ "$UPLOAD" != 0 ]]; then
454 gem push arvados-*gem
457 fpm_build_and_scp arvados-*.gem "" "Curoverse, Inc." gem "" \
458 --prefix "$FPM_GEM_PREFIX"
461 # Build arvados-cli GEM
465 ARVADOS_CLI_GEM_EPOCH=`git log -n1 --first-parent --format=%ct`
466 ARVADOS_CLI_GEM_DATE=`date --utc --date="@${ARVADOS_CLI_GEM_EPOCH}" +%Y%m%d%H%M%S`
467 ARVADOS_CLI_GEM_VERSION="0.1.${ARVADOS_CLI_GEM_DATE}"
469 # see if this gem needs building/uploading
470 gem search arvados-cli -r -a |grep -q $ARVADOS_GEM_VERSION
472 if [[ "$?" != "0" ]]; then
474 rm -f arvados-cli*gem
476 if [[ "$DEBUG" != 0 ]]; then
477 gem build arvados-cli.gemspec
479 # -q appears to be broken in gem version 2.2.2
480 gem build arvados-cli.gemspec -q >/dev/null
483 if [[ "$UPLOAD" != 0 ]]; then
485 gem push arvados-cli*gem
490 if [[ "$DEBUG" != 0 ]]; then
492 echo "Python packages"
499 handle_python_package
501 cd ../../services/fuse
502 handle_python_package
504 cd ../../services/nodemanager
505 handle_python_package
508 # We use $WORKSPACE/src-build-dir as the clean directory from which to build the src package
509 if [[ ! -d "$WORKSPACE/src-build-dir" ]]; then
510 mkdir "$WORKSPACE/src-build-dir"
512 if [[ "$DEBUG" != 0 ]]; then
513 git clone https://github.com/curoverse/arvados.git src-build-dir
515 git clone -q https://github.com/curoverse/arvados.git src-build-dir
519 cd "$WORKSPACE/src-build-dir"
520 # just in case, check out master
521 if [[ "$DEBUG" != 0 ]]; then
524 # go into detached-head state
525 git checkout `git log --format=format:%h -n1 --first-parent .`
527 git checkout -q master
529 # go into detached-head state
530 git checkout -q `git log --format=format:%h -n1 --first-parent .`
533 git log --format=format:%H -n1 --first-parent . > git-commit.version
535 # Build arvados src deb package
537 PKG_VERSION=$(version_from_git)
538 cd $WORKSPACE/packages/$TARGET
539 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"
541 # clean up, check out master and step away from detached-head state
542 cd "$WORKSPACE/src-build-dir"
543 if [[ "$DEBUG" != 0 ]]; then
546 git checkout -q master
550 export GOPATH=$(mktemp -d)
551 mkdir -p "$GOPATH/src/git.curoverse.com"
552 ln -sfn "$WORKSPACE" "$GOPATH/src/git.curoverse.com/arvados.git"
555 cd "$GOPATH/src/git.curoverse.com/arvados.git/services/keepstore"
556 PKG_VERSION=$(version_from_git)
557 go get "git.curoverse.com/arvados.git/services/keepstore"
558 cd $WORKSPACE/packages/$TARGET
559 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"
562 cd "$GOPATH/src/git.curoverse.com/arvados.git/sdk/go"
563 GO_SDK_VERSION=$(version_from_git)
564 GO_SDK_TIMESTAMP=$(timestamp_from_git)
567 cd "$GOPATH/src/git.curoverse.com/arvados.git/services/keepproxy"
568 KEEPPROXY_VERSION=$(version_from_git)
569 KEEPPROXY_TIMESTAMP=$(timestamp_from_git)
571 if [[ "$GO_SDK_TIMESTAMP" -gt "$KEEPPROXY_TIMESTAMP" ]]; then
572 PKG_VERSION=$GO_SDK_VERSION
574 PKG_VERSION=$KEEPPROXY_VERSION
577 go get "git.curoverse.com/arvados.git/services/keepproxy"
578 cd $WORKSPACE/packages/$TARGET
579 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"
582 cd "$GOPATH/src/git.curoverse.com/arvados.git/services/datamanager"
583 DATAMANAGER_VERSION=$(version_from_git)
584 DATAMANAGER_TIMESTAMP=$(timestamp_from_git)
586 if [[ "$GO_SDK_TIMESTAMP" -gt "$DATAMANAGER_TIMESTAMP" ]]; then
587 PKG_VERSION=$GO_SDK_VERSION
589 PKG_VERSION=$DATAMANAGER_VERSION
592 go get "git.curoverse.com/arvados.git/services/datamanager"
593 cd $WORKSPACE/packages/$TARGET
594 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."
597 cd "$GOPATH/src/git.curoverse.com/arvados.git/services/arv-git-httpd"
598 ARVGITHTTPD_VERSION=$(version_from_git)
599 ARVGITHTTPD_TIMESTAMP=$(timestamp_from_git)
601 if [[ "$GO_SDK_TIMESTAMP" -gt "$ARVGITHTTPD_TIMESTAMP" ]]; then
602 PKG_VERSION=$GO_SDK_VERSION
604 PKG_VERSION=$ARVGITHTTPD_VERSION
607 go get "git.curoverse.com/arvados.git/services/arv-git-httpd"
608 cd $WORKSPACE/packages/$TARGET
609 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."
612 cd "$GOPATH/src/git.curoverse.com/arvados.git/services/crunchstat"
613 PKG_VERSION=$(version_from_git)
614 go get "git.curoverse.com/arvados.git/services/crunchstat"
615 cd $WORKSPACE/packages/$TARGET
616 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"
619 # Please resist the temptation to add --no-python-fix-name to the fpm call here
620 # (which would remove the python- prefix from the package name), because this
621 # package is a dependency of arvados-fuse, and fpm can not omit the python-
622 # prefix from only one of the dependencies of a package... Maybe I could
623 # whip up a patch and send it upstream, but that will be for another day. Ward,
625 cd $WORKSPACE/packages/$TARGET
626 fpm_build_and_scp $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"
629 # Please see comment about --no-python-fix-name above; we stay consistent and do
630 # not omit the python- prefix first.
631 cd $WORKSPACE/packages/$TARGET
632 fpm_build_and_scp $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"
635 cd $WORKSPACE/packages/$TARGET
636 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"
638 # The Docker image cleaner
639 cd $WORKSPACE/packages/$TARGET
640 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"
643 for deppkg in "${PYTHON_BACKPORTS[@]}"; do
644 outname=$(echo "$deppkg" | sed -e 's/^python-//' -e 's/[<=>].*//' -e 's/_/-/g' -e "s/^/${PYTHON2_PKG_PREFIX}-/")
645 fpm_build_and_scp "$deppkg" "$outname"
648 # Python 3 dependencies
649 for deppkg in "${PYTHON3_BACKPORTS[@]}"; do
650 outname=$(echo "$deppkg" | sed -e 's/^python-//' -e 's/[<=>].*//' -e 's/_/-/g' -e "s/^/${PYTHON3_PKG_PREFIX}-/")
651 # The empty string is the vendor argument: these aren't Curoverse software.
652 fpm_build_and_scp "$deppkg" "$outname" "" python3
656 cd $WORKSPACE/sdk/pam
657 PKG_VERSION=$(version_from_git)
658 cd $WORKSPACE/packages/$TARGET
660 if [[ "$FORMAT" == "deb" ]]; then
661 fpm_build_and_scp $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
663 # FIXME enable and test once we have the centos pam.d file
664 #fpm_build_and_scp $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
667 # Build the API server package
669 cd "$WORKSPACE/services/api"
671 API_VERSION=$(version_from_git)
672 PACKAGE_NAME=arvados-api-server
674 if [[ ! -d "$WORKSPACE/services/api/tmp" ]]; then
675 mkdir $WORKSPACE/services/api/tmp
678 BUNDLE_OUTPUT=`bundle install --path vendor/bundle`
680 if [[ "$DEBUG" != 0 ]]; then
684 /usr/bin/git rev-parse HEAD > git-commit.version
686 cd $WORKSPACE/packages/$TARGET
688 # Annoyingly, we require a database.yml file for rake assets:precompile to work. So for now,
689 # we do that in the upgrade script.
690 # TODO: add bogus database.yml file so we can precompile the assets and put them in the
691 # package. Then remove that database.yml file again. It has to be a valid file though.
692 #RAILS_ENV=production RAILS_GROUPS=assets bundle exec rake assets:precompile
694 # This is the complete package with vendor/bundle included.
695 # It's big, so we do not build it by default.
696 if [[ "$BUILD_BUNDLE_PACKAGES" != 0 ]]; then
697 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")
699 if [[ "$DEBUG" != 0 ]]; then
701 echo "${COMMAND_ARR[@]}"
705 FPM_RESULTS=$("${COMMAND_ARR[@]}")
707 fpm_verify_and_scp $FPM_EXIT_CODE $FPM_RESULTS
710 # Build the 'bare' package without vendor/bundle.
711 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")
713 if [[ "$DEBUG" != 0 ]]; then
715 echo "${COMMAND_ARR[@]}"
719 FPM_RESULTS=$("${COMMAND_ARR[@]}")
721 fpm_verify_and_scp $FPM_EXIT_CODE $FPM_RESULTS
723 # API server package build done
725 # Build the workbench server package
727 cd "$WORKSPACE/apps/workbench"
729 WORKBENCH_VERSION=$(version_from_git)
730 PACKAGE_NAME=arvados-workbench
732 if [[ ! -d "$WORKSPACE/apps/workbench/tmp" ]]; then
733 mkdir $WORKSPACE/apps/workbench/tmp
736 BUNDLE_OUTPUT=`bundle install --path vendor/bundle`
738 if [[ "$DEBUG" != 0 ]]; then
742 /usr/bin/git rev-parse HEAD > git-commit.version
744 # clear the tmp directory; the asset generation step will recreate tmp/cache/assets,
745 # and we want that in the package, so it's easier to not exclude the tmp directory
746 # from the package - empty it instead.
747 rm -rf $WORKSPACE/apps/workbench/tmp/*
749 # Set up application.yml and production.rb so that asset precompilation works
750 \cp config/application.yml.example config/application.yml -f
751 \cp config/environments/production.rb.example config/environments/production.rb -f
752 sed -i 's/secret_token: ~/secret_token: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/' config/application.yml
754 RAILS_ENV=production RAILS_GROUPS=assets bundle exec rake assets:precompile >/dev/null
756 if [[ "$?" != "0" ]]; then
757 echo "ERROR: Asset precompilation failed"
761 cd $WORKSPACE/packages/$TARGET
763 # This is the complete package with vendor/bundle included.
764 # It's big, so we do not build it by default.
765 if [[ "$BUILD_BUNDLE_PACKAGES" != 0 ]]; then
767 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")
769 if [[ "$DEBUG" != 0 ]]; then
771 echo "${COMMAND_ARR[@]}"
775 FPM_RESULTS=$("${COMMAND_ARR[@]}")
777 fpm_verify_and_scp $FPM_EXIT_CODE $FPM_RESULTS
780 # Build the 'bare' package without vendor/bundle.
782 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")
784 if [[ "$DEBUG" != 0 ]]; then
786 echo "${COMMAND_ARR[@]}"
790 FPM_RESULTS=$("${COMMAND_ARR[@]}")
792 fpm_verify_and_scp $FPM_EXIT_CODE $FPM_RESULTS
794 # Workbench package build done
796 # Finally, publish the packages, if necessary
797 if [[ "$UPLOAD" != 0 && "$CALL_FREIGHT" != 0 ]]; then
798 ssh -p2222 $SCPUSER@$SCPHOST -t bash - <<EOF
799 if [ -n "\$(find $FPM_OUTDIR -name "*.$FORMAT" -print -quit)" ]; then
800 cd "$FPM_OUTDIR" && $REPO_UPDATE_CMD
804 if [[ "$UPLOAD" != 0 ]]; then
805 echo "No new packages generated. No freight run necessary."
809 # clean up temporary GOPATH