source: trunk/server/packaging/RHEL-CTDB/makerpms.sh@ 1036

Last change on this file since 1036 was 745, checked in by Silvan Scherrer, 13 years ago

Samba Server: updated trunk to 3.6.0

File size: 3.4 KB
Line 
1#!/bin/sh
2# Copyright (C) John H Terpstra 1998-2002
3# Copyright (C) Gerald (Jerry) Carter 2003
4# Copyright (C) Michael Adam 2008
5
6# Script to build RPMs for RHEL from inside a git checkout.
7
8# The following allows environment variables to override the target directories
9# the alternative is to have a file in your home directory calles .rpmmacros
10# containing the following:
11# %_topdir /home/mylogin/redhat
12#
13# Note: Under this directory rpm expects to find the same directories
14# that are under the /usr/src/redhat directory.
15
16# extra options passed to rpmbuild
17EXTRA_OPTIONS="$1"
18
19RPMSPECDIR=`rpm --eval %_specdir`
20RPMSRCDIR=`rpm --eval %_sourcedir`
21RPMBUILDDIR=`rpm --eval %_builddir`
22
23# At this point the RPMSPECDIR and RPMSRCDIR variables must have a value!
24
25DIRNAME=$(dirname $0)
26TOPDIR=${DIRNAME}/../..
27
28SPECFILE="samba.spec"
29RPMVER=`rpm --version | awk '{print $3}'`
30RPM="rpmbuild"
31
32##
33## Check the RPM version (paranoid)
34##
35case $RPMVER in
36 4*)
37 echo "Supported RPM version [$RPMVER]"
38 ;;
39 *)
40 echo "Unknown RPM version: `rpm --version`"
41 exit 1
42 ;;
43esac
44
45##
46## Delete the old debuginfo remnants:
47##
48## At least on RHEL 5.5, we observed broken debuginfo packages
49## when either old build directories were still present or old
50## debuginfo packages (of samba) were installed.
51##
52## Remove the debuginfo samba RPMs and old RPM build
53## directories, giving the user a 10 second chance to quit.
54##
55
56if rpm -qa | grep -q samba-debuginfo || test -n "$(echo ${RPMBUILDDIR}/samba* | grep -v \*)" ; then
57 echo "Removing debuginfo remnants to fix debuginfo build:"
58 if rpm -qa | grep -q samba-debuginfo ; then
59 echo "Uninstalling the samba-debuginfo RPM"
60 echo -n "Press Control-C if you want to quit (you have 10 seconds)"
61 for count in $(seq 1 10) ; do
62 echo -n "."
63 sleep 1
64 done
65 echo
66 echo "That was your chance... :-)"
67 rpm -e samba-debuginfo
68 fi
69 if test -n "$(echo ${RPMBUILDDIR}/samba* | grep -v \*)" ; then
70 echo "Deleting ${RPMBUILDDIR}/samba*"
71 echo -n "Press Control-C if you want to quit (you have 10 seconds)"
72 for count in $(seq 1 10) ; do
73 echo -n "."
74 sleep 1
75 done
76 echo
77 echo "That was your chance... :-)"
78 rm -rf ${RPMBUILDDIR}/samba*
79 fi
80fi
81
82##
83## determine the samba version and create the SPEC file
84##
85${DIRNAME}/makespec.sh
86RC=$?
87if [ $RC -ne 0 ]; then
88 exit ${RC}
89fi
90
91RELEASE=$(grep ^Release ${DIRNAME}/${SPECFILE} | sed -e 's/^Release:\ \+//')
92VERSION=$(grep ^Version ${DIRNAME}/${SPECFILE} | sed -e 's/^Version:\ \+//')
93
94##
95## create the tarball
96##
97pushd ${TOPDIR}
98echo -n "Creating samba-${VERSION}.tar.bz2 ... "
99git archive --prefix=samba-${VERSION}/ HEAD | bzip2 > ${RPMSRCDIR}/samba-${VERSION}.tar.bz2
100RC=$?
101popd
102echo "Done."
103if [ $RC -ne 0 ]; then
104 echo "Build failed!"
105 exit 1
106fi
107
108
109##
110## copy additional source files
111##
112pushd ${DIRNAME}
113
114chmod 755 setup/filter-requires-samba.sh
115tar --exclude=.svn -jcvf - setup > ${RPMSRCDIR}/setup.tar.bz2
116
117cp -p ${SPECFILE} ${RPMSPECDIR}
118
119popd
120
121##
122## some symlink fixes for building 32bit compat libs
123##
124if [ `arch` = "x86_64" ]; then
125 ln -sf /lib/libcom_err.so.2 /lib/libcom_err.so
126 ln -sf /lib/libuuid.so.1 /lib/libuuid.so
127fi
128
129##
130## Build
131##
132echo "$(basename $0): Getting Ready to build release package"
133
134pushd ${RPMSPECDIR}
135${RPM} -ba $EXTRA_OPTIONS $SPECFILE
136popd
137
138echo "$(basename $0): Done."
139
Note: See TracBrowser for help on using the repository browser.