Chris@654: #!/bin/bash
Chris@654: 
Chris@1158: set -eu
Chris@1158: 
Chris@654: tag=`hg tags | grep '^sv_v' | head -1 | awk '{ print $1; }'`
Chris@654: 
Chris@1158: v=`echo "$tag" | sed 's/sv_v//' | sed 's/_.*$//'`
Chris@654: 
Chris@1868: current=$(hg id | awk '{ print $1; }')
Chris@1868: 
Chris@1868: case "$current" in
Chris@1868:     *+) echo "ERROR: Current working copy has been modified - unmodified copy required so we can update to tag and back again safely"; exit 2;;
Chris@1868:     *);;
Chris@1868: esac
Chris@1868:           
Chris@1158: echo
Chris@1158: echo -n "Packaging up version $v from tag $tag... "
Chris@654: 
Chris@1868: hg update -r"$tag"
Chris@1868: 
Chris@1868: ./repoint archive /tmp/sonic-visualiser-"$v".tar.gz --exclude sv-dependency-builds repoint.pri
Chris@1868: 
Chris@1868: hg update -r"$current"
Chris@654: 
Chris@1158: echo Done
Chris@1158: echo
Chris@1158: 
Chris@1158: # Test that the appropriate version of the docs exist on the website
Chris@1158: 
Chris@1158: doc_url="http://sonicvisualiser.org/doc/reference/$v/en/"
Chris@1158: doc_status=$(curl -sL -w "%{http_code}" "$doc_url" -o /dev/null)
Chris@1158: 
Chris@1158: if [ "$doc_status" = "404" ]; then
Chris@1158:     echo "*** WARNING: Documentation URL returns a 404:"
Chris@1158:     echo "***          $doc_url"
Chris@1158:     echo "***          Please fix this before release!"
Chris@1771:     echo "***          And remember to update the link from"
Chris@1771:     echo "             http://www.sonicvisualiser.org/documentation.html !"
Chris@1158:     echo
Chris@1158: fi