3 # makerpms.sh - build RPM packages from the git sources
5 # Copyright (C) John H Terpstra 1998-2002
6 # Copyright (C) Gerald (Jerry) Carter 2003
7 # Copyright (C) Jim McDonough 2007
8 # Copyright (C) Andrew Tridgell 2007
9 # Copyright (C) Michael Adam 2008-2009
11 # This program is free software; you can redistribute it and/or modify it
12 # under the terms of the GNU General Public License as published by the Free
13 # Software Foundation; either version 3 of the License, or (at your option)
16 # This program is distributed in the hope that it will be useful, but WITHOUT
17 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
21 # You should have received a copy of the GNU General Public License along with
22 # this program; if not, see <http://www.gnu.org/licenses/>.
26 # The following allows environment variables to override the target directories
27 # the alternative is to have a file in your home directory calles .rpmmacros
28 # containing the following:
29 # %_topdir /home/mylogin/redhat
31 # Note: Under this directory rpm expects to find the same directories that are under the
32 # /usr/src/redhat directory
38 TOPDIR=${DIRNAME}/../..
40 SPECDIR=`rpm --eval %_specdir`
41 SRCDIR=`rpm --eval %_sourcedir`
46 VERSION=$(grep ^Version ${DIRNAME}/${SPECFILE} | sed -e 's/^Version:\ \+//')
47 RELEASE=$(grep ^Release ${DIRNAME}/${SPECFILE} | sed -e 's/^Release:\ \+//')
49 if echo | gzip -c --rsyncable - > /dev/null 2>&1 ; then
50 GZIP="gzip -9 --rsyncable"
56 echo -n "Creating ctdb-${VERSION}.tar.gz ... "
57 git archive --prefix=ctdb-${VERSION}/ HEAD | ${GZIP} > ${SRCDIR}/ctdb-${VERSION}.tar.gz
61 if [ $RC -ne 0 ]; then
66 # At this point the SPECDIR and SRCDIR vaiables must have a value!
69 ## copy additional source files
71 cp -p ${DIRNAME}/${SPECFILE} ${SPECDIR}
76 echo "$(basename $0): Getting Ready to build release package"
77 ${RPMBUILD} -ba --clean --rmsource ${EXTRA_OPTIONS} ${SPECDIR}/${SPECFILE} || exit 1
79 echo "$(basename $0): Done."