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`
43 SPECFILE
="libnfs.spec"
44 SPECFILE_IN
="libnfs.spec.in"
47 # We use tags and determine the version, as follows:
48 # libnfs-0.9.1 (First release of 0.9).
49 # libnfs-0.9.23 (23rd minor release of the 112 version)
51 # If we're not directly on a tag, this is a devel release; we append
52 # .0.<patchnum>.<checksum>.devel to the release.
58 *-*-g*) # 0.9-168-ge6cf0e8
59 # Not exactly on tag: devel version.
60 VERSION
=`echo "$TAG" | sed 's/\([^-]\+\)-\([0-9]\+\)-\(g[0-9a-f]\+\)/\1.0.\2.\3.devel/'`
63 # An actual release version
69 echo Invalid tag
"$TAG" >&2
74 sed -e s
/@VERSION@
/$VERSION/g \
75 < ${DIRNAME}/${SPECFILE_IN} \
76 > ${DIRNAME}/${SPECFILE}
78 VERSION
=$
(grep ^Version
${DIRNAME}/${SPECFILE} |
sed -e 's/^Version:\ \+//')
80 if echo |
gzip -c --rsyncable - > /dev
/null
2>&1 ; then
81 GZIP
="gzip -9 --rsyncable"
87 echo -n "Creating libnfs-${VERSION}.tar.gz ... "
88 git archive
--prefix=libnfs-
${VERSION}/ HEAD | ${GZIP} > ${SRCDIR}/libnfs-${VERSION}.
tar.gz
92 if [ $RC -ne 0 ]; then
97 # At this point the SPECDIR and SRCDIR vaiables must have a value!
100 ## copy additional source files
102 cp -p ${DIRNAME}/${SPECFILE} ${SPECDIR}
107 echo "$(basename $0): Getting Ready to build release package"
108 ${RPMBUILD} -ba --clean --rmsource ${EXTRA_OPTIONS} ${SPECDIR}/${SPECFILE} ||
exit 1
110 echo "$(basename $0): Done."