summaryrefslogtreecommitdiffstats
path: root/build-aux
diff options
context:
space:
mode:
authorAmar Tumballi <amarts@redhat.com>2019-04-13 11:19:20 +0530
committerAmar Tumballi <amarts@redhat.com>2019-04-25 04:16:27 +0000
commit8d51cb05d9745643f2dfaa6ef35938db9d2d47f6 (patch)
tree13be8b241ddf321e75a0595f102c8190518ebdb4 /build-aux
parent3db4f4ed6dec55316e7167eaddd9ddf0af875185 (diff)
build-aux/pkg-version: provide option for depth=1
Change-Id: I385063b757ae71db70f22a2f7c94e6abeedff426 updates: bz#1701337 Signed-off-by: Amar Tumballi <amarts@redhat.com>
Diffstat (limited to 'build-aux')
-rwxr-xr-xbuild-aux/pkg-version18
1 files changed, 15 insertions, 3 deletions
diff --git a/build-aux/pkg-version b/build-aux/pkg-version
index 83d4a5f..7c57c63 100755
--- a/build-aux/pkg-version
+++ b/build-aux/pkg-version
@@ -3,7 +3,11 @@
# To override version/release from git,
# create VERSION file containing text with version/release
# eg. v3.4.0-1
-PKG_VERSION=`cat VERSION 2> /dev/null || git describe --tags --match "v[0-9]*"`
+
+# One thing to note, If one does 'git clone --depth N glusterfs.git',
+# the git describe command doesn't work. Hence you notice below that
+# we have added timestamp as version (YYYY.MM.DD) and release (HH.mmss)
+PKG_VERSION=`cat VERSION 2> /dev/null || git describe --tags --match "v[0-9]*" 2>/dev/null`
get_version()
{
@@ -18,7 +22,11 @@ get_version()
sub(/^v/,"") ; print $1
}'
- echo $PKG_VERSION | awk "$AWK_VERSION" | tr -cd '[:alnum:].'
+ version=$(echo $PKG_VERSION | awk "$AWK_VERSION" | tr -cd '[:alnum:].')
+ if [ "x${version}" == "x" ] ; then
+ version=$(date +%Y.%m.%d | tr -d '\n')
+ fi
+ echo $version | tr -d '\n'
}
get_release()
@@ -37,7 +45,11 @@ get_release()
else if (NF == 4) print $2, $3, "git" substr($4, 2)
}'
- echo $PKG_VERSION | awk "$AWK_RELEASE" | tr -cd '[:alnum:].'
+ release=$(echo $PKG_VERSION | awk "$AWK_RELEASE" | tr -cd '[:alnum:].')
+ if [ "x${release}" == "x" ] ; then
+ release=$(date +%H.%M%S | tr -d '\n')
+ fi
+ echo $release | tr -d '\n'
}
if test "x$1" = "x--full"; then