Statistics
| Branch: | Tag: | Revision:

root / devel / release @ ea2bcb82

History | View | Annotate | Download (2.5 kB)

1 2b32e20c Iustin Pop
#!/bin/bash
2 2b32e20c Iustin Pop
3 2b32e20c Iustin Pop
# Copyright (C) 2009 Google Inc.
4 2b32e20c Iustin Pop
#
5 2b32e20c Iustin Pop
# This program is free software; you can redistribute it and/or modify
6 2b32e20c Iustin Pop
# it under the terms of the GNU General Public License as published by
7 2b32e20c Iustin Pop
# the Free Software Foundation; either version 2 of the License, or
8 2b32e20c Iustin Pop
# (at your option) any later version.
9 2b32e20c Iustin Pop
#
10 2b32e20c Iustin Pop
# This program is distributed in the hope that it will be useful, but
11 2b32e20c Iustin Pop
# WITHOUT ANY WARRANTY; without even the implied warranty of
12 2b32e20c Iustin Pop
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13 2b32e20c Iustin Pop
# General Public License for more details.
14 2b32e20c Iustin Pop
#
15 2b32e20c Iustin Pop
# You should have received a copy of the GNU General Public License
16 2b32e20c Iustin Pop
# along with this program; if not, write to the Free Software
17 2b32e20c Iustin Pop
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18 2b32e20c Iustin Pop
# 02110-1301, USA.
19 2b32e20c Iustin Pop
20 2b32e20c Iustin Pop
# This is a test script to ease development and testing on test clusters.
21 2b32e20c Iustin Pop
# It should not be used to update production environments.
22 2b32e20c Iustin Pop
23 2b32e20c Iustin Pop
# Usage: release v2.0.5
24 2b32e20c Iustin Pop
# Alternative: URL=file:///my/git/repo release e5823b7e2cd8a3...
25 2b32e20c Iustin Pop
# It will clone the given repository from the default or passed URL,
26 2b32e20c Iustin Pop
# checkout the given reference (a tag or branch) and then create a
27 2b32e20c Iustin Pop
# release archive; you will need to copy the archive and delete the
28 2b32e20c Iustin Pop
# temporary directory at the end
29 2b32e20c Iustin Pop
30 2b32e20c Iustin Pop
set -e
31 2b32e20c Iustin Pop
32 2b32e20c Iustin Pop
: ${URL:=git://git.ganeti.org/ganeti.git}
33 2b32e20c Iustin Pop
TAG="$1"
34 2b32e20c Iustin Pop
35 5548de18 Michael Hanselmann
if [[ -z "$TAG" ]]; then
36 5548de18 Michael Hanselmann
  echo "Usage: $0 <tree-ish>" >&2
37 5548de18 Michael Hanselmann
  exit 1
38 5548de18 Michael Hanselmann
fi
39 5548de18 Michael Hanselmann
40 5548de18 Michael Hanselmann
echo "Using Git repository $URL"
41 5548de18 Michael Hanselmann
42 5548de18 Michael Hanselmann
TMPDIR=$(mktemp -d -t gntrelease.XXXXXXXXXX)
43 2b32e20c Iustin Pop
cd $TMPDIR
44 5548de18 Michael Hanselmann
45 2b32e20c Iustin Pop
echo "Cloning the repository under $TMPDIR ..."
46 2b32e20c Iustin Pop
git clone -q "$URL" dist
47 2b32e20c Iustin Pop
cd dist
48 2b32e20c Iustin Pop
git checkout $TAG
49 3ff614e2 Guido Trotter
50 3ff614e2 Guido Trotter
# Check minimum aclocal version for releasing
51 3ff614e2 Guido Trotter
MIN_ACLOCAL_VERSION=( 1 11 1 )
52 3ff614e2 Guido Trotter
ACLOCAL_VERSION=$(${ACLOCAL:-aclocal} --version | head -1 | \
53 3ff614e2 Guido Trotter
                 sed -e 's/^[^0-9]*\([0-9\.]*\)$/\1/')
54 3ff614e2 Guido Trotter
55 3ff614e2 Guido Trotter
ACLOCAL_VERSION_REST=$ACLOCAL_VERSION
56 3ff614e2 Guido Trotter
for v in ${MIN_ACLOCAL_VERSION[@]}; do
57 3ff614e2 Guido Trotter
 ACLOCAL_VERSION_PART=${ACLOCAL_VERSION_REST%%.*}
58 3ff614e2 Guido Trotter
 ACLOCAL_VERSION_REST=${ACLOCAL_VERSION_REST#$ACLOCAL_VERSION_PART.}
59 3ff614e2 Guido Trotter
 if [[ $v -eq $ACLOCAL_VERSION_PART ]]; then
60 3ff614e2 Guido Trotter
   continue
61 3ff614e2 Guido Trotter
 elif [[ $v -lt $ACLOCAL_VERSION_PART ]]; then
62 3ff614e2 Guido Trotter
   break
63 3ff614e2 Guido Trotter
 else # gt
64 3ff614e2 Guido Trotter
   echo "aclocal version $ACLOCAL_VERSION is too old (< 1.11.1)"
65 3ff614e2 Guido Trotter
   exit 1
66 3ff614e2 Guido Trotter
 fi
67 3ff614e2 Guido Trotter
done
68 3ff614e2 Guido Trotter
69 2b32e20c Iustin Pop
./autogen.sh
70 2b32e20c Iustin Pop
./configure
71 5548de18 Michael Hanselmann
72 2b32e20c Iustin Pop
VERSION=$(sed -n -e '/^PACKAGE_VERSION =/ s/^PACKAGE_VERSION = // p' Makefile)
73 5548de18 Michael Hanselmann
74 2ba14c2f Michael Hanselmann
make distcheck-release
75 2ba14c2f Michael Hanselmann
fakeroot make dist-release
76 2b32e20c Iustin Pop
tar tzvf ganeti-$VERSION.tar.gz
77 5548de18 Michael Hanselmann
78 5548de18 Michael Hanselmann
echo
79 5548de18 Michael Hanselmann
echo 'MD5:'
80 5548de18 Michael Hanselmann
md5sum ganeti-$VERSION.tar.gz
81 5548de18 Michael Hanselmann
echo
82 5548de18 Michael Hanselmann
echo 'SHA1:'
83 2b32e20c Iustin Pop
sha1sum ganeti-$VERSION.tar.gz
84 5548de18 Michael Hanselmann
echo
85 2b32e20c Iustin Pop
echo "The archive is at $PWD/ganeti-$VERSION.tar.gz"
86 2b32e20c Iustin Pop
echo "Please copy it and remove the temporary directory when done."