Explicitly push only the new tag, don't use --tags
[xorg-util-modular.git] / release.sh
blob4a990e75a32a30c4efbf225e7e15721c83b47c75
1 #!/bin/sh
3 set -e
5 announce_list="xorg-announce@lists.freedesktop.org"
6 host_people=annarchy.freedesktop.org
7 host_xorg=xorg.freedesktop.org
9 usage()
11 cat <<HELP
12 Usage: `basename $0` [options] <section> <tag_previous> <tag_current>
14 Options:
15 --force force overwritting an existing release
16 --help this help message
17 HELP
20 gen_announce_mail()
22 cat <<RELEASE
23 Subject: [ANNOUNCE] $module $version
24 To: $announce_list
26 `git-log --no-merges $tag_previous..$tag_current | git shortlog`
28 git tag: $tag_current
30 http://$host_xorg/$section_path/$tarbz2
31 MD5: `cd $tarball_dir && md5sum $tarbz2`
32 SHA1: `cd $tarball_dir && sha1sum $tarbz2`
34 http://$host_xorg/$section_path/$targz
35 MD5: `cd $tarball_dir && md5sum $targz`
36 SHA1: `cd $tarball_dir && sha1sum $targz`
38 RELEASE
41 export LC_ALL=C
43 while [ $# != 0 ]; do
44 case "$1" in
45 --force)
46 force="yes"
47 shift
49 --help)
50 usage
51 exit 0
53 --*)
54 echo "error: unknown option"
55 usage
56 exit 1
59 section="$1"
60 tag_previous="$2"
61 tag_current="$3"
62 shift 3
63 if [ $# != 0 ]; then
64 echo "error: unknown parameter"
65 usage
66 exit 1
69 esac
70 done
72 tarball_dir="$(dirname $(find -name config.status))"
73 module="${tag_current%-*}"
74 version="${tag_current##*-}"
75 tarbz2="$tag_current.tar.bz2"
76 targz="$tag_current.tar.gz"
77 announce="$tarball_dir/$tag_current.announce"
79 section_path="archive/individual/$section"
80 srv_path="/srv/$host_xorg/$section_path"
82 echo "checking parameters"
83 if ! [ -f "$tarball_dir/$tarbz2" ] ||
84 ! [ -f "$tarball_dir/$targz" ] ||
85 [ -z "$tag_previous" ] ||
86 [ -z "$section" ]; then
87 echo "error: incorrect parameters!"
88 usage
89 exit 1
92 echo "checking for proper current dir"
93 if ! [ -d .git ]; then
94 echo "error: do this from your git dir, weenie"
95 exit 1
98 echo "checking for an existing tag"
99 if ! git tag -l $tag_current >/dev/null; then
100 echo "error: you must tag your release first!"
101 exit 1
104 echo "checking for an existing release"
105 if ssh $host_people ls $srv_path/$targz >/dev/null 2>&1 ||
106 ssh $host_people ls $srv_path/$tarbz2 >/dev/null 2>&1; then
107 if [ "x$force" = "xyes" ]; then
108 echo "warning: overriding released file ... here be dragons."
109 else
110 echo "error: file already exists!"
111 exit 1
115 echo "generating announce mail template, remember to sign it"
116 gen_announce_mail >$announce
117 echo " at: $announce"
119 echo "installing release into server"
120 scp $tarball_dir/$targz $tarball_dir/$tarbz2 $host_people:$srv_path
122 echo "pushing changes upstream"
123 git push origin $tag_current