Add a copy of ganeti's devel/release
[ext/instance-debootstrap.git] / devel / release
1 #!/bin/bash
2
3 # Copyright (C) 2012 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/instance-debootstrap.git}
33 TAG="$1"
34
35 if [[ -z "$TAG" ]]; then
36   echo "Usage: $0 <tree-ish>" >&2
37   exit 1
38 fi
39
40 echo "Using Git repository $URL"
41
42 TMPDIR=$(mktemp -d -t gntrelease.XXXXXXXXXX)
43 cd $TMPDIR
44
45 echo "Cloning the repository under $TMPDIR ..."
46 git clone -q "$URL" dist
47 cd dist
48 git checkout $TAG
49 ./autogen.sh
50 ./configure
51
52 VERSION=$(sed -n -e '/^PACKAGE_VERSION =/ s/^PACKAGE_VERSION = // p' Makefile)
53
54 make distcheck
55 fakeroot make dist
56 tar tzvf ganeti-instance-debootstrap-$VERSION.tar.gz
57
58 echo
59 echo 'MD5:'
60 md5sum ganeti-instance-debootstrap-$VERSION.tar.gz
61 echo
62 echo 'SHA1:'
63 sha1sum ganeti-instance-debootstrap-$VERSION.tar.gz
64 echo
65 echo "The archive is at $PWD/ganeti-instance-debootstrap-$VERSION.tar.gz"
66 echo "Please copy it and remove the temporary directory when done."