9 if [[ "$APTUSER" == '' ]]; then
10 echo "Syntax: $0 <aptuser> <aptserver>"
14 if [[ "$APTSERVER" == '' ]]; then
15 echo "Syntax: $0 <aptuser> <aptserver>"
19 source /etc/profile.d/rvm.sh
23 echo "Build and publish ruby gem"
28 gem build arvados.gemspec
32 # Build arvados-cli GEM
33 echo "Build and publish ruby gem"
38 gem build arvados-cli.gemspec
40 gem push arvados-cli*gem
42 # Build arvados-python-client Python package
43 echo "Build and publish arvados-python-client package"
46 GIT_HASH=`git log --format=format:%ct.%h -n1 .`
50 # We mess with this file below, reset it here
53 # Make sure only to use sdist - that's the only format pip can deal with (sigh)
54 python setup.py egg_info -b ".$GIT_HASH" sdist upload
56 cd ../../services/fuse
58 # We mess with this file below, reset it here
61 # Make sure only to use sdist - that's the only format pip can deal with (sigh)
62 python setup.py egg_info -b ".$GIT_HASH" sdist upload
64 # Build debs for everything
66 # Build arvados src deb package
68 build_and_scp_deb () {
71 # Put spaces in $3 and you will regret it. Despite the use of arrays below.
72 # Because, bash sucks.
78 if [[ "$PACKAGE_NAME" == "" ]]; then
82 if [[ "$PACKAGE_TYPE" == "" ]]; then
86 COMMAND_ARR=("fpm" "-s" "$PACKAGE_TYPE" "-t" "deb")
88 if [[ "$PACKAGE_NAME" != "$PACKAGE" ]]; then
89 COMMAND_ARR+=('-n' "$PACKAGE_NAME")
92 if [[ "$VENDOR" != "" ]]; then
93 COMMAND_ARR+=('--vendor' "$VENDOR")
96 if [[ "$VERSION" != "" ]]; then
97 COMMAND_ARR+=('-v' "$VERSION")
100 for a in $EXTRA_ARGUMENTS; do
104 COMMAND_ARR+=("$PACKAGE")
106 FPM_RESULTS=$(${COMMAND_ARR[@]})
108 echo ${COMMAND_ARR[@]}
111 if [[ $FPM_RESULTS =~ ([A-Za-z0-9_\-.]*\.deb) ]]; then
112 FPM_PACKAGE_NAME=${BASH_REMATCH[1]}
115 if [[ "$FPM_PACKAGE_NAME" == "" ]]; then
117 echo "Error: Unabled figure out package name from fpm results:\n $FPM_RESULTS"
119 if [[ ! $FPM_RESULTS =~ "File already exists" ]]; then
120 if [[ "$FPM_EXIT_CODE" != "0" ]]; then
121 echo "Error building debian package for $1:\n $FPM_RESULTS"
123 scp -P2222 $FPM_PACKAGE_NAME $APTUSER@$APTSERVER:tmp/
127 echo "Debian package $FPM_PACKAGE_NAME exists, not rebuilding"
132 if [[ ! -d "$WORKSPACE/debs" ]]; then
133 mkdir -p $WORKSPACE/debs
137 # We use $WORKSPACE/src-build-dir as the clean directory from which to build the src package
138 if [[ ! -d "$WORKSPACE/src-build-dir" ]]; then
139 mkdir "$WORKSPACE/src-build-dir"
141 git clone https://github.com/curoverse/arvados.git src-build-dir
144 cd "$WORKSPACE/src-build-dir"
145 # just in case, check out master
148 # go into detached-head state
149 git checkout `git log --format=format:%h -n1 .`
153 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*'"
155 # clean up, check out master and step away from detached-head state
156 cd "$WORKSPACE/src-build-dir"
160 export GOPATH=$(mktemp -d)
161 mkdir -p "$GOPATH/src/git.curoverse.com"
162 ln -sfn "$WORKSPACE" "$GOPATH/src/git.curoverse.com/arvados.git"
165 go get "git.curoverse.com/arvados.git/services/keepstore"
167 build_and_scp_deb $GOPATH/bin/keepstore=/usr/bin/keepstore keepstore 'Curoverse, Inc.' 'dir' "0.1.$GIT_HASH"
170 go get "git.curoverse.com/arvados.git/services/keepproxy"
172 build_and_scp_deb $GOPATH/bin/keepproxy=/usr/bin/keepproxy keepproxy 'Curoverse, Inc.' 'dir' "0.1.$GIT_HASH"
175 go get "git.curoverse.com/arvados.git/services/crunchstat"
177 build_and_scp_deb $GOPATH/bin/crunchstat=/usr/bin/crunchstat crunchstat 'Curoverse, Inc.' 'dir' "0.1.$GIT_HASH"
180 cd $WORKSPACE/sdk/python
181 sed -i'' -e "s:version='0.1':version='0.1.$GIT_HASH':" setup.py
185 # Please resist the temptation to add --no-python-fix-name to the fpm call here
186 # (which would remove the python- prefix from the package name), because this
187 # package is a dependency of arvados-fuse, and fpm can not omit the python-
188 # prefix from only one of the dependencies of a package... Maybe I could
189 # whip up a patch and send it upstream, but that will be for another day. Ward,
191 build_and_scp_deb $WORKSPACE/sdk/python python-arvados-python-client 'Curoverse, Inc.' 'python' "0.1.${GIT_HASH}"
194 cd $WORKSPACE/services/fuse
195 sed -i'' -e "s:version='0.1':version='0.1.$GIT_HASH':" setup.py
199 # Please seem comment about --no-python-fix-name above; we stay consistent and do
200 # not omit the python- prefix first.
201 build_and_scp_deb $WORKSPACE/services/fuse python-arvados-fuse 'Curoverse, Inc.' 'python' "0.1.${GIT_HASH}"
204 build_and_scp_deb python-gflags
205 build_and_scp_deb pyvcf
206 build_and_scp_deb google-api-python-client
207 build_and_scp_deb httplib2
208 build_and_scp_deb ws4py
209 build_and_scp_deb virtualenv
211 # Finally, publish the packages, if necessary
212 if [[ "$CALL_FREIGHT" != "0" ]]; then
213 ssh -p2222 $APTUSER@$APTSERVER -t "cd tmp && ls -laF *deb && freight add *deb apt/wheezy && freight cache && rm -f *deb"
215 echo "No new packages generated. No freight run necessary."
218 # clean up temporary GOPATH