packaging: Use maketarball.sh script to create tarball for RPM
authorAmitay Isaacs <amitay@gmail.com>
Tue, 30 Oct 2012 00:54:52 +0000 (11:54 +1100)
committerAmitay Isaacs <amitay@gmail.com>
Tue, 30 Oct 2012 07:01:38 +0000 (18:01 +1100)
This removes the duplicate code for building tarball and reuses existing
script.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
packaging/RPM/makerpms.sh

index 254abde84860ab69c1c2ca5d396c128d72263099..c216185cca41513c195513267cd0fc716114aed1 100755 (executable)
@@ -52,7 +52,7 @@ mkdir -p `rpm --eval %_rpmdir`/noarch
 mkdir -p `rpm --eval %_rpmdir`/i386
 mkdir -p `rpm --eval %_rpmdir`/x86_64
 
-VERSION=$(${TOPDIR}/packaging/mkversion.sh)
+VERSION=$(${TOPDIR}/packaging/mkversion.sh ${TOPDIR}/include/version.h)
 if [ -z "$VERSION" ]; then
     exit 1
 fi
@@ -61,23 +61,10 @@ sed -e s/@VERSION@/$VERSION/g \
        < ${DIRNAME}/${SPECFILE_IN} \
        > ${DIRNAME}/${SPECFILE}
 
-VERSION=$(grep ^Version ${DIRNAME}/${SPECFILE} | sed -e 's/^Version:\ \+//')
-
-if echo | gzip -c --rsyncable - > /dev/null 2>&1 ; then
-       GZIP="gzip -9 --rsyncable"
-else
-       GZIP="gzip -9"
-fi
-
-pushd ${TOPDIR}
-echo -n "Creating ctdb-${VERSION}.tar.gz ... "
-git archive --prefix=ctdb-${VERSION}/ HEAD | ${GZIP} > ${SRCDIR}/ctdb-${VERSION}.tar.gz
-RC=$?
-popd
-echo "Done."
-if [ $RC -ne 0 ]; then
-        echo "Build failed!"
-        exit 1
+${TOPDIR}/packaging/maketarball.sh ${SRCDIR}
+if [ $? -ne 0 ]; then
+       echo "Build failed!"
+       exit 1
 fi
 
 # At this point the SPECDIR and SRCDIR vaiables must have a value!