packaging(RHEL-CTDB): autodetect the samba version number from version.h
authorMichael Adam <obnox@samba.org>
Thu, 4 Sep 2008 12:36:29 +0000 (14:36 +0200)
committerMichael Adam <obnox@samba.org>
Mon, 8 Sep 2008 12:43:38 +0000 (14:43 +0200)
Generate version.h first.
Create samba.spec from (new) samba.spec.tmpl, replacing PVERSION
by the version string. (as is done with update-pkginfo called
from the create-tarball release script)

Michael
(This used to be commit f1f3d1bef0440f4294f7278c0c38e13a10b6fb48)

packaging/RHEL-CTDB/makerpms.sh
packaging/RHEL-CTDB/samba.spec.tmpl [moved from packaging/RHEL-CTDB/samba.spec with 99% similarity]

index 978cca9..0c8a2de 100755 (executable)
@@ -23,9 +23,10 @@ RPMSRCDIR=`rpm --eval %_sourcedir`
 
 DIRNAME=$(dirname $0)
 TOPDIR=${DIRNAME}/../..
+SRCDIR=${TOPDIR}/source
+VERSION_H=${SRCDIR}/include/version.h
 
 SPECFILE="samba.spec"
-VERSION=$(grep ^Version ${DIRNAME}/${SPECFILE} | sed -e 's/^Version:\ \+//')
 DOCS="docs.tar.bz2"
 RPMVER=`rpm --version | awk '{print $3}'`
 RPM="rpmbuild"
@@ -43,6 +44,31 @@ case $RPMVER in
        ;;
 esac
 
+##
+## determine the samba version and create the SPEC file
+##
+pushd ${SRCDIR}
+./script/mkversion.sh
+popd
+if [ ! -f ${VERSION_H} ] ; then
+       echo "Error creating version.h"
+       exit 1
+fi
+
+VERSION=`grep SAMBA_VERSION_OFFICIAL_STRING ${VERSION_H} | awk '{print $3}'`
+vendor_version=`grep SAMBA_VERSION_VENDOR_SUFFIX ${VERSION_H} | awk '{print $3}'`
+if test "x${vendor_version}"  != "x" ; then
+       VERSION="${VERSION}-${vendor_version}"
+fi
+VERSION=`echo ${VERSION} | sed 's/\"//g'`
+echo "VERSION: ${VERSION}"
+sed -e s/PVERSION/${VERSION}/g \
+       < ${DIRNAME}/${SPECFILE}.tmpl \
+       > ${DIRNAME}/${SPECFILE}
+
+##
+## create the tarball
+##
 pushd ${TOPDIR}
 echo -n "Creating samba-${VERSION}.tar.bz2 ... "
 git archive --prefix=samba-${VERSION}/ HEAD | bzip2 > ${RPMSRCDIR}/samba-${VERSION}.tar.bz2
similarity index 99%
rename from packaging/RHEL-CTDB/samba.spec
rename to packaging/RHEL-CTDB/samba.spec.tmpl
index 5f5edad..b34f01f 100644 (file)
@@ -5,7 +5,7 @@ Summary: Samba SMB client and server
 Vendor: Samba Team
 Packager: Samba Team <samba@samba.org>
 Name:         samba
-Version:      3.3.0
+Version:      PVERSION
 Release:      ctdb.1
 Epoch:        0
 License: GNU GPL version 3