3 . `dirname "$(readlink -f "$0")"`/run-library.sh
4 . `dirname "$(readlink -f "$0")"`/libcloud-pin
6 read -rd "\000" helpmessage <<EOF
7 $(basename $0): Build Arvados packages
10 WORKSPACE=/path/to/arvados $(basename $0) [options]
14 --build-bundle-packages (default: false)
15 Build api server and workbench packages with vendor/bundle included
17 Output debug information (default: false)
19 Distribution to build packages for (default: debian8)
20 --only-build <package>
21 Build only a specific package (or $ONLY_BUILD from environment)
23 Build command to execute (defaults to the run command defined in the
26 WORKSPACE=path Path to the Arvados source tree to build packages from
31 DEBUG=${ARVADOS_DEBUG:-0}
35 RAILS_PACKAGE_ITERATION=7
37 PARSEDOPTS=$(getopt --name "$0" --longoptions \
38 help,build-bundle-packages,debug,target:,only-build: \
44 eval set -- "$PARSEDOPTS"
45 while [ $# -gt 0 ]; do
48 echo >&2 "$helpmessage"
56 ONLY_BUILD="$2"; shift
66 echo >&2 "$0: unrecognized argument '$2'. Try: $0 --help"
74 if [[ "$COMMAND" != "" ]]; then
75 COMMAND="/usr/local/rvm/bin/rvm-exec default bash /jenkins/$COMMAND --target $TARGET"
78 STDOUT_IF_DEBUG=/dev/null
79 STDERR_IF_DEBUG=/dev/null
81 if [[ "$DEBUG" != 0 ]]; then
82 STDOUT_IF_DEBUG=/dev/stdout
83 STDERR_IF_DEBUG=/dev/stderr
87 declare -a PYTHON_BACKPORTS PYTHON3_BACKPORTS
90 PYTHON3_VERSION=$(python3 -c 'import sys; print("{v.major}.{v.minor}".format(v=sys.version_info))')
92 ## These defaults are suitable for any Debian-based distribution.
93 # You can customize them as needed in distro sections below.
94 PYTHON2_PACKAGE=python$PYTHON2_VERSION
95 PYTHON2_PKG_PREFIX=python
97 PYTHON2_INSTALL_LIB=lib/python$PYTHON2_VERSION/dist-packages
99 PYTHON3_PACKAGE=python$PYTHON3_VERSION
100 PYTHON3_PKG_PREFIX=python3
102 PYTHON3_INSTALL_LIB=lib/python$PYTHON3_VERSION/dist-packages
103 ## End Debian Python defaults.
117 PYTHON2_PACKAGE=$(rpm -qf "$(which python$PYTHON2_VERSION)" --queryformat '%{NAME}\n')
118 PYTHON2_PKG_PREFIX=$PYTHON2_PACKAGE
119 PYTHON2_INSTALL_LIB=lib/python$PYTHON2_VERSION/site-packages
120 PYTHON3_PACKAGE=$(rpm -qf "$(which python$PYTHON3_VERSION)" --queryformat '%{NAME}\n')
121 PYTHON3_PKG_PREFIX=$PYTHON3_PACKAGE
122 PYTHON3_PREFIX=/opt/rh/python33/root/usr
123 PYTHON3_INSTALL_LIB=lib/python$PYTHON3_VERSION/site-packages
124 export PYCURL_SSL_LIBRARY=nss
127 echo -e "$0: Unknown target '$TARGET'.\n" >&2
133 if ! [[ -n "$WORKSPACE" ]]; then
134 echo >&2 "$helpmessage"
136 echo >&2 "Error: WORKSPACE environment variable not set"
142 fpm --version >/dev/null 2>&1
144 if [[ "$?" != 0 ]]; then
145 echo >&2 "$helpmessage"
147 echo >&2 "Error: fpm not found"
152 EASY_INSTALL2=$(find_easy_install -$PYTHON2_VERSION "")
153 EASY_INSTALL3=$(find_easy_install -$PYTHON3_VERSION 3)
155 RUN_BUILD_PACKAGES_PATH="`dirname \"$0\"`"
156 RUN_BUILD_PACKAGES_PATH="`( cd \"$RUN_BUILD_PACKAGES_PATH\" && pwd )`" # absolutized and normalized
157 if [ -z "$RUN_BUILD_PACKAGES_PATH" ] ; then
158 # error; for some reason, the path is not accessible
159 # to the script (e.g. permissions re-evaled after suid)
163 debug_echo "$0 is running from $RUN_BUILD_PACKAGES_PATH"
164 debug_echo "Workspace is $WORKSPACE"
166 if [[ -f /etc/profile.d/rvm.sh ]]; then
167 source /etc/profile.d/rvm.sh
168 GEM="rvm-exec default gem"
173 # Make all files world-readable -- jenkins runs with umask 027, and has checked
174 # out our git tree here
175 chmod o+r "$WORKSPACE" -R
177 # More cleanup - make sure all executables that we'll package are 755
179 find -type d -name 'bin' |xargs -I {} find {} -type f |xargs -I {} chmod 755 {}
181 # Now fix our umask to something better suited to building and publishing
185 debug_echo "umask is" `umask`
187 if [[ ! -d "$WORKSPACE/packages/$TARGET" ]]; then
188 mkdir -p $WORKSPACE/packages/$TARGET
189 chown --reference="$WORKSPACE" "$WORKSPACE/packages/$TARGET"
193 debug_echo -e "\nPerl packages\n"
195 if [[ -z "$ONLY_BUILD" ]] || [[ "libarvados-perl" = "$ONLY_BUILD" ]] ; then
196 cd "$WORKSPACE/sdk/perl"
197 libarvados_perl_version="$(version_from_git)"
199 cd $WORKSPACE/packages/$TARGET
200 test_package_presence libarvados-perl "$libarvados_perl_version"
202 if [[ "$?" == "0" ]]; then
203 cd "$WORKSPACE/sdk/perl"
205 if [[ -e Makefile ]]; then
206 make realclean >"$STDOUT_IF_DEBUG"
208 find -maxdepth 1 \( -name 'MANIFEST*' -or -name "libarvados-perl*.$FORMAT" \) \
212 perl Makefile.PL INSTALL_BASE=install >"$STDOUT_IF_DEBUG" && \
213 make install INSTALLDIRS=perl >"$STDOUT_IF_DEBUG" && \
214 fpm_build install/lib/=/usr/share libarvados-perl \
215 "Curoverse, Inc." dir "$(version_from_git)" install/man/=/usr/share/man \
216 "$WORKSPACE/LICENSE-2.0.txt=/usr/share/doc/libarvados-perl/LICENSE-2.0.txt" && \
217 mv --no-clobber libarvados-perl*.$FORMAT "$WORKSPACE/packages/$TARGET/"
222 debug_echo -e "\nRuby gems\n"
224 FPM_GEM_PREFIX=$($GEM environment gemdir)
226 cd "$WORKSPACE/sdk/ruby"
227 handle_ruby_gem arvados
229 cd "$WORKSPACE/sdk/cli"
230 handle_ruby_gem arvados-cli
232 cd "$WORKSPACE/services/login-sync"
233 handle_ruby_gem arvados-login-sync
236 debug_echo -e "\nPython packages\n"
238 cd "$WORKSPACE/sdk/pam"
239 handle_python_package
241 cd "$WORKSPACE/sdk/python"
242 handle_python_package
244 cd "$WORKSPACE/sdk/cwl"
245 handle_python_package
247 cd "$WORKSPACE/services/fuse"
248 handle_python_package
250 cd "$WORKSPACE/services/nodemanager"
251 handle_python_package
256 COMMIT_HASH=$(format_last_commit_here "%H")
257 arvados_src_version="$(version_from_git)"
259 cd $WORKSPACE/packages/$TARGET
260 test_package_presence arvados-src $arvados_src_version src
262 if [[ "$?" == "0" ]]; then
264 SRC_BUILD_DIR=$(mktemp -d)
265 # mktemp creates the directory with 0700 permissions by default
266 chmod 755 $SRC_BUILD_DIR
267 git clone $DASHQ_UNLESS_DEBUG "$WORKSPACE/.git" "$SRC_BUILD_DIR"
270 # go into detached-head state
271 git checkout $DASHQ_UNLESS_DEBUG "$COMMIT_HASH"
272 echo "$COMMIT_HASH" >git-commit.version
275 PKG_VERSION=$(version_from_git)
276 cd $WORKSPACE/packages/$TARGET
277 fpm_build $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"
279 rm -rf "$SRC_BUILD_DIR"
284 # On older platforms we need to publish a backport of libfuse >=2.9.2,
285 # and we need to build and install it here in order to even build an
287 cd $WORKSPACE/packages/$TARGET
288 if [[ $TARGET =~ ubuntu1204 ]]; then
289 # port libfuse 2.9.2 to Ubuntu 12.04
290 LIBFUSE_DIR=$(mktemp -d)
293 # download fuse 2.9.2 ubuntu 14.04 source package
294 file="fuse_2.9.2.orig.tar.xz" && curl -L -o "${file}" "http://archive.ubuntu.com/ubuntu/pool/main/f/fuse/${file}"
295 file="fuse_2.9.2-4ubuntu4.14.04.1.debian.tar.xz" && curl -L -o "${file}" "http://archive.ubuntu.com/ubuntu/pool/main/f/fuse/${file}"
296 file="fuse_2.9.2-4ubuntu4.14.04.1.dsc" && curl -L -o "${file}" "http://archive.ubuntu.com/ubuntu/pool/main/f/fuse/${file}"
298 # install dpkg-source and dpkg-buildpackage commands
299 apt-get install -y --no-install-recommends dpkg-dev
301 # extract source and apply patches
302 dpkg-source -x fuse_2.9.2-4ubuntu4.14.04.1.dsc
303 rm -f fuse_2.9.2.orig.tar.xz fuse_2.9.2-4ubuntu4.14.04.1.debian.tar.xz fuse_2.9.2-4ubuntu4.14.04.1.dsc
305 # add new version to changelog
308 echo "fuse (2.9.2-5) precise; urgency=low"
310 echo " * Backported from trusty-security to precise"
312 echo " -- Joshua Randall <jcrandall@alum.mit.edu> Thu, 4 Feb 2016 11:31:00 -0000"
315 ) > debian/changelog.new
316 mv debian/changelog.new debian/changelog
318 # install build-deps and build
319 apt-get install -y --no-install-recommends debhelper dh-autoreconf libselinux-dev
320 dpkg-buildpackage -rfakeroot -b
322 fpm_build "$LIBFUSE_DIR/fuse_2.9.2-5_amd64.deb" fuse "Ubuntu Developers" deb "2.9.2" --iteration 5
323 fpm_build "$LIBFUSE_DIR/libfuse2_2.9.2-5_amd64.deb" libfuse2 "Ubuntu Developers" deb "2.9.2" --iteration 5
324 fpm_build "$LIBFUSE_DIR/libfuse-dev_2.9.2-5_amd64.deb" libfuse-dev "Ubuntu Developers" deb "2.9.2" --iteration 5
326 "$WORKSPACE/packages/$TARGET/fuse_2.9.2-5_amd64.deb" \
327 "$WORKSPACE/packages/$TARGET/libfuse2_2.9.2-5_amd64.deb" \
328 "$WORKSPACE/packages/$TARGET/libfuse-dev_2.9.2-5_amd64.deb"
329 apt-get -y --no-install-recommends -f install
334 cd $WORKSPACE/packages/$TARGET
335 export GOPATH=$(mktemp -d)
336 package_go_binary sdk/go/crunchrunner crunchrunner \
337 "Crunchrunner executes a command inside a container and uploads the output"
338 package_go_binary services/arv-git-httpd arvados-git-httpd \
339 "Provide authenticated http access to Arvados-hosted git repositories"
340 package_go_binary services/crunch-dispatch-local crunch-dispatch-local \
341 "Dispatch Crunch containers on the local system"
342 package_go_binary services/crunch-dispatch-slurm crunch-dispatch-slurm \
343 "Dispatch Crunch containers to a SLURM cluster"
344 package_go_binary services/crunch-run crunch-run \
345 "Supervise a single Crunch container"
346 package_go_binary services/crunchstat crunchstat \
347 "Gather cpu/memory/network statistics of running Crunch jobs"
348 package_go_binary services/keep-balance keep-balance \
349 "Rebalance and garbage-collect data blocks stored in Arvados Keep"
350 package_go_binary services/keepproxy keepproxy \
351 "Make a Keep cluster accessible to clients that are not on the LAN"
352 package_go_binary services/keepstore keepstore \
353 "Keep storage daemon, accessible to clients on the LAN"
354 package_go_binary services/keep-web keep-web \
355 "Static web hosting service for user data stored in Arvados Keep"
356 package_go_binary services/ws arvados-ws \
357 "Arvados Websocket server"
358 package_go_binary tools/keep-block-check keep-block-check \
359 "Verify that all data from one set of Keep servers to another was copied"
360 package_go_binary tools/keep-rsync keep-rsync \
361 "Copy all data from one set of Keep servers to another"
362 package_go_binary tools/keep-exercise keep-exercise \
363 "Performance testing tool for Arvados Keep"
366 # Please resist the temptation to add --no-python-fix-name to the fpm call here
367 # (which would remove the python- prefix from the package name), because this
368 # package is a dependency of arvados-fuse, and fpm can not omit the python-
369 # prefix from only one of the dependencies of a package... Maybe I could
370 # whip up a patch and send it upstream, but that will be for another day. Ward,
372 cd $WORKSPACE/packages/$TARGET
373 rm -rf "$WORKSPACE/sdk/python/build"
374 arvados_python_client_version=$(awk '($1 == "Version:"){print $2}' $WORKSPACE/sdk/python/arvados_python_client.egg-info/PKG-INFO)
375 test_package_presence ${PYTHON2_PKG_PREFIX}-arvados-python-client "$arvados_python_client_version" python
376 if [[ "$?" == "0" ]]; then
377 fpm_build $WORKSPACE/sdk/python "${PYTHON2_PKG_PREFIX}-arvados-python-client" 'Curoverse, Inc.' 'python' "$arvados_python_client_version" "--url=https://arvados.org" "--description=The Arvados Python SDK" --depends "${PYTHON2_PKG_PREFIX}-setuptools" --deb-recommends=git
381 cd $WORKSPACE/packages/$TARGET
382 rm -rf "$WORKSPACE/sdk/cwl/build"
383 arvados_cwl_runner_version=$(awk '($1 == "Version:"){print $2}' $WORKSPACE/sdk/cwl/arvados_cwl_runner.egg-info/PKG-INFO)
384 arvados_cwl_runner_iteration=3
385 test_package_presence ${PYTHON2_PKG_PREFIX}-arvados-cwl-runner "$arvados_cwl_runner_version" python "$arvados_cwl_runner_iteration"
386 if [[ "$?" == "0" ]]; then
387 fpm_build $WORKSPACE/sdk/cwl "${PYTHON2_PKG_PREFIX}-arvados-cwl-runner" 'Curoverse, Inc.' 'python' "$arvados_cwl_runner_version" "--url=https://arvados.org" "--description=The Arvados CWL runner" --depends "${PYTHON2_PKG_PREFIX}-setuptools" --iteration $arvados_cwl_runner_iteration
390 # schema_salad. This is a python dependency of arvados-cwl-runner,
391 # but we can't use the usual PYTHONPACKAGES way to build this package due to the
392 # intricacies of how version numbers get generated in setup.py: we need a specific version,
393 # e.g. 1.7.20160316203940. If we don't explicitly list that version with the -v
394 # argument to fpm, and instead specify it as schema_salad==1.7.20160316203940, we get
395 # a package with version 1.7. That's because our gittagger hack is not being
396 # picked up by self.distribution.get_version(), which is called from
397 # https://github.com/jordansissel/fpm/blob/master/lib/fpm/package/pyfpm/get_metadata.py
398 # by means of this command:
400 # python2.7 setup.py --command-packages=pyfpm get_metadata --output=metadata.json
402 # So we build this thing separately.
405 saladversion=$(cat "$WORKSPACE/sdk/cwl/setup.py" | grep schema-salad== | sed "s/.*==\(.*\)'.*/\1/")
406 test_package_presence python-schema-salad "$saladversion" python
407 if [[ "$?" == "0" ]]; then
408 fpm_build schema_salad "" "" python $saladversion --depends "${PYTHON2_PKG_PREFIX}-lockfile >= 1:0.12.2-2"
411 # And for cwltool we have the same problem as for schema_salad. Ward, 2016-03-17
412 cwltoolversion=$(cat "$WORKSPACE/sdk/cwl/setup.py" | grep cwltool== | sed "s/.*==\(.*\)'.*/\1/")
413 test_package_presence python-cwltool "$cwltoolversion" python
414 if [[ "$?" == "0" ]]; then
415 fpm_build cwltool "" "" python $cwltoolversion
419 if [[ $TARGET =~ debian|ubuntu ]]; then
420 cd $WORKSPACE/packages/$TARGET
421 rm -rf "$WORKSPACE/sdk/pam/build"
422 libpam_arvados_version=$(awk '($1 == "Version:"){print $2}' $WORKSPACE/sdk/pam/arvados_pam.egg-info/PKG-INFO)
423 test_package_presence libpam-arvados "$libpam_arvados_version" python
424 if [[ "$?" == "0" ]]; then
425 fpm_build $WORKSPACE/sdk/pam libpam-arvados 'Curoverse, Inc.' 'python' "$libpam_arvados_version" "--url=https://arvados.org" "--description=PAM module for authenticating shell logins using Arvados API tokens" --depends libpam-python
430 # Please see comment about --no-python-fix-name above; we stay consistent and do
431 # not omit the python- prefix first.
432 cd $WORKSPACE/packages/$TARGET
433 rm -rf "$WORKSPACE/services/fuse/build"
434 arvados_fuse_version=$(awk '($1 == "Version:"){print $2}' $WORKSPACE/services/fuse/arvados_fuse.egg-info/PKG-INFO)
435 test_package_presence "${PYTHON2_PKG_PREFIX}-arvados-fuse" "$arvados_fuse_version" python
436 if [[ "$?" == "0" ]]; then
437 fpm_build $WORKSPACE/services/fuse "${PYTHON2_PKG_PREFIX}-arvados-fuse" 'Curoverse, Inc.' 'python' "$arvados_fuse_version" "--url=https://arvados.org" "--description=The Keep FUSE driver" --depends "${PYTHON2_PKG_PREFIX}-setuptools"
441 cd $WORKSPACE/packages/$TARGET
442 rm -rf "$WORKSPACE/services/nodemanager/build"
443 nodemanager_version=$(awk '($1 == "Version:"){print $2}' $WORKSPACE/services/nodemanager/arvados_node_manager.egg-info/PKG-INFO)
444 test_package_presence arvados-node-manager "$nodemanager_version" python
445 if [[ "$?" == "0" ]]; then
446 fpm_build $WORKSPACE/services/nodemanager arvados-node-manager 'Curoverse, Inc.' 'python' "$nodemanager_version" "--url=https://arvados.org" "--description=The Arvados node manager" --depends "${PYTHON2_PKG_PREFIX}-setuptools"
449 # The Docker image cleaner
450 cd $WORKSPACE/packages/$TARGET
451 rm -rf "$WORKSPACE/services/dockercleaner/build"
452 dockercleaner_version=$(awk '($1 == "Version:"){print $2}' $WORKSPACE/services/dockercleaner/arvados_docker_cleaner.egg-info/PKG-INFO)
453 dockercleaner_iteration=3
454 test_package_presence arvados-docker-cleaner "$dockercleaner_version" python "$dockercleaner_iteration"
455 if [[ "$?" == "0" ]]; then
456 fpm_build $WORKSPACE/services/dockercleaner arvados-docker-cleaner 'Curoverse, Inc.' 'python3' "$dockercleaner_version" "--url=https://arvados.org" "--description=The Arvados Docker image cleaner" --depends "${PYTHON3_PKG_PREFIX}-websocket-client = 0.37.0" --iteration "$dockercleaner_iteration"
459 # The Arvados crunchstat-summary tool
460 cd $WORKSPACE/packages/$TARGET
461 crunchstat_summary_version=$(awk '($1 == "Version:"){print $2}' $WORKSPACE/tools/crunchstat-summary/crunchstat_summary.egg-info/PKG-INFO)
462 test_package_presence "$PYTHON2_PKG_PREFIX"-crunchstat-summary "$crunchstat_summary_version" python
463 if [[ "$?" == "0" ]]; then
464 rm -rf "$WORKSPACE/tools/crunchstat-summary/build"
465 fpm_build $WORKSPACE/tools/crunchstat-summary ${PYTHON2_PKG_PREFIX}-crunchstat-summary 'Curoverse, Inc.' 'python' "$crunchstat_summary_version" "--url=https://arvados.org" "--description=Crunchstat-summary reads Arvados Crunch log files and summarize resource usage"
468 if [[ -z "$ONLY_BUILD" ]] || [[ "${PYTHON2_PKG_PREFIX}-apache-libcloud" == "$ONLY_BUILD" ]] ; then
470 LIBCLOUD_DIR=$(mktemp -d)
473 git clone $DASHQ_UNLESS_DEBUG https://github.com/curoverse/libcloud.git .
474 git checkout $DASHQ_UNLESS_DEBUG apache-libcloud-$LIBCLOUD_PIN
475 # libcloud is absurdly noisy without -q, so force -q here
476 OLD_DASHQ_UNLESS_DEBUG=$DASHQ_UNLESS_DEBUG
477 DASHQ_UNLESS_DEBUG=-q
478 handle_python_package
479 DASHQ_UNLESS_DEBUG=$OLD_DASHQ_UNLESS_DEBUG
481 fpm_build $LIBCLOUD_DIR "$PYTHON2_PKG_PREFIX"-apache-libcloud
485 # Python 2 dependencies
486 declare -a PIP_DOWNLOAD_SWITCHES=(--no-deps)
487 # Add --no-use-wheel if this pip knows it.
488 pip wheel --help >/dev/null 2>&1
490 0) PIP_DOWNLOAD_SWITCHES+=(--no-use-wheel) ;;
492 *) echo "WARNING: `pip wheel` test returned unknown exit code $?" ;;
495 while read -r line || [[ -n "$line" ]]; do
496 # echo "Text read from file: $line"
497 if [[ "$line" =~ ^# ]]; then
500 IFS='|'; arr=($line); unset IFS
504 IFS=',';dists=($dist); unset IFS
507 for d in "${dists[@]}"; do
508 if [[ "$d" == "$TARGET" ]] || [[ "$d" == "all" ]]; then
513 if [[ "$MATCH" != "1" ]]; then
523 if [[ "$FORMAT" == "rpm" ]]; then
524 if [[ "$arch" == "all" ]]; then
527 if [[ "$arch" == "amd64" ]]; then
532 if [[ "$pkgtype" == "python" ]]; then
533 outname=$(echo "$name" | sed -e 's/^python-//' -e 's/_/-/g' -e "s/^/${PYTHON2_PKG_PREFIX}-/")
535 outname=$(echo "$name" | sed -e 's/^python-//' -e 's/_/-/g' -e "s/^/${PYTHON3_PKG_PREFIX}-/")
538 if [[ -n "$ONLY_BUILD" ]] && [[ "$outname" != "$ONLY_BUILD" ]] ; then
543 httplib2|google-api-python-client)
544 test_package_presence $outname $version $pkgtype $iteration $arch
545 if [[ "$?" == "0" ]]; then
546 # Work around 0640 permissions on some package files.
547 # See #7591 and #7991.
548 pyfpm_workdir=$(mktemp --tmpdir -d pyfpm-XXXXXX) && (
551 pip install "${PIP_DOWNLOAD_SWITCHES[@]}" --download . "$name==$version"
552 # Sometimes pip gives us a tarball, sometimes a zip file...
553 DOWNLOADED=`ls $name-*`
554 [[ "$DOWNLOADED" =~ ".tar" ]] && tar -xf $DOWNLOADED
555 [[ "$DOWNLOADED" =~ ".zip" ]] && unzip $DOWNLOADED
557 "python$PYTHON2_VERSION" setup.py $DASHQ_UNLESS_DEBUG egg_info build
560 fpm_build . "$outname" "" "$pkgtype" "$version" --iteration "$iteration" $extra
561 # The upload step uses the package timestamp to determine
562 # if it is new. --no-clobber plays nice with that.
563 mv --no-clobber "$outname"*.$FORMAT "$WORKSPACE/packages/$TARGET"
565 if [ 0 != "$?" ]; then
566 echo "ERROR: $name build process failed"
569 if [ -n "$pyfpm_workdir" ]; then
570 rm -rf "$pyfpm_workdir"
575 test_package_presence $outname $version $pkgtype $iteration $arch
576 if [[ "$?" == "0" ]]; then
577 fpm_build "$name" "$outname" "" "$pkgtype" "$version" --iteration "$iteration" $extra
582 done <`dirname "$(readlink -f "$0")"`"/build.list"
584 # Build the API server package
585 test_rails_package_presence arvados-api-server "$WORKSPACE/services/api"
586 if [[ "$?" == "0" ]]; then
587 handle_rails_package arvados-api-server "$WORKSPACE/services/api" \
588 "$WORKSPACE/agpl-3.0.txt" --url="https://arvados.org" \
589 --description="Arvados API server - Arvados is a free and open source platform for big data science." \
590 --license="GNU Affero General Public License, version 3.0"
593 # Build the workbench server package
594 test_rails_package_presence arvados-workbench "$WORKSPACE/apps/workbench"
595 if [[ "$?" == "0" ]] ; then
598 cd "$WORKSPACE/apps/workbench"
600 # We need to bundle to be ready even when we build a package without vendor directory
601 # because asset compilation requires it.
602 bundle install --path vendor/bundle >"$STDOUT_IF_DEBUG"
604 # clear the tmp directory; the asset generation step will recreate tmp/cache/assets,
605 # and we want that in the package, so it's easier to not exclude the tmp directory
606 # from the package - empty it instead.
610 # Set up application.yml and production.rb so that asset precompilation works
611 \cp config/application.yml.example config/application.yml -f
612 \cp config/environments/production.rb.example config/environments/production.rb -f
613 sed -i 's/secret_token: ~/secret_token: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/' config/application.yml
615 RAILS_ENV=production RAILS_GROUPS=assets bundle exec rake assets:precompile >/dev/null
617 # Remove generated configuration files so they don't go in the package.
618 rm config/application.yml config/environments/production.rb
621 if [[ "$?" != "0" ]]; then
622 echo "ERROR: Asset precompilation failed"
625 handle_rails_package arvados-workbench "$WORKSPACE/apps/workbench" \
626 "$WORKSPACE/agpl-3.0.txt" --url="https://arvados.org" \
627 --description="Arvados Workbench - Arvados is a free and open source platform for big data science." \
628 --license="GNU Affero General Public License, version 3.0"
632 # clean up temporary GOPATH