3 # maketarball.sh - create a tarball from the git branch HEAD
5 # Copyright (C) Michael Adam 2009
7 # This program is free software; you can redistribute it and/or modify it
8 # under the terms of the GNU General Public License as published by the Free
9 # Software Foundation; either version 3 of the License, or (at your option)
12 # This program is distributed in the hope that it will be useful, but WITHOUT
13 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
17 # You should have received a copy of the GNU General Public License along with
18 # this program; if not, see <http://www.gnu.org/licenses/>.
22 # Create CTDB source tarball of the current git branch HEAD.
23 # The version is calculated from git tag in mkversion.sh.
24 # Optional argument is the directory to which tarball is copied.
31 if [ -z "${TARGETDIR}" ]; then
35 TAR_PREFIX_TMP="ctdb-tmp"
36 SPECFILE=/tmp/${TAR_PREFIX_TMP}/packaging/RPM/ctdb.spec
37 SPECFILE_IN=${SPECFILE}.in
38 VERSION_H=/tmp/${TAR_PREFIX_TMP}/include/ctdb_version.h
40 if echo | gzip -c --rsyncable - > /dev/null 2>&1 ; then
41 GZIP="gzip -9 --rsyncable"
47 echo "Creating tarball ... "
48 git archive --prefix=${TAR_PREFIX_TMP}/ HEAD | ( cd /tmp ; tar xf - )
51 if [ $RC -ne 0 ]; then
52 echo "Error calling git archive."
56 set -- $(${TOPDIR}/packaging/mkversion.sh ${VERSION_H})
59 if [ -z "$VERSION" -o -z "$RELEASE" ]; then
63 sed -e "s/@VERSION@/${VERSION}/g" \
64 -e "s/@RELEASE@/$RELEASE/g" \
68 TAR_PREFIX="ctdb-${VERSION}"
69 TAR_BASE="ctdb-${VERSION}"
71 pushd /tmp/${TAR_PREFIX_TMP}
74 if [ $RC -ne 0 ]; then
75 echo "Error calling autogen.sh."
81 if [ $RC -ne 0 ]; then
82 echo "Error building docs."
87 if test "x${DEBIAN_MODE}" = "xyes" ; then
88 TAR_PREFIX="ctdb-${VERSION}.orig"
89 TAR_BASE="ctdb_${VERSION}.orig"
90 rm -rf /tmp/${TAR_PREFIX_TMP}/lib/popt
93 TAR_BALL=${TAR_BASE}.tar
94 TAR_GZ_BALL=${TAR_BALL}.gz
96 mv /tmp/${TAR_PREFIX_TMP} /tmp/${TAR_PREFIX}
99 tar cf ${TAR_BALL} ${TAR_PREFIX}
101 if [ $RC -ne 0 ]; then
103 echo "Creation of tarball failed."
109 if [ $RC -ne 0 ]; then
111 echo "Zipping tarball failed."
119 mv /tmp/${TAR_GZ_BALL} ${TARGETDIR}/