| #!/bin/bash |
| |
| # Copyright (C) 2009 Google Inc. |
| # All rights reserved. |
| # |
| # Redistribution and use in source and binary forms, with or without |
| # modification, are permitted provided that the following conditions are |
| # met: |
| # |
| # 1. Redistributions of source code must retain the above copyright notice, |
| # this list of conditions and the following disclaimer. |
| # |
| # 2. Redistributions in binary form must reproduce the above copyright |
| # notice, this list of conditions and the following disclaimer in the |
| # documentation and/or other materials provided with the distribution. |
| # |
| # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS |
| # IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED |
| # TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
| # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR |
| # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
| # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
| # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
| # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
| # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
| # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
| # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| |
| # This is a test script to ease development and testing on test clusters. |
| # It should not be used to update production environments. |
| |
| # Usage: release v2.0.5 |
| # Alternative: URL=file:///my/git/repo release e5823b7e2cd8a3... |
| # It will clone the given repository from the default or passed URL, |
| # checkout the given reference (a tag or branch) and then create a |
| # release archive; you will need to copy the archive and delete the |
| # temporary directory at the end |
| |
| set -e |
| |
| : ${URL:=git://git.ganeti.org/ganeti.git} |
| TAG="$1" |
| |
| if [[ -z "$TAG" ]]; then |
| echo "Usage: $0 <tree-ish>" >&2 |
| exit 1 |
| fi |
| |
| echo "Using Git repository $URL" |
| |
| TMPDIR=$(mktemp -d -t gntrelease.XXXXXXXXXX) |
| cd $TMPDIR |
| |
| echo "Cloning the repository under $TMPDIR ..." |
| git clone -q "$URL" dist |
| cd dist |
| git checkout $TAG |
| |
| # Check minimum aclocal version for releasing |
| MIN_ACLOCAL_VERSION=( 1 11 1 ) |
| ACLOCAL_VERSION=$(${ACLOCAL:-aclocal} --version | head -1 | \ |
| sed -e 's/^[^0-9]*\([0-9\.]*\)$/\1/') |
| |
| ACLOCAL_VERSION_REST=$ACLOCAL_VERSION |
| for v in ${MIN_ACLOCAL_VERSION[@]}; do |
| ACLOCAL_VERSION_PART=${ACLOCAL_VERSION_REST%%.*} |
| ACLOCAL_VERSION_REST=${ACLOCAL_VERSION_REST#$ACLOCAL_VERSION_PART.} |
| if [[ $v -eq $ACLOCAL_VERSION_PART ]]; then |
| continue |
| elif [[ $v -lt $ACLOCAL_VERSION_PART ]]; then |
| break |
| else # gt |
| echo "aclocal version $ACLOCAL_VERSION is too old (< 1.11.1)" |
| exit 1 |
| fi |
| done |
| |
| ./autogen.sh |
| ./configure |
| |
| VERSION=$(sed -n -e '/^PACKAGE_VERSION =/ s/^PACKAGE_VERSION = // p' Makefile) |
| |
| make distcheck-release |
| fakeroot make dist-release |
| tar tzvf ganeti-$VERSION.tar.gz |
| |
| echo |
| echo 'MD5:' |
| md5sum ganeti-$VERSION.tar.gz |
| echo |
| echo 'SHA1:' |
| sha1sum ganeti-$VERSION.tar.gz |
| echo |
| echo "The archive is at $PWD/ganeti-$VERSION.tar.gz" |
| echo "Please copy it and remove the temporary directory when done." |