smoketest.rb: Fix for xapian-core changes
[xapian.git] / xapian-maintainer-tools / git-tag-release
bloba030db52dcd33e1d3db843b6cb19be98482a81c7
1 #!/bin/sh
3 # Copyright (C) 2004,2005,2007,2008,2010,2012,2013,2014,2015,2016 Olly Betts
5 # Permission is hereby granted, free of charge, to any person obtaining a copy
6 # of this software and associated documentation files (the "Software"), to
7 # deal in the Software without restriction, including without limitation the
8 # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
9 # sell copies of the Software, and to permit persons to whom the Software is
10 # furnished to do so, subject to the following conditions:
12 # The above copyright notice and this permission notice shall be included in
13 # all copies or substantial portions of the Software.
15 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21 # IN THE SOFTWARE.
23 set -e
25 BRANCH=master
27 RELEASE_WEB_BASE_URL=https://oligarchy.co.uk/xapian
28 RELEASE_WEB_BASE_DIR=/srv/www/oligarchy.co.uk/xapian
30 version=$1
32 # check parameter was passed and that it looks like a version
33 case $version in
34 [0-9].[0-9].[0-9]) ;;
35 [0-9].[0-9].[1-9][0-9]) ;;
37 echo "Syntax: $0 VERSION"
38 echo "e.g. $0 1.0.18"
39 exit 1
41 esac
43 # Check that we've not already done this version.
44 RELEASE_URL=$RELEASE_WEB_BASE_URL/$version/
45 RELEASE_DIR=$RELEASE_WEB_BASE_DIR/$version/
47 if [ "`git branch --color=never --contains|cut -d' ' -f2-`" != "$BRANCH" ] ; then
48 echo "Not on branch $BRANCH"
49 exit 1
52 # Avoid tagging a release with the wrong versions in the tarballs (as
53 # happened with 1.1.4).
54 bad=0
55 escaped_version=`echo "$version"|sed 's/\([^0-9]\)/\\\\\\1/g'`
56 for d in xapian-core xapian-bindings xapian-applications/omega ; do
57 grep '^\(AC_INIT(\|m4_define(\[project_version\],\).*\<'"$escaped_version"'\>' "$d/configure.ac" >/dev/null || {
58 echo "$d/configure.ac not version $version" 1>&2
59 bad=1
61 done
62 [ "$bad" = "0" ] || exit 1
64 head_output=`HEAD "$RELEASE_URL" 2>/dev/null||true`
65 case $head_output in
66 "404 "*) ;;
68 cat <<END
69 Version $version already has a download directory:
70 $ HEAD '$RELEASE_URL'
71 $head_output
72 END
73 exit 1
75 esac
77 echo "Setting up temporary source tree"
78 DIR=`mktemp -d TMP.make_dist.XXXXXXXXXX`
79 git clone . "$DIR"
80 mkdir "$DIR/BUILD"
81 # Ignore failure - there may be no cached tarballs.
82 ln BUILD/*.tar* "$DIR/BUILD" || true
83 cd "$DIR"
84 git clone ../swig
86 echo "Building release tarballs"
87 ./bootstrap --download-tools=always
88 ./configure
89 time make -sj8
90 time make -sj8 distcheck
91 cd ..
93 RESULT=`mktemp -d "RESULT-$version-XXXXXXXXXX"`
94 echo "Signing tarballs"
95 find "$DIR" -name "xapian-*-$version.tar.*"|while read f ; do
96 gpg --detach-sign --armour "$f"
97 mv "$f" "$f.asc" "$RESULT"
98 done
100 echo "Deleting build tree"
101 rm -rf "$DIR"
103 echo "Tagging"
104 tag=v$version
105 if git tag -v "$tag" > /dev/null 2>&1 ; then
106 echo "Tag '$tag' exists"
107 else
108 echo "Tagging '$tag'"
109 git tag -s -m "Xapian $version release" "$tag" "$BRANCH"
112 echo "Copying to server"
113 chmod 755 "$RESULT"
114 scp -r "$RESULT" thyestes.tartarus.org:"$RELEASE_DIR"
116 echo "Adding to trac"
117 # Add the version to the list in trac, close old milestone, ensure new
118 # milestone exists, and create the ReleaseNotes and ReleaseOverview
119 # pages:
120 ssh thyestes.tartarus.org bin/xapian-trac-new-release "$version"