Add snap-server to the test-relevenat packages
[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 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
50 # Check minimum aclocal version for releasing
51 MIN_ACLOCAL_VERSION=( 1 11 1 )
52 ACLOCAL_VERSION=$(${ACLOCAL:-aclocal} --version | head -1 | \
53                  sed -e 's/^[^0-9]*\([0-9\.]*\)$/\1/')
54
55 ACLOCAL_VERSION_REST=$ACLOCAL_VERSION
56 for v in ${MIN_ACLOCAL_VERSION[@]}; do
57  ACLOCAL_VERSION_PART=${ACLOCAL_VERSION_REST%%.*}
58  ACLOCAL_VERSION_REST=${ACLOCAL_VERSION_REST#$ACLOCAL_VERSION_PART.}
59  if [[ $v -eq $ACLOCAL_VERSION_PART ]]; then
60    continue
61  elif [[ $v -lt $ACLOCAL_VERSION_PART ]]; then
62    break
63  else # gt
64    echo "aclocal version $ACLOCAL_VERSION is too old (< 1.11.1)"
65    exit 1
66  fi
67 done
68
69 ./autogen.sh
70 ./configure
71
72 VERSION=$(sed -n -e '/^PACKAGE_VERSION =/ s/^PACKAGE_VERSION = // p' Makefile)
73
74 make distcheck-release
75 fakeroot make dist-release
76 tar tzvf ganeti-$VERSION.tar.gz
77
78 echo
79 echo 'MD5:'
80 md5sum ganeti-$VERSION.tar.gz
81 echo
82 echo 'SHA1:'
83 sha1sum ganeti-$VERSION.tar.gz
84 echo
85 echo "The archive is at $PWD/ganeti-$VERSION.tar.gz"
86 echo "Please copy it and remove the temporary directory when done."