Add a release script
[ganeti-local] / devel / release
1 #!/bin/bash
2
3 # Copyright (C) 2009 Google Inc.
4 #
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2 of the License, or
8 # (at your option) any later version.
9 #
10 # This program is distributed in the hope that it will be useful, but
11 # WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13 # General Public License for more details.
14 #
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software
17 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18 # 02110-1301, USA.
19
20 # This is a test script to ease development and testing on test clusters.
21 # It should not be used to update production environments.
22
23 # Usage: release v2.0.5
24 # Alternative: URL=file:///my/git/repo release e5823b7e2cd8a3...
25 # It will clone the given repository from the default or passed URL,
26 # checkout the given reference (a tag or branch) and then create a
27 # release archive; you will need to copy the archive and delete the
28 # temporary directory at the end
29
30 set -e
31
32 : ${URL:=git://git.ganeti.org/ganeti.git}
33 TAG="$1"
34
35 TMPDIR=`mktemp -d`
36 cd $TMPDIR
37 echo "Cloning the repository under $TMPDIR ..."
38 git clone -q "$URL" dist
39 cd dist
40 git checkout $TAG
41 ./autogen.sh
42 ./configure
43 VERSION=$(sed -n -e '/^PACKAGE_VERSION =/ s/^PACKAGE_VERSION = // p' Makefile)
44 make distcheck
45 fakeroot make dist
46 tar tzvf ganeti-$VERSION.tar.gz
47 sha1sum ganeti-$VERSION.tar.gz
48 echo "The archive is at $PWD/ganeti-$VERSION.tar.gz"
49 echo "Please copy it and remove the temporary directory when done."