1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00

packaging: Use common code to generate VERSION string

Signed-off-by: Amitay Isaacs <amitay@gmail.com>

(This used to be ctdb commit 0019291371af1e63ee132ed173ba7f52a0291a44)
This commit is contained in:
Amitay Isaacs 2012-10-22 15:12:50 +11:00
parent 5ea3a56b62
commit 231898db1f
2 changed files with 9 additions and 39 deletions

View File

@ -52,32 +52,10 @@ mkdir -p `rpm --eval %_rpmdir`/noarch
mkdir -p `rpm --eval %_rpmdir`/i386
mkdir -p `rpm --eval %_rpmdir`/x86_64
# We use tags and determine the version, as follows:
# ctdb-0.9.1 (First release of 0.9).
# ctdb-0.9.23 (23rd minor release of the 112 version)
#
# If we're not directly on a tag, this is a devel release; we append
# .0.<patchnum>.<checksum>.devel to the release.
TAG=`git describe`
case "$TAG" in
ctdb-*)
TAG=${TAG##ctdb-}
case "$TAG" in
*-*-g*) # 0.9-168-ge6cf0e8
# Not exactly on tag: devel version.
VERSION=`echo "$TAG" | sed 's/\([^-]\+\)-\([0-9]\+\)-\(g[0-9a-f]\+\)/\1.0.\2.\3.devel/'`
;;
*)
# An actual release version
VERSION=$TAG
;;
esac
;;
*)
echo Invalid tag "$TAG" >&2
exit 1
;;
esac
VERSION=$(${TOPDIR}/packaging/mkversion.sh)
if [ -z "$VERSION" ]; then
exit 1
fi
sed -e s/@VERSION@/$VERSION/g \
< ${DIRNAME}/${SPECFILE_IN} \

View File

@ -33,15 +33,9 @@ SPECFILE_IN=${SPECFILE}.in
EXTRA_SUFFIX="$1"
# if no githash was specified on the commandline,
# then use the current head
if test x"$GITHASH" = "x" ; then
GITHASH="$(git log --pretty=format:%h -1)"
fi
GITHASH_SUFFIX=".${GITHASH}"
if test "x$USE_GITHASH" = "xno" ; then
GITHASH_SUFFIX=""
VERSION=$(${TOPDIR}/packaging/mkversion.sh)
if [ -z "$VERSION" ]; then
exit 1
fi
if echo | gzip -c --rsyncable - > /dev/null 2>&1 ; then
@ -52,7 +46,7 @@ fi
pushd ${TOPDIR}
echo "Creating tarball ... "
git archive --prefix=${TAR_PREFIX_TMP}/ ${GITHASH} | ( cd /tmp ; tar xf - )
git archive --prefix=${TAR_PREFIX_TMP}/ HEAD | ( cd /tmp ; tar xf - )
RC=$?
popd
if [ $RC -ne 0 ]; then
@ -60,12 +54,10 @@ if [ $RC -ne 0 ]; then
exit 1
fi
sed -e s/GITHASH/${GITHASH_SUFFIX}/g \
sed -e s/@VERSION@/${VERSION}/g \
< ${SPECFILE_IN} \
> ${SPECFILE}
VERSION=$(grep ^Version ${SPECFILE} | sed -e 's/^Version:\ \+//')${GITHASH_SUFFIX}
if [ "x${EXTRA_SUFFIX}" != "x" ]; then
VERSION="${VERSION}-${EXTRA_SUFFIX}"
fi