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
29 echo "Build and publish ruby gem"
34 gem build arvados.gemspec
38 # Build arvados-cli GEM
39 echo "Build and publish ruby gem"
44 gem build arvados-cli.gemspec
46 gem push arvados-cli*gem
48 # Build arvados-python-client Python package
49 echo "Build and publish arvados-python-client package"
52 GIT_HASH=`git log --format=format:%ct.%h -n1 .`
56 # We mess with this file below, reset it here
59 # Make sure only to use sdist - that's the only format pip can deal with (sigh)
60 python setup.py egg_info -b ".$GIT_HASH" sdist upload
62 cd ../../services/fuse
64 # We mess with this file below, reset it here
67 # Make sure only to use sdist - that's the only format pip can deal with (sigh)
68 python setup.py egg_info -b ".$GIT_HASH" sdist upload
70 # Build debs for everything
72 # Build arvados src deb package
74 build_and_scp_deb () {
86 if [[ "$PACKAGE_NAME" == "" ]]; then
90 if [[ "$PACKAGE_TYPE" == "" ]]; then
94 declare -a COMMAND_ARR=("fpm" "--maintainer=Ward Vandewege <ward@curoverse.com>" "-s" "$PACKAGE_TYPE" "-t" "deb")
96 if [[ "$PACKAGE_NAME" != "$PACKAGE" ]]; then
97 COMMAND_ARR+=('-n' "$PACKAGE_NAME")
100 if [[ "$VENDOR" != "" ]]; then
101 COMMAND_ARR+=('--vendor' "$VENDOR")
104 if [[ "$VERSION" != "" ]]; then
105 COMMAND_ARR+=('-v' "$VERSION")
112 COMMAND_ARR+=("$PACKAGE")
114 FPM_RESULTS=$("${COMMAND_ARR[@]}")
118 if [[ $FPM_RESULTS =~ ([A-Za-z0-9_\-.]*\.deb) ]]; then
119 FPM_PACKAGE_NAME=${BASH_REMATCH[1]}
122 if [[ "$FPM_PACKAGE_NAME" == "" ]]; then
124 echo "Error: Unabled figure out package name from fpm results:\n $FPM_RESULTS"
126 if [[ ! $FPM_RESULTS =~ "File already exists" ]]; then
127 if [[ "$FPM_EXIT_CODE" != "0" ]]; then
128 echo "Error building debian package for $1:\n $FPM_RESULTS"
130 scp -P2222 $FPM_PACKAGE_NAME $APTUSER@$APTSERVER:tmp/
134 echo "Debian package $FPM_PACKAGE_NAME exists, not rebuilding"
139 if [[ ! -d "$WORKSPACE/debs" ]]; then
140 mkdir -p $WORKSPACE/debs
144 # We use $WORKSPACE/src-build-dir as the clean directory from which to build the src package
145 if [[ ! -d "$WORKSPACE/src-build-dir" ]]; then
146 mkdir "$WORKSPACE/src-build-dir"
148 git clone https://github.com/curoverse/arvados.git src-build-dir
151 cd "$WORKSPACE/src-build-dir"
152 # just in case, check out master
155 # go into detached-head state
156 git checkout `git log --format=format:%h -n1 .`
160 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"
162 # clean up, check out master and step away from detached-head state
163 cd "$WORKSPACE/src-build-dir"
167 export GOPATH=$(mktemp -d)
168 mkdir -p "$GOPATH/src/git.curoverse.com"
169 ln -sfn "$WORKSPACE" "$GOPATH/src/git.curoverse.com/arvados.git"
172 go get "git.curoverse.com/arvados.git/services/keepstore"
174 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"
177 go get "git.curoverse.com/arvados.git/services/keepproxy"
179 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"
182 go get "git.curoverse.com/arvados.git/services/crunchstat"
184 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"
187 cd $WORKSPACE/sdk/python
188 sed -i'' -e "s:version='0.1':version='0.1.$GIT_HASH':" setup.py
192 # Please resist the temptation to add --no-python-fix-name to the fpm call here
193 # (which would remove the python- prefix from the package name), because this
194 # package is a dependency of arvados-fuse, and fpm can not omit the python-
195 # prefix from only one of the dependencies of a package... Maybe I could
196 # whip up a patch and send it upstream, but that will be for another day. Ward,
198 build_and_scp_deb $WORKSPACE/sdk/python python-arvados-python-client 'Curoverse, Inc.' 'python' "0.1.${GIT_HASH}" "--url=https://arvados.org" "--description=The Arvados Python SDK"
201 cd $WORKSPACE/services/fuse
202 sed -i'' -e "s:version='0.1':version='0.1.$GIT_HASH':" setup.py
206 # Please seem comment about --no-python-fix-name above; we stay consistent and do
207 # not omit the python- prefix first.
208 build_and_scp_deb $WORKSPACE/services/fuse python-arvados-fuse 'Curoverse, Inc.' 'python' "0.1.${GIT_HASH}" "--url=https://arvados.org" "--description=The Keep FUSE driver"
211 build_and_scp_deb python-gflags
212 build_and_scp_deb pyvcf
213 build_and_scp_deb google-api-python-client
214 build_and_scp_deb httplib2
215 build_and_scp_deb ws4py
216 build_and_scp_deb virtualenv
218 # Finally, publish the packages, if necessary
219 if [[ "$CALL_FREIGHT" != "0" ]]; then
220 ssh -p2222 $APTUSER@$APTSERVER -t "cd tmp && ls -laF *deb && freight add *deb apt/wheezy && freight cache && rm -f *deb"
222 echo "No new packages generated. No freight run necessary."
225 # clean up temporary GOPATH