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.
77 if [[ "$PACKAGE_NAME" == "" ]]; then
81 if [[ "$PACKAGE_TYPE" == "" ]]; then
85 COMMAND_ARR=("fpm" "-s" "$PACKAGE_TYPE" "-t" "deb")
87 if [[ "$PACKAGE_NAME" != "$PACKAGE" ]]; then
88 COMMAND_ARR+=('-n' "$PACKAGE_NAME")
91 if [[ "$VENDOR" != "" ]]; then
92 COMMAND_ARR+=('--vendor' "$VENDOR")
94 for a in $EXTRA_ARGUMENTS; do
98 COMMAND_ARR+=("$PACKAGE")
100 FPM_RESULTS=$(${COMMAND_ARR[@]})
102 echo ${COMMAND_ARR[@]}
103 if [[ ! $FPM_RESULTS =~ "File already exists" ]]; then
104 if [[ "$FPM_EXIT_CODE" != "0" ]]; then
105 echo "Error building debian package for $1:\n $FPM_RESULTS"
107 scp -P2222 $PACKAGE_NAME*.deb $APTUSER@$APTSERVER:tmp/
111 echo "Debian package for $1 exists, not rebuilding"
115 if [[ ! -d "$WORKSPACE/debs" ]]; then
116 mkdir -p $WORKSPACE/debs
119 # Make sure our destination directory on $APTSERVER exists - prm can delete it when invoked improperly
120 ssh -p2222 $APTUSER@$APTSERVER mkdir tmp
123 # We use $WORKSPACE/src-build-dir as the clean directory from which to build the src package
124 if [[ ! -d "$WORKSPACE/src-build-dir" ]]; then
125 mkdir "$WORKSPACE/src-build-dir"
127 git clone https://github.com/curoverse/arvados.git src-build-dir
130 cd "$WORKSPACE/src-build-dir"
131 # just in case, check out master
134 # go into detached-head state
135 git checkout `git log --format=format:%h -n1 .`
139 build_and_scp_deb $WORKSPACE/src-build-dir/=/usr/local/arvados/src arvados-src 'Curoverse, Inc.' 'dir' "-v 0.1.$GIT_HASH -x 'usr/local/arvados/src/.git*'"
141 # clean up, check out master and step away from detached-head state
142 cd "$WORKSPACE/src-build-dir"
146 export GOPATH=$(mktemp -d)
147 mkdir -p "$GOPATH/src/git.curoverse.com"
148 ln -sfn "$WORKSPACE" "$GOPATH/src/git.curoverse.com/arvados.git"
151 go get "git.curoverse.com/arvados.git/services/keepstore"
153 build_and_scp_deb $GOPATH/bin/keepstore=/usr/bin/keepstore keepstore 'Curoverse, Inc.' 'dir' "-v 0.1.$GIT_HASH"
158 go get "git.curoverse.com/arvados.git/services/keepproxy"
160 build_and_scp_deb $GOPATH/bin/keepproxy=/usr/bin/keepproxy keepproxy 'Curoverse, Inc.' 'dir' "-v 0.1.$GIT_HASH"
163 go get "git.curoverse.com/arvados.git/services/crunchstat"
165 build_and_scp_deb $GOPATH/bin/crunchstat=/usr/bin/crunchstat crunchstat 'Curoverse, Inc.' 'dir' "-v 0.1.$GIT_HASH"
168 cd $WORKSPACE/sdk/python
169 sed -i'' -e "s:version='0.1':version='0.1.$GIT_HASH':" setup.py
173 # Please resist the temptation to add --no-python-fix-name to the fpm call here
174 # (which would remove the python- prefix from the package name), because this
175 # package is a dependency of arvados-fuse, and fpm can not omit the python-
176 # prefix from only one of the dependencies of a package... Maybe I could
177 # whip up a patch and send it upstream, but that will be for another day. Ward,
179 build_and_scp_deb $WORKSPACE/sdk/python python-arvados-python-client 'Curoverse, Inc.' 'python' "-v 0.1.${GIT_HASH}"
182 cd $WORKSPACE/services/fuse
183 sed -i'' -e "s:version='0.1':version='0.1.$GIT_HASH':" setup.py
187 # Please seem comment about --no-python-fix-name above; we stay consistent and do
188 # not omit the python- prefix first.
189 build_and_scp_deb $WORKSPACE/services/fuse python-arvados-fuse 'Curoverse, Inc.' 'python' "-v 0.1.${GIT_HASH}"
192 build_and_scp_deb python-gflags
193 build_and_scp_deb pyvcf
194 build_and_scp_deb google-api-python-client
195 build_and_scp_deb httplib2
196 build_and_scp_deb ws4py
197 build_and_scp_deb virtualenv
199 # Finally, publish the packages, if necessary
200 if [[ "$CALL_PRM" != "0" ]]; then
201 ssh -p2222 $APTUSER@$APTSERVER -t "cd /var/www/$APTSERVER; /usr/local/rvm/bin/rvm default do prm --type deb -p . --component main --release wheezy --arch amd64 -d /home/$APTUSER/tmp/ --gpg 1078ECD7"
203 echo "No new packages generated. No PRM run necessary."
206 # clean up temporary GOPATH