-#!/bin/sh -e
+#!/bin/bash -e
if [ ! -d .git ]; then
echo "no .git present. run this from the base dir of the git checkout."
fi
version=$1
-[ -z "$version" ] && version=`git describe --match 'v*' | sed 's/^v//'`
-outfile="ceph-$version"
+[ -z "$version" ] && version=$(git describe --long --match 'v*' | sed 's/^v//')
+if expr index $version '-' > /dev/null; then
+ rpm_version=$(echo $version | cut -d - -f 1-1)
+ rpm_release=$(echo $version | cut -d - -f 2- | sed 's/-/./')
+else
+ rpm_version=$version
+ rpm_release=0
+fi
+outfile="ceph-$version"
echo "version $version"
# update submodules
# populate files with version strings
echo "including src/.git_version, ceph.spec"
-(git rev-parse HEAD ; git describe) 2> /dev/null > src/.git_version
-
-# if the version has '-' in it, it has a 'release' part,
-# like vX.Y.Z-N-g<shortsha1>. If it doesn't, it's just
-# vX.Y.Z. Handle both, and translate - to . for rpm
-# naming rules (the - separates version and release).
-
-if expr index $version '-' > /dev/null; then
- rpm_version=`echo $version | cut -d - -f 1-1`
- rpm_release=`echo $version | cut -d - -f 2- | sed 's/-/./'`
-else
- rpm_version=$version
- rpm_release=0
-fi
+(git rev-parse HEAD ; echo $version) 2> /dev/null > src/.git_version
for spec in ceph.spec.in alpine/APKBUILD.in; do
cat $spec |
list(GET CEPH_GIT_SHA_AND_TAG 0 CEPH_GIT_VER)
list(GET CEPH_GIT_SHA_AND_TAG 1 CEPH_GIT_NICE_VER)
endif(${CEPH_GIT_VER} STREQUAL "GITDIR-NOTFOUND")
- # remove 'v' prefix from raw git version
- string(SUBSTRING ${CEPH_GIT_NICE_VER} 1 -1 CEPH_GIT_NICE_VER)
else(${ENABLE_GIT_VERSION})
set(CEPH_GIT_VER "no_version")
set(CEPH_GIT_NICE_VER "Development")