2 # Copyright (C) The Arvados Authors. All rights reserved.
4 # SPDX-License-Identifier: AGPL-3.0
6 . `dirname "$(readlink -f "$0")"`/run-library.sh
7 . `dirname "$(readlink -f "$0")"`/libcloud-pin.sh
9 read -rd "\000" helpmessage <<EOF
10 $(basename $0): Build Arvados packages
13 WORKSPACE=/path/to/arvados $(basename $0) [options]
17 --build-bundle-packages (default: false)
18 Build api server and workbench packages with vendor/bundle included
20 Output debug information (default: false)
22 Distribution to build packages for (default: debian8)
23 --only-build <package>
24 Build only a specific package (or $ONLY_BUILD from environment)
26 Build command to execute (defaults to the run command defined in the
29 WORKSPACE=path Path to the Arvados source tree to build packages from
34 DEBUG=${ARVADOS_DEBUG:-0}
38 PARSEDOPTS=$(getopt --name "$0" --longoptions \
39 help,build-bundle-packages,debug,target:,only-build: \
45 eval set -- "$PARSEDOPTS"
46 while [ $# -gt 0 ]; do
49 echo >&2 "$helpmessage"
57 ONLY_BUILD="$2"; shift
67 echo >&2 "$0: unrecognized argument '$2'. Try: $0 --help"
75 if [[ "$COMMAND" != "" ]]; then
76 COMMAND="/usr/local/rvm/bin/rvm-exec default bash /jenkins/$COMMAND --target $TARGET"
79 STDOUT_IF_DEBUG=/dev/null
80 STDERR_IF_DEBUG=/dev/null
82 if [[ "$DEBUG" != 0 ]]; then
83 STDOUT_IF_DEBUG=/dev/stdout
84 STDERR_IF_DEBUG=/dev/stderr
88 declare -a PYTHON_BACKPORTS PYTHON3_BACKPORTS
91 PYTHON3_VERSION=$(python3 -c 'import sys; print("{v.major}.{v.minor}".format(v=sys.version_info))')
93 ## These defaults are suitable for any Debian-based distribution.
94 # You can customize them as needed in distro sections below.
95 PYTHON2_PACKAGE=python$PYTHON2_VERSION
96 PYTHON2_PKG_PREFIX=python
98 PYTHON2_INSTALL_LIB=lib/python$PYTHON2_VERSION/dist-packages
100 PYTHON3_PACKAGE=python$PYTHON3_VERSION
101 PYTHON3_PKG_PREFIX=python3
103 PYTHON3_INSTALL_LIB=lib/python$PYTHON3_VERSION/dist-packages
104 ## End Debian Python defaults.
121 PYTHON2_PACKAGE=$(rpm -qf "$(which python$PYTHON2_VERSION)" --queryformat '%{NAME}\n')
122 PYTHON2_PKG_PREFIX=$PYTHON2_PACKAGE
123 PYTHON2_INSTALL_LIB=lib/python$PYTHON2_VERSION/site-packages
124 PYTHON3_PACKAGE=$(rpm -qf "$(which python$PYTHON3_VERSION)" --queryformat '%{NAME}\n')
125 PYTHON3_PKG_PREFIX=$PYTHON3_PACKAGE
126 PYTHON3_PREFIX=/opt/rh/python33/root/usr
127 PYTHON3_INSTALL_LIB=lib/python$PYTHON3_VERSION/site-packages
128 export PYCURL_SSL_LIBRARY=nss
131 echo -e "$0: Unknown target '$TARGET'.\n" >&2
137 if ! [[ -n "$WORKSPACE" ]]; then
138 echo >&2 "$helpmessage"
140 echo >&2 "Error: WORKSPACE environment variable not set"
146 fpm --version >/dev/null 2>&1
148 if [[ "$?" != 0 ]]; then
149 echo >&2 "$helpmessage"
151 echo >&2 "Error: fpm not found"
156 EASY_INSTALL2=$(find_easy_install -$PYTHON2_VERSION "")
157 EASY_INSTALL3=$(find_easy_install -$PYTHON3_VERSION 3)
159 RUN_BUILD_PACKAGES_PATH="`dirname \"$0\"`"
160 RUN_BUILD_PACKAGES_PATH="`( cd \"$RUN_BUILD_PACKAGES_PATH\" && pwd )`" # absolutized and normalized
161 if [ -z "$RUN_BUILD_PACKAGES_PATH" ] ; then
162 # error; for some reason, the path is not accessible
163 # to the script (e.g. permissions re-evaled after suid)
167 debug_echo "$0 is running from $RUN_BUILD_PACKAGES_PATH"
168 debug_echo "Workspace is $WORKSPACE"
170 if [[ -f /etc/profile.d/rvm.sh ]]; then
171 source /etc/profile.d/rvm.sh
172 GEM="rvm-exec default gem"
177 # Make all files world-readable -- jenkins runs with umask 027, and has checked
178 # out our git tree here
179 chmod o+r "$WORKSPACE" -R
181 # More cleanup - make sure all executables that we'll package are 755
183 find -type d -name 'bin' |xargs -I {} find {} -type f |xargs -I {} chmod 755 {}
185 # Now fix our umask to something better suited to building and publishing
189 debug_echo "umask is" `umask`
191 if [[ ! -d "$WORKSPACE/packages/$TARGET" ]]; then
192 mkdir -p $WORKSPACE/packages/$TARGET
193 chown --reference="$WORKSPACE" "$WORKSPACE/packages/$TARGET"
197 debug_echo -e "\nPerl packages\n"
199 if [[ -z "$ONLY_BUILD" ]] || [[ "libarvados-perl" = "$ONLY_BUILD" ]] ; then
200 cd "$WORKSPACE/sdk/perl"
201 libarvados_perl_version="$(version_from_git)"
203 cd $WORKSPACE/packages/$TARGET
204 test_package_presence libarvados-perl "$libarvados_perl_version"
206 if [[ "$?" == "0" ]]; then
207 cd "$WORKSPACE/sdk/perl"
209 if [[ -e Makefile ]]; then
210 make realclean >"$STDOUT_IF_DEBUG"
212 find -maxdepth 1 \( -name 'MANIFEST*' -or -name "libarvados-perl*.$FORMAT" \) \
216 perl Makefile.PL INSTALL_BASE=install >"$STDOUT_IF_DEBUG" && \
217 make install INSTALLDIRS=perl >"$STDOUT_IF_DEBUG" && \
218 fpm_build install/lib/=/usr/share libarvados-perl \
219 "Curoverse, Inc." dir "$(version_from_git)" install/man/=/usr/share/man \
220 "$WORKSPACE/LICENSE-2.0.txt=/usr/share/doc/libarvados-perl/LICENSE-2.0.txt" && \
221 mv --no-clobber libarvados-perl*.$FORMAT "$WORKSPACE/packages/$TARGET/"
226 debug_echo -e "\nRuby gems\n"
228 FPM_GEM_PREFIX=$($GEM environment gemdir)
230 cd "$WORKSPACE/sdk/ruby"
231 handle_ruby_gem arvados
233 cd "$WORKSPACE/sdk/cli"
234 handle_ruby_gem arvados-cli
236 cd "$WORKSPACE/services/login-sync"
237 handle_ruby_gem arvados-login-sync
240 debug_echo -e "\nPython packages\n"
242 cd "$WORKSPACE/sdk/pam"
243 handle_python_package
245 cd "$WORKSPACE/sdk/python"
246 handle_python_package
248 cd "$WORKSPACE/sdk/cwl"
249 handle_python_package
251 cd "$WORKSPACE/services/fuse"
252 handle_python_package
254 cd "$WORKSPACE/services/nodemanager"
255 handle_python_package
260 COMMIT_HASH=$(format_last_commit_here "%H")
261 arvados_src_version="$(version_from_git)"
263 cd $WORKSPACE/packages/$TARGET
264 test_package_presence arvados-src $arvados_src_version src ""
266 if [[ "$?" == "0" ]]; then
268 SRC_BUILD_DIR=$(mktemp -d)
269 # mktemp creates the directory with 0700 permissions by default
270 chmod 755 $SRC_BUILD_DIR
271 git clone $DASHQ_UNLESS_DEBUG "$WORKSPACE/.git" "$SRC_BUILD_DIR"
274 # go into detached-head state
275 git checkout $DASHQ_UNLESS_DEBUG "$COMMIT_HASH"
276 echo "$COMMIT_HASH" >git-commit.version
279 PKG_VERSION=$(version_from_git)
280 cd $WORKSPACE/packages/$TARGET
281 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"
283 rm -rf "$SRC_BUILD_DIR"
288 # On older platforms we need to publish a backport of libfuse >=2.9.2,
289 # and we need to build and install it here in order to even build an
291 cd $WORKSPACE/packages/$TARGET
292 if [[ $TARGET =~ ubuntu1204 ]]; then
293 # port libfuse 2.9.2 to Ubuntu 12.04
294 LIBFUSE_DIR=$(mktemp -d)
297 # download fuse 2.9.2 ubuntu 14.04 source package
298 file="fuse_2.9.2.orig.tar.xz" && curl -L -o "${file}" "http://archive.ubuntu.com/ubuntu/pool/main/f/fuse/${file}"
299 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}"
300 file="fuse_2.9.2-4ubuntu4.14.04.1.dsc" && curl -L -o "${file}" "http://archive.ubuntu.com/ubuntu/pool/main/f/fuse/${file}"
302 # install dpkg-source and dpkg-buildpackage commands
303 apt-get install -y --no-install-recommends dpkg-dev
305 # extract source and apply patches
306 dpkg-source -x fuse_2.9.2-4ubuntu4.14.04.1.dsc
307 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
309 # add new version to changelog
312 echo "fuse (2.9.2-5) precise; urgency=low"
314 echo " * Backported from trusty-security to precise"
316 echo " -- Joshua Randall <jcrandall@alum.mit.edu> Thu, 4 Feb 2016 11:31:00 -0000"
319 ) > debian/changelog.new
320 mv debian/changelog.new debian/changelog
322 # install build-deps and build
323 apt-get install -y --no-install-recommends debhelper dh-autoreconf libselinux-dev
324 dpkg-buildpackage -rfakeroot -b
326 fpm_build "$LIBFUSE_DIR/fuse_2.9.2-5_amd64.deb" fuse "Ubuntu Developers" deb "2.9.2" --iteration 5
327 fpm_build "$LIBFUSE_DIR/libfuse2_2.9.2-5_amd64.deb" libfuse2 "Ubuntu Developers" deb "2.9.2" --iteration 5
328 fpm_build "$LIBFUSE_DIR/libfuse-dev_2.9.2-5_amd64.deb" libfuse-dev "Ubuntu Developers" deb "2.9.2" --iteration 5
330 "$WORKSPACE/packages/$TARGET/fuse_2.9.2-5_amd64.deb" \
331 "$WORKSPACE/packages/$TARGET/libfuse2_2.9.2-5_amd64.deb" \
332 "$WORKSPACE/packages/$TARGET/libfuse-dev_2.9.2-5_amd64.deb"
333 apt-get -y --no-install-recommends -f install
338 cd $WORKSPACE/packages/$TARGET
339 export GOPATH=$(mktemp -d)
340 package_go_binary sdk/go/crunchrunner crunchrunner \
341 "Crunchrunner executes a command inside a container and uploads the output"
342 package_go_binary services/arv-git-httpd arvados-git-httpd \
343 "Provide authenticated http access to Arvados-hosted git repositories"
344 package_go_binary services/crunch-dispatch-local crunch-dispatch-local \
345 "Dispatch Crunch containers on the local system"
346 package_go_binary services/crunch-dispatch-slurm crunch-dispatch-slurm \
347 "Dispatch Crunch containers to a SLURM cluster"
348 package_go_binary services/crunch-run crunch-run \
349 "Supervise a single Crunch container"
350 package_go_binary services/crunchstat crunchstat \
351 "Gather cpu/memory/network statistics of running Crunch jobs"
352 package_go_binary services/keep-balance keep-balance \
353 "Rebalance and garbage-collect data blocks stored in Arvados Keep"
354 package_go_binary services/keepproxy keepproxy \
355 "Make a Keep cluster accessible to clients that are not on the LAN"
356 package_go_binary services/keepstore keepstore \
357 "Keep storage daemon, accessible to clients on the LAN"
358 package_go_binary services/keep-web keep-web \
359 "Static web hosting service for user data stored in Arvados Keep"
360 package_go_binary services/ws arvados-ws \
361 "Arvados Websocket server"
362 package_go_binary tools/keep-block-check keep-block-check \
363 "Verify that all data from one set of Keep servers to another was copied"
364 package_go_binary tools/keep-rsync keep-rsync \
365 "Copy all data from one set of Keep servers to another"
366 package_go_binary tools/keep-exercise keep-exercise \
367 "Performance testing tool for Arvados Keep"
370 # Please resist the temptation to add --no-python-fix-name to the fpm call here
371 # (which would remove the python- prefix from the package name), because this
372 # package is a dependency of arvados-fuse, and fpm can not omit the python-
373 # prefix from only one of the dependencies of a package... Maybe I could
374 # whip up a patch and send it upstream, but that will be for another day. Ward,
376 cd $WORKSPACE/packages/$TARGET
377 rm -rf "$WORKSPACE/sdk/python/build"
378 arvados_python_client_version=$(awk '($1 == "Version:"){print $2}' $WORKSPACE/sdk/python/arvados_python_client.egg-info/PKG-INFO)
379 test_package_presence ${PYTHON2_PKG_PREFIX}-arvados-python-client "$arvados_python_client_version" python
380 if [[ "$?" == "0" ]]; then
381 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
385 cd $WORKSPACE/packages/$TARGET
386 rm -rf "$WORKSPACE/sdk/cwl/build"
387 arvados_cwl_runner_version=$(awk '($1 == "Version:"){print $2}' $WORKSPACE/sdk/cwl/arvados_cwl_runner.egg-info/PKG-INFO)
388 arvados_cwl_runner_iteration=3
389 test_package_presence ${PYTHON2_PKG_PREFIX}-arvados-cwl-runner "$arvados_cwl_runner_version" python "$arvados_cwl_runner_iteration"
390 if [[ "$?" == "0" ]]; then
391 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
394 # schema_salad. This is a python dependency of arvados-cwl-runner,
395 # but we can't use the usual PYTHONPACKAGES way to build this package due to the
396 # intricacies of how version numbers get generated in setup.py: we need a specific version,
397 # e.g. 1.7.20160316203940. If we don't explicitly list that version with the -v
398 # argument to fpm, and instead specify it as schema_salad==1.7.20160316203940, we get
399 # a package with version 1.7. That's because our gittagger hack is not being
400 # picked up by self.distribution.get_version(), which is called from
401 # https://github.com/jordansissel/fpm/blob/master/lib/fpm/package/pyfpm/get_metadata.py
402 # by means of this command:
404 # python2.7 setup.py --command-packages=pyfpm get_metadata --output=metadata.json
406 # So we build this thing separately.
409 saladversion=$(cat "$WORKSPACE/sdk/cwl/setup.py" | grep schema-salad== | sed "s/.*==\(.*\)'.*/\1/")
410 test_package_presence python-schema-salad "$saladversion" python
411 if [[ "$?" == "0" ]]; then
412 fpm_build schema_salad "" "" python $saladversion --depends "${PYTHON2_PKG_PREFIX}-lockfile >= 1:0.12.2-2" --depends "${PYTHON2_PKG_PREFIX}-avro = 1.8.1-2"
415 # And for cwltool we have the same problem as for schema_salad. Ward, 2016-03-17
416 cwltoolversion=$(cat "$WORKSPACE/sdk/cwl/setup.py" | grep cwltool== | sed "s/.*==\(.*\)'.*/\1/")
417 test_package_presence python-cwltool "$cwltoolversion" python
418 if [[ "$?" == "0" ]]; then
419 fpm_build cwltool "" "" python $cwltoolversion
423 if [[ $TARGET =~ debian|ubuntu ]]; then
424 cd $WORKSPACE/packages/$TARGET
425 rm -rf "$WORKSPACE/sdk/pam/build"
426 libpam_arvados_version=$(awk '($1 == "Version:"){print $2}' $WORKSPACE/sdk/pam/arvados_pam.egg-info/PKG-INFO)
427 test_package_presence libpam-arvados "$libpam_arvados_version" python
428 if [[ "$?" == "0" ]]; then
429 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
434 # Please see comment about --no-python-fix-name above; we stay consistent and do
435 # not omit the python- prefix first.
436 cd $WORKSPACE/packages/$TARGET
437 rm -rf "$WORKSPACE/services/fuse/build"
438 arvados_fuse_version=$(awk '($1 == "Version:"){print $2}' $WORKSPACE/services/fuse/arvados_fuse.egg-info/PKG-INFO)
439 test_package_presence "${PYTHON2_PKG_PREFIX}-arvados-fuse" "$arvados_fuse_version" python
440 if [[ "$?" == "0" ]]; then
441 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"
445 cd $WORKSPACE/packages/$TARGET
446 rm -rf "$WORKSPACE/services/nodemanager/build"
447 nodemanager_version=$(awk '($1 == "Version:"){print $2}' $WORKSPACE/services/nodemanager/arvados_node_manager.egg-info/PKG-INFO)
448 test_package_presence arvados-node-manager "$nodemanager_version" python
449 if [[ "$?" == "0" ]]; then
450 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"
453 # The Docker image cleaner
454 cd $WORKSPACE/packages/$TARGET
455 rm -rf "$WORKSPACE/services/dockercleaner/build"
456 dockercleaner_version=$(awk '($1 == "Version:"){print $2}' $WORKSPACE/services/dockercleaner/arvados_docker_cleaner.egg-info/PKG-INFO)
457 dockercleaner_iteration=3
458 test_package_presence arvados-docker-cleaner "$dockercleaner_version" python "$dockercleaner_iteration"
459 if [[ "$?" == "0" ]]; then
460 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"
463 # The Arvados crunchstat-summary tool
464 cd $WORKSPACE/packages/$TARGET
465 crunchstat_summary_version=$(awk '($1 == "Version:"){print $2}' $WORKSPACE/tools/crunchstat-summary/crunchstat_summary.egg-info/PKG-INFO)
466 test_package_presence "$PYTHON2_PKG_PREFIX"-crunchstat-summary "$crunchstat_summary_version" python
467 if [[ "$?" == "0" ]]; then
468 rm -rf "$WORKSPACE/tools/crunchstat-summary/build"
469 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"
472 if [[ -z "$ONLY_BUILD" ]] || [[ "${PYTHON2_PKG_PREFIX}-apache-libcloud" == "$ONLY_BUILD" ]] ; then
474 LIBCLOUD_DIR=$(mktemp -d)
477 git clone $DASHQ_UNLESS_DEBUG https://github.com/curoverse/libcloud.git .
478 git checkout $DASHQ_UNLESS_DEBUG apache-libcloud-$LIBCLOUD_PIN
479 # libcloud is absurdly noisy without -q, so force -q here
480 OLD_DASHQ_UNLESS_DEBUG=$DASHQ_UNLESS_DEBUG
481 DASHQ_UNLESS_DEBUG=-q
482 handle_python_package
483 DASHQ_UNLESS_DEBUG=$OLD_DASHQ_UNLESS_DEBUG
485 fpm_build $LIBCLOUD_DIR "$PYTHON2_PKG_PREFIX"-apache-libcloud
489 # Python 2 dependencies
490 declare -a PIP_DOWNLOAD_SWITCHES=(--no-deps)
491 # Add --no-use-wheel if this pip knows it.
492 pip wheel --help >/dev/null 2>&1
494 0) PIP_DOWNLOAD_SWITCHES+=(--no-use-wheel) ;;
496 *) echo "WARNING: `pip wheel` test returned unknown exit code $?" ;;
499 while read -r line || [[ -n "$line" ]]; do
500 # echo "Text read from file: $line"
501 if [[ "$line" =~ ^# ]]; then
504 IFS='|'; arr=($line); unset IFS
508 IFS=',';dists=($dist); unset IFS
511 for d in "${dists[@]}"; do
512 if [[ "$d" == "$TARGET" ]] || [[ "$d" == "all" ]]; then
517 if [[ "$MATCH" != "1" ]]; then
526 declare -a 'extra_arr=('"$extra"')'
528 if [[ "$FORMAT" == "rpm" ]]; then
529 if [[ "$arch" == "all" ]]; then
532 if [[ "$arch" == "amd64" ]]; then
537 if [[ "$pkgtype" == "python" ]]; then
538 outname=$(echo "$name" | sed -e 's/^python-//' -e 's/_/-/g' -e "s/^/${PYTHON2_PKG_PREFIX}-/")
540 outname=$(echo "$name" | sed -e 's/^python-//' -e 's/_/-/g' -e "s/^/${PYTHON3_PKG_PREFIX}-/")
543 if [[ -n "$ONLY_BUILD" ]] && [[ "$outname" != "$ONLY_BUILD" ]] ; then
548 httplib2|google-api-python-client)
549 test_package_presence $outname $version $pkgtype $iteration $arch
550 if [[ "$?" == "0" ]]; then
551 # Work around 0640 permissions on some package files.
552 # See #7591 and #7991.
553 pyfpm_workdir=$(mktemp --tmpdir -d pyfpm-XXXXXX) && (
556 pip install "${PIP_DOWNLOAD_SWITCHES[@]}" --download . "$name==$version"
557 # Sometimes pip gives us a tarball, sometimes a zip file...
558 DOWNLOADED=`ls $name-*`
559 [[ "$DOWNLOADED" =~ ".tar" ]] && tar -xf $DOWNLOADED
560 [[ "$DOWNLOADED" =~ ".zip" ]] && unzip $DOWNLOADED
562 "python$PYTHON2_VERSION" setup.py $DASHQ_UNLESS_DEBUG egg_info build
565 fpm_build . "$outname" "" "$pkgtype" "$version" --iteration "$iteration" "${extra_arr[@]}"
566 # The upload step uses the package timestamp to determine
567 # if it is new. --no-clobber plays nice with that.
568 mv --no-clobber "$outname"*.$FORMAT "$WORKSPACE/packages/$TARGET"
570 if [ 0 != "$?" ]; then
571 echo "ERROR: $name build process failed"
574 if [ -n "$pyfpm_workdir" ]; then
575 rm -rf "$pyfpm_workdir"
580 test_package_presence $outname $version $pkgtype $iteration $arch
581 if [[ "$?" == "0" ]]; then
582 fpm_build "$name" "$outname" "" "$pkgtype" "$version" --iteration "$iteration" "${extra_arr[@]}"
587 done <`dirname "$(readlink -f "$0")"`"/build.list"
589 # Build the API server package
590 test_rails_package_presence arvados-api-server "$WORKSPACE/services/api"
591 if [[ "$?" == "0" ]]; then
592 handle_rails_package arvados-api-server "$WORKSPACE/services/api" \
593 "$WORKSPACE/agpl-3.0.txt" --url="https://arvados.org" \
594 --description="Arvados API server - Arvados is a free and open source platform for big data science." \
595 --license="GNU Affero General Public License, version 3.0"
598 # Build the workbench server package
599 test_rails_package_presence arvados-workbench "$WORKSPACE/apps/workbench"
600 if [[ "$?" == "0" ]] ; then
603 cd "$WORKSPACE/apps/workbench"
605 # We need to bundle to be ready even when we build a package without vendor directory
606 # because asset compilation requires it.
607 bundle install --path vendor/bundle >"$STDOUT_IF_DEBUG"
609 # clear the tmp directory; the asset generation step will recreate tmp/cache/assets,
610 # and we want that in the package, so it's easier to not exclude the tmp directory
611 # from the package - empty it instead.
615 # Set up application.yml and production.rb so that asset precompilation works
616 \cp config/application.yml.example config/application.yml -f
617 \cp config/environments/production.rb.example config/environments/production.rb -f
618 sed -i 's/secret_token: ~/secret_token: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/' config/application.yml
620 RAILS_ENV=production RAILS_GROUPS=assets bundle exec rake assets:precompile >/dev/null
622 # Remove generated configuration files so they don't go in the package.
623 rm config/application.yml config/environments/production.rb
626 if [[ "$?" != "0" ]]; then
627 echo "ERROR: Asset precompilation failed"
630 handle_rails_package arvados-workbench "$WORKSPACE/apps/workbench" \
631 "$WORKSPACE/agpl-3.0.txt" --url="https://arvados.org" \
632 --description="Arvados Workbench - Arvados is a free and open source platform for big data science." \
633 --license="GNU Affero General Public License, version 3.0"
637 # clean up temporary GOPATH