9 if [[ "$APTUSER" == '' ]]; then
10 echo "Syntax: $0 <aptuser> <aptserver>"
14 if [[ "$APTSERVER" == '' ]]; then
15 echo "Syntax: $0 <aptuser> <aptserver>"
20 if ! [[ -n "$WORKSPACE" ]]; then
21 echo "WORKSPACE environment variable not set"
25 source /etc/profile.d/rvm.sh
28 # Make all files world-readable -- jenkins runs with umask 027, and has checked
29 # out our git tree here
30 chmod o+r "$WORKSPACE" -R
32 # Now fix our umask to something better suited to building and publishing
40 echo "Build and publish ruby gem"
45 gem build arvados.gemspec
49 # Build arvados-cli GEM
50 echo "Build and publish ruby gem"
55 gem build arvados-cli.gemspec
57 gem push arvados-cli*gem
59 # Build arvados-python-client Python package
60 echo "Build and publish arvados-python-client package"
63 GIT_HASH=`git log --format=format:%ct.%h -n1 .`
67 # Make sure only to use sdist - that's the only format pip can deal with (sigh)
68 python setup.py sdist upload
70 cd ../../services/fuse
72 # Make sure only to use sdist - that's the only format pip can deal with (sigh)
73 python setup.py sdist upload
75 # Build debs for everything
76 build_and_scp_deb () {
88 if [[ "$PACKAGE_NAME" == "" ]]; then
92 if [[ "$PACKAGE_TYPE" == "" ]]; then
96 declare -a COMMAND_ARR=("fpm" "--maintainer=Ward Vandewege <ward@curoverse.com>" "-s" "$PACKAGE_TYPE" "-t" "deb")
98 if [[ "$PACKAGE_NAME" != "$PACKAGE" ]]; then
99 COMMAND_ARR+=('-n' "$PACKAGE_NAME")
102 if [[ "$VENDOR" != "" ]]; then
103 COMMAND_ARR+=('--vendor' "$VENDOR")
106 if [[ "$VERSION" != "" ]]; then
107 COMMAND_ARR+=('-v' "$VERSION")
114 COMMAND_ARR+=("$PACKAGE")
116 FPM_RESULTS=$("${COMMAND_ARR[@]}")
120 if [[ $FPM_RESULTS =~ ([A-Za-z0-9_\-.]*\.deb) ]]; then
121 FPM_PACKAGE_NAME=${BASH_REMATCH[1]}
124 if [[ "$FPM_PACKAGE_NAME" == "" ]]; then
126 echo "Error: Unabled figure out package name from fpm results:\n $FPM_RESULTS"
128 if [[ ! $FPM_RESULTS =~ "File already exists" ]]; then
129 if [[ "$FPM_EXIT_CODE" != "0" ]]; then
130 echo "Error building debian package for $1:\n $FPM_RESULTS"
132 scp -P2222 $FPM_PACKAGE_NAME $APTUSER@$APTSERVER:tmp/
136 echo "Debian package $FPM_PACKAGE_NAME exists, not rebuilding"
141 if [[ ! -d "$WORKSPACE/debs" ]]; then
142 mkdir -p $WORKSPACE/debs
146 # We use $WORKSPACE/src-build-dir as the clean directory from which to build the src package
147 if [[ ! -d "$WORKSPACE/src-build-dir" ]]; then
148 mkdir "$WORKSPACE/src-build-dir"
150 git clone https://github.com/curoverse/arvados.git src-build-dir
153 cd "$WORKSPACE/src-build-dir"
154 # just in case, check out master
158 # go into detached-head state
159 git checkout `git log --format=format:%h -n1 .`
161 # Build arvados src deb package
163 build_and_scp_deb $WORKSPACE/src-build-dir/=/usr/local/arvados/src arvados-src 'Curoverse, Inc.' 'dir' "0.1.$GIT_HASH" "-x '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"
165 # clean up, check out master and step away from detached-head state
166 cd "$WORKSPACE/src-build-dir"
170 export GOPATH=$(mktemp -d)
171 mkdir -p "$GOPATH/src/git.curoverse.com"
172 ln -sfn "$WORKSPACE" "$GOPATH/src/git.curoverse.com/arvados.git"
175 go get "git.curoverse.com/arvados.git/services/keepstore"
177 build_and_scp_deb $GOPATH/bin/keepstore=/usr/bin/keepstore keepstore 'Curoverse, Inc.' 'dir' "0.1.$GIT_HASH" "--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"
180 go get "git.curoverse.com/arvados.git/services/keepproxy"
182 build_and_scp_deb $GOPATH/bin/keepproxy=/usr/bin/keepproxy keepproxy 'Curoverse, Inc.' 'dir' "0.1.$GIT_HASH" "--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"
185 go get "git.curoverse.com/arvados.git/services/crunchstat"
187 build_and_scp_deb $GOPATH/bin/crunchstat=/usr/bin/crunchstat crunchstat 'Curoverse, Inc.' 'dir' "0.1.$GIT_HASH" "--url=https://arvados.org" "--license=GNU Affero General Public License, version 3.0" "--description=Crunchstat gathers cpu/memory/network statistics of running Crunch jobs"
190 # Please resist the temptation to add --no-python-fix-name to the fpm call here
191 # (which would remove the python- prefix from the package name), because this
192 # package is a dependency of arvados-fuse, and fpm can not omit the python-
193 # prefix from only one of the dependencies of a package... Maybe I could
194 # whip up a patch and send it upstream, but that will be for another day. Ward,
197 build_and_scp_deb $WORKSPACE/sdk/python python-arvados-python-client 'Curoverse, Inc.' 'python' "$(awk '($1 == "Version:"){print $2}' $WORKSPACE/sdk/python/arvados_python_client.egg-info/PKG-INFO)" "--url=https://arvados.org" "--description=The Arvados Python SDK"
200 # Please seem comment about --no-python-fix-name above; we stay consistent and do
201 # not omit the python- prefix first.
203 build_and_scp_deb $WORKSPACE/services/fuse python-arvados-fuse 'Curoverse, Inc.' 'python' "$(awk '($1 == "Version:"){print $2}' $WORKSPACE/services/fuse/arvados_fuse.egg-info/PKG-INFO)" "--url=https://arvados.org" "--description=The Keep FUSE driver"
206 build_and_scp_deb python-gflags
207 build_and_scp_deb pyvcf
208 build_and_scp_deb google-api-python-client
209 build_and_scp_deb httplib2
210 build_and_scp_deb ws4py
211 build_and_scp_deb virtualenv
213 # Finally, publish the packages, if necessary
214 if [[ "$CALL_FREIGHT" != "0" ]]; then
215 ssh -p2222 $APTUSER@$APTSERVER -t "cd tmp && ls -laF *deb && freight add *deb apt/wheezy && freight cache && rm -f *deb"
217 echo "No new packages generated. No freight run necessary."
220 # clean up temporary GOPATH