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: debian7)
21 Build command to execute (defaults to the run command defined in the
24 WORKSPACE=path Path to the Arvados source tree to build packages from
29 DEBUG=${ARVADOS_DEBUG:-0}
33 PARSEDOPTS=$(getopt --name "$0" --longoptions \
34 help,build-bundle-packages,debug,target: \
40 eval set -- "$PARSEDOPTS"
41 while [ $# -gt 0 ]; do
44 echo >&2 "$helpmessage"
59 echo >&2 "$0: unrecognized argument '$2'. Try: $0 --help"
67 if [[ "$COMMAND" != "" ]]; then
68 COMMAND="/usr/local/rvm/bin/rvm-exec default bash /jenkins/$COMMAND --target $TARGET"
71 STDOUT_IF_DEBUG=/dev/null
72 STDERR_IF_DEBUG=/dev/null
74 if [[ "$DEBUG" != 0 ]]; then
75 STDOUT_IF_DEBUG=/dev/stdout
76 STDERR_IF_DEBUG=/dev/stderr
80 declare -a PYTHON_BACKPORTS PYTHON3_BACKPORTS
83 PYTHON3_VERSION=$(python3 -c 'import sys; print("{v.major}.{v.minor}".format(v=sys.version_info))')
85 ## These defaults are suitable for any Debian-based distribution.
86 # You can customize them as needed in distro sections below.
87 PYTHON2_PACKAGE=python$PYTHON2_VERSION
88 PYTHON2_PKG_PREFIX=python
90 PYTHON2_INSTALL_LIB=lib/python$PYTHON2_VERSION/dist-packages
92 PYTHON3_PACKAGE=python$PYTHON3_VERSION
93 PYTHON3_PKG_PREFIX=python3
95 PYTHON3_INSTALL_LIB=lib/python$PYTHON3_VERSION/dist-packages
96 ## End Debian Python defaults.
101 PYTHON_BACKPORTS=(python-gflags==2.0 google-api-python-client==1.4.2 \
102 oauth2client==1.5.2 pyasn1==0.1.7 pyasn1-modules==0.0.5 \
103 rsa uritemplate httplib2 ws4py pykka six pyexecjs jsonschema \
104 ciso8601 pycrypto backports.ssl_match_hostname llfuse==0.41.1 \
105 'pycurl<7.21.5' contextlib2 pyyaml 'rdflib>=4.2.0' \
106 shellescape mistune typing avro ruamel.ordereddict)
107 PYTHON3_BACKPORTS=(docker-py==1.7.2 six requests websocket-client)
111 PYTHON_BACKPORTS=(python-gflags==2.0 google-api-python-client==1.4.2 \
112 oauth2client==1.5.2 pyasn1==0.1.7 pyasn1-modules==0.0.5 \
113 rsa uritemplate httplib2 ws4py pykka six pyexecjs jsonschema \
114 ciso8601 pycrypto backports.ssl_match_hostname llfuse==0.41.1 \
115 'pycurl<7.21.5' pyyaml 'rdflib>=4.2.0' \
116 shellescape mistune typing avro ruamel.ordereddict)
117 PYTHON3_BACKPORTS=(docker-py==1.7.2 six requests websocket-client)
121 PYTHON_BACKPORTS=(python-gflags==2.0 google-api-python-client==1.4.2 \
122 oauth2client==1.5.2 pyasn1==0.1.7 pyasn1-modules==0.0.5 \
123 rsa uritemplate httplib2 ws4py pykka six pyexecjs jsonschema \
124 ciso8601 pycrypto backports.ssl_match_hostname llfuse==0.41.1 \
125 contextlib2 'pycurl<7.21.5' pyyaml 'rdflib>=4.2.0' \
126 shellescape mistune typing avro isodate ruamel.ordereddict)
127 PYTHON3_BACKPORTS=(docker-py==1.7.2 six requests websocket-client)
131 PYTHON_BACKPORTS=(pyasn1==0.1.7 pyasn1-modules==0.0.5 llfuse==0.41.1 ciso8601 \
132 google-api-python-client==1.4.2 six uritemplate oauth2client==1.5.2 httplib2 \
133 rsa 'pycurl<7.21.5' backports.ssl_match_hostname pyyaml 'rdflib>=4.2.0' \
134 shellescape mistune typing avro ruamel.ordereddict)
135 PYTHON3_BACKPORTS=(docker-py==1.7.2 requests websocket-client)
139 PYTHON2_PACKAGE=$(rpm -qf "$(which python$PYTHON2_VERSION)" --queryformat '%{NAME}\n')
140 PYTHON2_PKG_PREFIX=$PYTHON2_PACKAGE
141 PYTHON2_PREFIX=/opt/rh/python27/root/usr
142 PYTHON2_INSTALL_LIB=lib/python$PYTHON2_VERSION/site-packages
143 PYTHON3_PACKAGE=$(rpm -qf "$(which python$PYTHON3_VERSION)" --queryformat '%{NAME}\n')
144 PYTHON3_PKG_PREFIX=$PYTHON3_PACKAGE
145 PYTHON3_PREFIX=/opt/rh/python33/root/usr
146 PYTHON3_INSTALL_LIB=lib/python$PYTHON3_VERSION/site-packages
147 PYTHON_BACKPORTS=(python-gflags==2.0 google-api-python-client==1.4.2 \
148 oauth2client==1.5.2 pyasn1==0.1.7 pyasn1-modules==0.0.5 \
149 rsa uritemplate httplib2 ws4py pykka six pyexecjs jsonschema \
150 ciso8601 pycrypto backports.ssl_match_hostname 'pycurl<7.21.5' \
151 python-daemon lockfile llfuse==0.41.1 'pbr<1.0' pyyaml \
152 'rdflib>=4.2.0' shellescape mistune typing avro requests \
153 isodate pyparsing sparqlwrapper html5lib keepalive \
155 PYTHON3_BACKPORTS=(docker-py==1.7.2 six requests websocket-client)
156 export PYCURL_SSL_LIBRARY=nss
160 PYTHON2_PACKAGE=$(rpm -qf "$(which python$PYTHON2_VERSION)" --queryformat '%{NAME}\n')
161 PYTHON2_PKG_PREFIX=$PYTHON2_PACKAGE
162 PYTHON2_INSTALL_LIB=lib/python$PYTHON2_VERSION/site-packages
163 PYTHON3_PACKAGE=$(rpm -qf "$(which python$PYTHON3_VERSION)" --queryformat '%{NAME}\n')
164 PYTHON3_PKG_PREFIX=$PYTHON3_PACKAGE
165 PYTHON3_PREFIX=/opt/rh/python33/root/usr
166 PYTHON3_INSTALL_LIB=lib/python$PYTHON3_VERSION/site-packages
167 PYTHON_BACKPORTS=(python-gflags==2.0 google-api-python-client==1.4.2 \
168 oauth2client==1.5.2 pyasn1==0.1.7 pyasn1-modules==0.0.5 \
169 rsa uritemplate httplib2 ws4py pykka pyexecjs jsonschema \
170 ciso8601 pycrypto 'pycurl<7.21.5' \
171 python-daemon llfuse==0.41.1 'pbr<1.0' pyyaml \
172 'rdflib>=4.2.0' shellescape mistune typing avro \
173 isodate pyparsing sparqlwrapper html5lib keepalive \
175 PYTHON3_BACKPORTS=(docker-py==1.7.2 six requests websocket-client)
176 export PYCURL_SSL_LIBRARY=nss
179 echo -e "$0: Unknown target '$TARGET'.\n" >&2
185 if ! [[ -n "$WORKSPACE" ]]; then
186 echo >&2 "$helpmessage"
188 echo >&2 "Error: WORKSPACE environment variable not set"
194 fpm --version >/dev/null 2>&1
196 if [[ "$?" != 0 ]]; then
197 echo >&2 "$helpmessage"
199 echo >&2 "Error: fpm not found"
204 EASY_INSTALL2=$(find_easy_install -$PYTHON2_VERSION "")
205 EASY_INSTALL3=$(find_easy_install -$PYTHON3_VERSION 3)
207 RUN_BUILD_PACKAGES_PATH="`dirname \"$0\"`"
208 RUN_BUILD_PACKAGES_PATH="`( cd \"$RUN_BUILD_PACKAGES_PATH\" && pwd )`" # absolutized and normalized
209 if [ -z "$RUN_BUILD_PACKAGES_PATH" ] ; then
210 # error; for some reason, the path is not accessible
211 # to the script (e.g. permissions re-evaled after suid)
215 debug_echo "$0 is running from $RUN_BUILD_PACKAGES_PATH"
216 debug_echo "Workspace is $WORKSPACE"
218 if [[ -f /etc/profile.d/rvm.sh ]]; then
219 source /etc/profile.d/rvm.sh
220 GEM="rvm-exec default gem"
225 # Make all files world-readable -- jenkins runs with umask 027, and has checked
226 # out our git tree here
227 chmod o+r "$WORKSPACE" -R
229 # More cleanup - make sure all executables that we'll package are 755
231 find -type d -name 'bin' |xargs -I {} find {} -type f |xargs -I {} chmod 755 {}
233 # Now fix our umask to something better suited to building and publishing
237 debug_echo "umask is" `umask`
239 if [[ ! -d "$WORKSPACE/packages/$TARGET" ]]; then
240 mkdir -p $WORKSPACE/packages/$TARGET
244 debug_echo -e "\nPerl packages\n"
246 cd "$WORKSPACE/sdk/perl"
248 if [[ -e Makefile ]]; then
249 make realclean >"$STDOUT_IF_DEBUG"
251 find -maxdepth 1 \( -name 'MANIFEST*' -or -name "libarvados-perl*.$FORMAT" \) \
255 perl Makefile.PL INSTALL_BASE=install >"$STDOUT_IF_DEBUG" && \
256 make install INSTALLDIRS=perl >"$STDOUT_IF_DEBUG" && \
257 fpm_build install/lib/=/usr/share libarvados-perl \
258 "Curoverse, Inc." dir "$(version_from_git)" install/man/=/usr/share/man \
259 "$WORKSPACE/LICENSE-2.0.txt=/usr/share/doc/libarvados-perl/LICENSE-2.0.txt" && \
260 mv --no-clobber libarvados-perl*.$FORMAT "$WORKSPACE/packages/$TARGET/"
263 debug_echo -e "\nRuby gems\n"
265 FPM_GEM_PREFIX=$($GEM environment gemdir)
267 cd "$WORKSPACE/sdk/ruby"
268 handle_ruby_gem arvados
270 cd "$WORKSPACE/sdk/cli"
271 handle_ruby_gem arvados-cli
273 cd "$WORKSPACE/services/login-sync"
274 handle_ruby_gem arvados-login-sync
277 debug_echo -e "\nPython packages\n"
279 cd "$WORKSPACE/sdk/pam"
280 handle_python_package
282 cd "$WORKSPACE/sdk/python"
283 handle_python_package
285 cd "$WORKSPACE/sdk/cwl"
286 handle_python_package
288 cd "$WORKSPACE/services/fuse"
289 handle_python_package
291 cd "$WORKSPACE/services/nodemanager"
292 handle_python_package
299 COMMIT_HASH=$(format_last_commit_here "%H")
301 SRC_BUILD_DIR=$(mktemp -d)
302 # mktemp creates the directory with 0700 permissions by default
303 chmod 755 $SRC_BUILD_DIR
304 git clone $DASHQ_UNLESS_DEBUG "$WORKSPACE/.git" "$SRC_BUILD_DIR"
307 # go into detached-head state
308 git checkout $DASHQ_UNLESS_DEBUG "$COMMIT_HASH"
309 echo "$COMMIT_HASH" >git-commit.version
312 PKG_VERSION=$(version_from_git)
313 cd $WORKSPACE/packages/$TARGET
314 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"
316 rm -rf "$SRC_BUILD_DIR"
319 # On older platforms we need to publish a backport of libfuse >=2.9.2,
320 # and we need to build and install it here in order to even build an
322 cd $WORKSPACE/packages/$TARGET
323 if [[ $TARGET =~ ubuntu1204 ]]; then
324 # port libfuse 2.9.2 to Ubuntu 12.04
325 LIBFUSE_DIR=$(mktemp -d)
328 # download fuse 2.9.2 ubuntu 14.04 source package
329 file="fuse_2.9.2.orig.tar.xz" && curl -L -o "${file}" "http://archive.ubuntu.com/ubuntu/pool/main/f/fuse/${file}"
330 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}"
331 file="fuse_2.9.2-4ubuntu4.14.04.1.dsc" && curl -L -o "${file}" "http://archive.ubuntu.com/ubuntu/pool/main/f/fuse/${file}"
333 # install dpkg-source and dpkg-buildpackage commands
334 apt-get install -y --no-install-recommends dpkg-dev
336 # extract source and apply patches
337 dpkg-source -x fuse_2.9.2-4ubuntu4.14.04.1.dsc
338 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
340 # add new version to changelog
343 echo "fuse (2.9.2-5) precise; urgency=low"
345 echo " * Backported from trusty-security to precise"
347 echo " -- Joshua Randall <jcrandall@alum.mit.edu> Thu, 4 Feb 2016 11:31:00 -0000"
350 ) > debian/changelog.new
351 mv debian/changelog.new debian/changelog
353 # install build-deps and build
354 apt-get install -y --no-install-recommends debhelper dh-autoreconf libselinux-dev
355 dpkg-buildpackage -rfakeroot -b
357 fpm_build "$LIBFUSE_DIR/fuse_2.9.2-5_amd64.deb" fuse "Ubuntu Developers" deb "2.9.2" --iteration 5
358 fpm_build "$LIBFUSE_DIR/libfuse2_2.9.2-5_amd64.deb" libfuse2 "Ubuntu Developers" deb "2.9.2" --iteration 5
359 fpm_build "$LIBFUSE_DIR/libfuse-dev_2.9.2-5_amd64.deb" libfuse-dev "Ubuntu Developers" deb "2.9.2" --iteration 5
361 "$WORKSPACE/packages/$TARGET/fuse_2.9.2-5_amd64.deb" \
362 "$WORKSPACE/packages/$TARGET/libfuse2_2.9.2-5_amd64.deb" \
363 "$WORKSPACE/packages/$TARGET/libfuse-dev_2.9.2-5_amd64.deb"
364 apt-get -y --no-install-recommends -f install
366 elif [[ $TARGET =~ centos6 ]]; then
367 # port fuse 2.9.2 to centos 6
368 # install tools to build rpm from source
369 yum install -y rpm-build redhat-rpm-config
370 LIBFUSE_DIR=$(mktemp -d)
373 # download fuse 2.9.2 centos 7 source rpm
374 file="fuse-2.9.2-6.el7.src.rpm" && curl -L -o "${file}" "http://vault.centos.org/7.2.1511/os/Source/SPackages/${file}"
376 # modify source rpm spec to remove conflict on filesystem version
377 mkdir -p /root/rpmbuild/SOURCES
378 cd /root/rpmbuild/SOURCES
379 rpm2cpio ${LIBFUSE_DIR}/fuse-2.9.2-6.el7.src.rpm | cpio -i
380 perl -pi -e 's/Conflicts:\s*filesystem.*//g' fuse.spec
382 # build rpms from source
383 rpmbuild -bb /root/rpmbuild/SOURCES/fuse.spec
384 rm -f fuse-2.9.2-6.el7.src.rpm
385 # move built RPMs to LIBFUSE_DIR
386 mv "/root/rpmbuild/RPMS/x86_64/fuse-2.9.2-6.el6.x86_64.rpm" ${LIBFUSE_DIR}/
387 mv "/root/rpmbuild/RPMS/x86_64/fuse-libs-2.9.2-6.el6.x86_64.rpm" ${LIBFUSE_DIR}/
388 mv "/root/rpmbuild/RPMS/x86_64/fuse-devel-2.9.2-6.el6.x86_64.rpm" ${LIBFUSE_DIR}/
389 rm -rf /root/rpmbuild
391 fpm_build "$LIBFUSE_DIR/fuse-libs-2.9.2-6.el6.x86_64.rpm" fuse-libs "Centos Developers" rpm "2.9.2" --iteration 5
392 fpm_build "$LIBFUSE_DIR/fuse-2.9.2-6.el6.x86_64.rpm" fuse "Centos Developers" rpm "2.9.2" --iteration 5 --no-auto-depends
393 fpm_build "$LIBFUSE_DIR/fuse-devel-2.9.2-6.el6.x86_64.rpm" fuse-devel "Centos Developers" rpm "2.9.2" --iteration 5 --no-auto-depends
395 "$WORKSPACE/packages/$TARGET/fuse-libs-2.9.2-5.x86_64.rpm" \
396 "$WORKSPACE/packages/$TARGET/fuse-2.9.2-5.x86_64.rpm" \
397 "$WORKSPACE/packages/$TARGET/fuse-devel-2.9.2-5.x86_64.rpm"
401 cd $WORKSPACE/packages/$TARGET
402 export GOPATH=$(mktemp -d)
403 package_go_binary services/keepstore keepstore \
404 "Keep storage daemon, accessible to clients on the LAN"
405 package_go_binary services/keepproxy keepproxy \
406 "Make a Keep cluster accessible to clients that are not on the LAN"
407 package_go_binary services/keep-balance keep-balance \
408 "Rebalance and garbage-collect data blocks stored in Arvados Keep"
409 package_go_binary services/keep-web keep-web \
410 "Static web hosting service for user data stored in Arvados Keep"
411 package_go_binary services/datamanager arvados-data-manager \
412 "Ensure block replication levels, report disk usage, and determine which blocks should be deleted when space is needed"
413 package_go_binary services/arv-git-httpd arvados-git-httpd \
414 "Provide authenticated http access to Arvados-hosted git repositories"
415 package_go_binary services/crunchstat crunchstat \
416 "Gather cpu/memory/network statistics of running Crunch jobs"
417 package_go_binary tools/keep-rsync keep-rsync \
418 "Copy all data from one set of Keep servers to another"
419 package_go_binary tools/keep-block-check keep-block-check \
420 "Verify that all data from one set of Keep servers to another was copied"
421 package_go_binary sdk/go/crunchrunner crunchrunner \
422 "Crunchrunner executes a command inside a container and uploads the output"
425 # Please resist the temptation to add --no-python-fix-name to the fpm call here
426 # (which would remove the python- prefix from the package name), because this
427 # package is a dependency of arvados-fuse, and fpm can not omit the python-
428 # prefix from only one of the dependencies of a package... Maybe I could
429 # whip up a patch and send it upstream, but that will be for another day. Ward,
431 cd $WORKSPACE/packages/$TARGET
432 rm -rf "$WORKSPACE/sdk/python/build"
433 fpm_build $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" --deb-recommends=git
436 cd $WORKSPACE/packages/$TARGET
437 rm -rf "$WORKSPACE/sdk/cwl/build"
438 fpm_build $WORKSPACE/sdk/cwl "${PYTHON2_PKG_PREFIX}-arvados-cwl-runner" 'Curoverse, Inc.' 'python' "$(awk '($1 == "Version:"){print $2}' $WORKSPACE/sdk/cwl/arvados_cwl_runner.egg-info/PKG-INFO)" "--url=https://arvados.org" "--description=The Arvados CWL runner" --iteration 3
440 # schema_salad. This is a python dependency of arvados-cwl-runner,
441 # but we can't use the usual PYTHONPACKAGES way to build this package due to the
442 # intricacies of how version numbers get generated in setup.py: we need version
443 # 1.7.20160316203940. If we don't explicitly list that version with the -v
444 # argument to fpm, and instead specify it as schema_salad==1.7.20160316203940, we get
445 # a package with version 1.7. That's because our gittagger hack is not being
446 # picked up by self.distribution.get_version(), which is called from
447 # https://github.com/jordansissel/fpm/blob/master/lib/fpm/package/pyfpm/get_metadata.py
448 # by means of this command:
450 # python2.7 setup.py --command-packages=pyfpm get_metadata --output=metadata.json
452 # So we build this thing separately.
455 fpm_build schema_salad "" "" python 1.11.20160506154702
457 # And schema_salad now depends on ruamel-yaml, which apparently has a braindead setup.py that requires special arguments to build (otherwise, it aborts with 'error: you have to install with "pip install ."'). Sigh.
459 fpm_build ruamel.yaml "" "" python "" --python-setup-py-arguments "--single-version-externally-managed"
461 # And for cwltool we have the same problem as for schema_salad. Ward, 2016-03-17
462 fpm_build cwltool "" "" python 1.0.20160519182434
464 # FPM eats the trailing .0 in the python-rdflib-jsonld package when built with 'rdflib-jsonld>=0.3.0'. Force the version. Ward, 2016-03-25
465 fpm_build rdflib-jsonld "" "" python 0.3.0
468 if [[ $TARGET =~ debian|ubuntu ]]; then
469 cd $WORKSPACE/packages/$TARGET
470 rm -rf "$WORKSPACE/sdk/pam/build"
471 fpm_build $WORKSPACE/sdk/pam libpam-arvados 'Curoverse, Inc.' 'python' "$(awk '($1 == "Version:"){print $2}' $WORKSPACE/sdk/pam/arvados_pam.egg-info/PKG-INFO)" "--url=https://arvados.org" "--description=PAM module for authenticating shell logins using Arvados API tokens" --depends libpam-python
475 # Please see comment about --no-python-fix-name above; we stay consistent and do
476 # not omit the python- prefix first.
477 cd $WORKSPACE/packages/$TARGET
478 rm -rf "$WORKSPACE/services/fuse/build"
479 fpm_build $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"
482 cd $WORKSPACE/packages/$TARGET
483 rm -rf "$WORKSPACE/services/nodemanager/build"
484 fpm_build $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"
486 # The Docker image cleaner
487 cd $WORKSPACE/packages/$TARGET
488 rm -rf "$WORKSPACE/services/dockercleaner/build"
489 fpm_build $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"
491 # The Arvados crunchstat-summary tool
492 cd $WORKSPACE/packages/$TARGET
493 rm -rf "$WORKSPACE/tools/crunchstat-summary/build"
494 fpm_build $WORKSPACE/tools/crunchstat-summary ${PYTHON2_PKG_PREFIX}-crunchstat-summary 'Curoverse, Inc.' 'python' "$(awk '($1 == "Version:"){print $2}' $WORKSPACE/tools/crunchstat-summary/crunchstat_summary.egg-info/PKG-INFO)" "--url=https://arvados.org" "--description=Crunchstat-summary reads Arvados Crunch log files and summarize resource usage"
497 LIBCLOUD_DIR=$(mktemp -d)
500 git clone $DASHQ_UNLESS_DEBUG https://github.com/curoverse/libcloud.git .
501 git checkout apache-libcloud-$LIBCLOUD_PIN
502 # libcloud is absurdly noisy without -q, so force -q here
503 OLD_DASHQ_UNLESS_DEBUG=$DASHQ_UNLESS_DEBUG
504 DASHQ_UNLESS_DEBUG=-q
505 handle_python_package
506 DASHQ_UNLESS_DEBUG=$OLD_DASHQ_UNLESS_DEBUG
508 fpm_build $LIBCLOUD_DIR "$PYTHON2_PKG_PREFIX"-apache-libcloud
511 # Python 2 dependencies
512 declare -a PIP_DOWNLOAD_SWITCHES=(--no-deps)
513 # Add --no-use-wheel if this pip knows it.
514 pip wheel --help >/dev/null 2>&1
516 0) PIP_DOWNLOAD_SWITCHES+=(--no-use-wheel) ;;
518 *) echo "WARNING: `pip wheel` test returned unknown exit code $?" ;;
521 for deppkg in "${PYTHON_BACKPORTS[@]}"; do
522 outname=$(echo "$deppkg" | sed -e 's/^python-//' -e 's/[<=>].*//' -e 's/_/-/g' -e "s/^/${PYTHON2_PKG_PREFIX}-/")
524 httplib2|google-api-python-client)
525 # Work around 0640 permissions on some package files.
526 # See #7591 and #7991.
527 pyfpm_workdir=$(mktemp --tmpdir -d pyfpm-XXXXXX) && (
530 pip install "${PIP_DOWNLOAD_SWITCHES[@]}" --download . "$deppkg"
531 # Sometimes pip gives us a tarball, sometimes a zip file...
532 DOWNLOADED=`ls $deppkg-*`
533 [[ "$DOWNLOADED" =~ ".tar" ]] && tar -xf $DOWNLOADED
534 [[ "$DOWNLOADED" =~ ".zip" ]] && unzip $DOWNLOADED
536 "python$PYTHON2_VERSION" setup.py $DASHQ_UNLESS_DEBUG egg_info build
539 fpm_build . "$outname" "" python "" --iteration 3
540 # The upload step uses the package timestamp to determine
541 # whether it's new. --no-clobber plays nice with that.
542 mv --no-clobber "$outname"*.$FORMAT "$WORKSPACE/packages/$TARGET"
544 if [ 0 != "$?" ]; then
545 echo "ERROR: $deppkg build process failed"
548 if [ -n "$pyfpm_workdir" ]; then
549 rm -rf "$pyfpm_workdir"
553 fpm_build "$deppkg" "$outname"
558 # Python 3 dependencies
559 for deppkg in "${PYTHON3_BACKPORTS[@]}"; do
560 outname=$(echo "$deppkg" | sed -e 's/^python-//' -e 's/[<=>].*//' -e 's/_/-/g' -e "s/^/${PYTHON3_PKG_PREFIX}-/")
561 # The empty string is the vendor argument: these aren't Curoverse software.
562 fpm_build "$deppkg" "$outname" "" python3
565 # Build the API server package
566 handle_rails_package arvados-api-server "$WORKSPACE/services/api" \
567 "$WORKSPACE/agpl-3.0.txt" --url="https://arvados.org" \
568 --description="Arvados API server - Arvados is a free and open source platform for big data science." \
569 --license="GNU Affero General Public License, version 3.0"
571 # Build the workbench server package
574 cd "$WORKSPACE/apps/workbench"
576 # We need to bundle to be ready even when we build a package without vendor directory
577 # because asset compilation requires it.
578 bundle install --path vendor/bundle >"$STDOUT_IF_DEBUG"
580 # clear the tmp directory; the asset generation step will recreate tmp/cache/assets,
581 # and we want that in the package, so it's easier to not exclude the tmp directory
582 # from the package - empty it instead.
586 # Set up application.yml and production.rb so that asset precompilation works
587 \cp config/application.yml.example config/application.yml -f
588 \cp config/environments/production.rb.example config/environments/production.rb -f
589 sed -i 's/secret_token: ~/secret_token: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/' config/application.yml
591 RAILS_ENV=production RAILS_GROUPS=assets bundle exec rake assets:precompile >/dev/null
593 # Remove generated configuration files so they don't go in the package.
594 rm config/application.yml config/environments/production.rb
597 if [[ "$?" != "0" ]]; then
598 echo "ERROR: Asset precompilation failed"
601 handle_rails_package arvados-workbench "$WORKSPACE/apps/workbench" \
602 "$WORKSPACE/agpl-3.0.txt" --url="https://arvados.org" \
603 --description="Arvados Workbench - Arvados is a free and open source platform for big data science." \
604 --license="GNU Affero General Public License, version 3.0"
607 # clean up temporary GOPATH