packaging: use git-archive in RHEL-CTDB/makerpms.sh
authorMichael Adam <obnox@samba.org>
Thu, 15 May 2008 22:52:46 +0000 (00:52 +0200)
committerMichael Adam <obnox@samba.org>
Fri, 16 May 2008 01:15:23 +0000 (03:15 +0200)
(instead of using tar and make distclean and ...)

Michael
(cherry picked from commit 3ad0f2212720eb5fb33794c033a60f5ea4428c2c)
(This used to be commit 161e7c32caf5d4fee23e1f9c5e8ea871ad2aa57e)

packaging/RHEL-CTDB/makerpms.sh

index 94714e4dddac623aa352a0e4bfb1866ca5bf9cd3..0ee00b76883d4ff9a353cce83946c785bde3cbda 100755 (executable)
@@ -21,8 +21,6 @@ SRCDIR=`rpm --eval %_sourcedir`
 
 # At this point the SPECDIR and SRCDIR variables must have a value!
 
-USERID=`id -u`
-GRPID=`id -g`
 VERSION='3.2.0'
 REVISION='ctdb'
 SPECFILE="samba.spec"
@@ -43,49 +41,35 @@ case $RPMVER in
        ;;
 esac
 
-pushd .
-cd ../../source
-if [ -f Makefile ]; then 
-       make distclean
-fi
-popd
-
-pushd .
-cd ../../
-SRCTREE=`basename $PWD`
-if [ "x${DOCS_TARBALL}" != "x" ] && [ -f ${DOCS_TARBALL} ]; then
-    cp ${DOCS_TARBALL} ${SRCDIR}/${DOCS}
-fi
-cd ../
-chown -R ${USERID}.${GRPID} $SRCTREE
-if [ ! -d samba-${VERSION} ]; then
-       ln -s $SRCTREE samba-${VERSION} || exit 1
-fi
+pushd ../..
 echo -n "Creating samba-${VERSION}.tar.bz2 ... "
-tar --exclude=.svn --exclude=.bzr --exclude=.bzrignore --exclude=docs-orig -chf - samba-${VERSION}/. | bzip2 > ${SRCDIR}/samba-${VERSION}.tar.bz2
+git archive --prefix=samba-${VERSION}/ HEAD | bzip2 > ${SRCDIR}/samba-${VERSION}.tar.bz2
+RC=$?
+popd
 echo "Done."
-if [ $? -ne 0 ]; then
-       popd
-       cd ../../
+if [ $RC -ne 0 ]; then
         echo "Build failed!"
         exit 1
 fi
 
-popd
-
 
 ##
 ## copy additional source files
 ##
+if [ "x${DOCS_TARBALL}" != "x" ] && [ -f ${DOCS_TARBALL} ]; then
+    cp ${DOCS_TARBALL} ${SRCDIR}/${DOCS}
+fi
+
 chmod 755 setup/filter-requires-samba.sh
 tar --exclude=.svn -jcvf - setup > ${SRCDIR}/setup.tar.bz2
+
 cp -p ${SPECFILE} ${SPECDIR}
 
 ##
 ## Build
 ##
 echo "$(basename $0): Getting Ready to build release package"
-cd ${SPECDIR}
+pushd ${SPECDIR}
 ${RPM} -ba $EXTRA_OPTIONS $SPECFILE
 [ `arch` = "x86_64" ] && {
     echo "Building 32 bit winbind libs"
@@ -95,10 +79,7 @@ ${RPM} -ba $EXTRA_OPTIONS $SPECFILE
     ${RPM} -ba --rebuild --target=i386 $SPECFILE
 }
 
-
-
-
-cd ../../
+popd
 
 echo "$(basename $0): Done."