rel=$1
tag=`date +%s`
BB_ACCESS=`cat /z/.bitbucket`
echo $rel $tag

hg clone https://bitbucket.org/Spivey/obc-3 -u $rel obc-$tag
cd obc-$tag
autoreconf \
&& ./configure \
&& make \
&& make test0 \
&& make test \
&& (cd winport; make \
  && make package \
  && curl -u $BB_ACCESS \
        https://api.bitbucket.org/2.0/repositories/Spivey/obc-3/downloads/ \
	-F files=@`echo obc-win*.exe`)
