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[@]}
109 if [[ ! $FPM_RESULTS =~ "File already exists" ]]; then
110 if [[ "$FPM_EXIT_CODE" != "0" ]]; then
111 echo "Error building debian package for $1:\n $FPM_RESULTS"
113 scp -P2222 "$PACKAGE_NAME"_"$VERSION"*.deb $APTUSER@$APTSERVER:tmp/
117 echo "Debian package for $1 exists, not rebuilding"
121 if [[ ! -d "$WORKSPACE/debs" ]]; then
122 mkdir -p $WORKSPACE/debs
125 # Make sure our destination directory on $APTSERVER exists - prm can delete it when invoked improperly
126 ssh -p2222 $APTUSER@$APTSERVER mkdir tmp
129 # We use $WORKSPACE/src-build-dir as the clean directory from which to build the src package
130 if [[ ! -d "$WORKSPACE/src-build-dir" ]]; then
131 mkdir "$WORKSPACE/src-build-dir"
133 git clone https://github.com/curoverse/arvados.git src-build-dir
136 cd "$WORKSPACE/src-build-dir"
137 # just in case, check out master
140 # go into detached-head state
141 git checkout `git log --format=format:%h -n1 .`
145 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*'"
147 # clean up, check out master and step away from detached-head state
148 cd "$WORKSPACE/src-build-dir"
152 export GOPATH=$(mktemp -d)
153 mkdir -p "$GOPATH/src/git.curoverse.com"
154 ln -sfn "$WORKSPACE" "$GOPATH/src/git.curoverse.com/arvados.git"
157 go get "git.curoverse.com/arvados.git/services/keepstore"
159 build_and_scp_deb $GOPATH/bin/keepstore=/usr/bin/keepstore keepstore 'Curoverse, Inc.' 'dir' "0.1.$GIT_HASH"
164 go get "git.curoverse.com/arvados.git/services/keepproxy"
166 build_and_scp_deb $GOPATH/bin/keepproxy=/usr/bin/keepproxy keepproxy 'Curoverse, Inc.' 'dir' "0.1.$GIT_HASH"
169 go get "git.curoverse.com/arvados.git/services/crunchstat"
171 build_and_scp_deb $GOPATH/bin/crunchstat=/usr/bin/crunchstat crunchstat 'Curoverse, Inc.' 'dir' "0.1.$GIT_HASH"
174 cd $WORKSPACE/sdk/python
175 sed -i'' -e "s:version='0.1':version='0.1.$GIT_HASH':" setup.py
179 # Please resist the temptation to add --no-python-fix-name to the fpm call here
180 # (which would remove the python- prefix from the package name), because this
181 # package is a dependency of arvados-fuse, and fpm can not omit the python-
182 # prefix from only one of the dependencies of a package... Maybe I could
183 # whip up a patch and send it upstream, but that will be for another day. Ward,
185 build_and_scp_deb $WORKSPACE/sdk/python python-arvados-python-client 'Curoverse, Inc.' 'python' "0.1.${GIT_HASH}"
188 cd $WORKSPACE/services/fuse
189 sed -i'' -e "s:version='0.1':version='0.1.$GIT_HASH':" setup.py
193 # Please seem comment about --no-python-fix-name above; we stay consistent and do
194 # not omit the python- prefix first.
195 build_and_scp_deb $WORKSPACE/services/fuse python-arvados-fuse 'Curoverse, Inc.' 'python' "0.1.${GIT_HASH}"
198 build_and_scp_deb python-gflags
199 build_and_scp_deb pyvcf
200 build_and_scp_deb google-api-python-client
201 build_and_scp_deb httplib2
202 build_and_scp_deb ws4py
203 build_and_scp_deb virtualenv
205 # Finally, publish the packages, if necessary
206 if [[ "$CALL_PRM" != "0" ]]; then
207 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"
209 echo "No new packages generated. No PRM run necessary."
212 # clean up temporary GOPATH