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 # We mess with this file below, reset it here
70 # Make sure only to use sdist - that's the only format pip can deal with (sigh)
71 python setup.py egg_info -b ".$GIT_HASH" sdist upload
73 cd ../../services/fuse
75 # We mess with this file below, reset it here
78 # Make sure only to use sdist - that's the only format pip can deal with (sigh)
79 python setup.py egg_info -b ".$GIT_HASH" sdist upload
81 # Build debs for everything
83 # Build arvados src deb package
85 build_and_scp_deb () {
97 if [[ "$PACKAGE_NAME" == "" ]]; then
101 if [[ "$PACKAGE_TYPE" == "" ]]; then
102 PACKAGE_TYPE='python'
105 declare -a COMMAND_ARR=("fpm" "--maintainer=Ward Vandewege <ward@curoverse.com>" "-s" "$PACKAGE_TYPE" "-t" "deb")
107 if [[ "$PACKAGE_NAME" != "$PACKAGE" ]]; then
108 COMMAND_ARR+=('-n' "$PACKAGE_NAME")
111 if [[ "$VENDOR" != "" ]]; then
112 COMMAND_ARR+=('--vendor' "$VENDOR")
115 if [[ "$VERSION" != "" ]]; then
116 COMMAND_ARR+=('-v' "$VERSION")
123 COMMAND_ARR+=("$PACKAGE")
125 FPM_RESULTS=$("${COMMAND_ARR[@]}")
129 if [[ $FPM_RESULTS =~ ([A-Za-z0-9_\-.]*\.deb) ]]; then
130 FPM_PACKAGE_NAME=${BASH_REMATCH[1]}
133 if [[ "$FPM_PACKAGE_NAME" == "" ]]; then
135 echo "Error: Unabled figure out package name from fpm results:\n $FPM_RESULTS"
137 if [[ ! $FPM_RESULTS =~ "File already exists" ]]; then
138 if [[ "$FPM_EXIT_CODE" != "0" ]]; then
139 echo "Error building debian package for $1:\n $FPM_RESULTS"
141 scp -P2222 $FPM_PACKAGE_NAME $APTUSER@$APTSERVER:tmp/
145 echo "Debian package $FPM_PACKAGE_NAME exists, not rebuilding"
150 if [[ ! -d "$WORKSPACE/debs" ]]; then
151 mkdir -p $WORKSPACE/debs
155 # We use $WORKSPACE/src-build-dir as the clean directory from which to build the src package
156 if [[ ! -d "$WORKSPACE/src-build-dir" ]]; then
157 mkdir "$WORKSPACE/src-build-dir"
159 git clone https://github.com/curoverse/arvados.git src-build-dir
162 cd "$WORKSPACE/src-build-dir"
163 # just in case, check out master
167 # go into detached-head state
168 git checkout `git log --format=format:%h -n1 .`
171 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"
173 # clean up, check out master and step away from detached-head state
174 cd "$WORKSPACE/src-build-dir"
178 export GOPATH=$(mktemp -d)
179 mkdir -p "$GOPATH/src/git.curoverse.com"
180 ln -sfn "$WORKSPACE" "$GOPATH/src/git.curoverse.com/arvados.git"
183 go get "git.curoverse.com/arvados.git/services/keepstore"
185 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"
188 go get "git.curoverse.com/arvados.git/services/keepproxy"
190 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"
193 go get "git.curoverse.com/arvados.git/services/crunchstat"
195 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"
198 cd $WORKSPACE/sdk/python
199 sed -i'' -e "s:version='0.1':version='0.1.$GIT_HASH':" setup.py
203 # Please resist the temptation to add --no-python-fix-name to the fpm call here
204 # (which would remove the python- prefix from the package name), because this
205 # package is a dependency of arvados-fuse, and fpm can not omit the python-
206 # prefix from only one of the dependencies of a package... Maybe I could
207 # whip up a patch and send it upstream, but that will be for another day. Ward,
209 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"
212 cd $WORKSPACE/services/fuse
213 sed -i'' -e "s:version='0.1':version='0.1.$GIT_HASH':" setup.py
217 # Please seem comment about --no-python-fix-name above; we stay consistent and do
218 # not omit the python- prefix first.
219 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"
222 build_and_scp_deb python-gflags
223 build_and_scp_deb pyvcf
224 build_and_scp_deb google-api-python-client
225 build_and_scp_deb httplib2
226 build_and_scp_deb ws4py
227 build_and_scp_deb virtualenv
229 # Finally, publish the packages, if necessary
230 if [[ "$CALL_FREIGHT" != "0" ]]; then
231 ssh -p2222 $APTUSER@$APTSERVER -t "cd tmp && ls -laF *deb && freight add *deb apt/wheezy && freight cache && rm -f *deb"
233 echo "No new packages generated. No freight run necessary."
236 # clean up temporary GOPATH