diff options
-rw-r--r-- | Makefile.am | 12 | ||||
-rwxr-xr-x | build-aux/pkg-version | 52 | ||||
-rw-r--r-- | configure.ac | 7 | ||||
-rw-r--r-- | glusterfs.spec.in | 5 |
4 files changed, 73 insertions, 3 deletions
diff --git a/Makefile.am b/Makefile.am index fa0f52ea144..030a30cdd0b 100644 --- a/Makefile.am +++ b/Makefile.am @@ -4,6 +4,7 @@ EXTRA_DIST = autogen.sh \ glusterfs.spec glusterfs-api.pc.in libgfchangelog.pc.in \ error-codes.json gf-error-codes.h.template \ gen-headers.py run-tests.sh \ + build-aux/pkg-version \ $(shell find $(top_srcdir)/tests -type f -print) SUBDIRS = contrib/argp-standalone libglusterfs rpc api xlators glusterfsd \ @@ -28,5 +29,14 @@ gitclean: distclean rm -f $(CONTRIBDIR)/argp-standalone/install-sh rm -f $(CONTRIBDIR)/argp-standalone/missing -dist-hook: +dist-hook: gen-VERSION gen-ChangeLog +.PHONY: gen-VERSION gen-ChangeLog + +gen-ChangeLog: (cd $(srcdir) && git diff && echo ===== git log ==== && git log) > $(distdir)/ChangeLog + +gen-VERSION: + if test -d .git; then \ + $(top_srcdir)/build-aux/pkg-version --full \ + > $(distdir)/VERSION; \ + fi diff --git a/build-aux/pkg-version b/build-aux/pkg-version new file mode 100755 index 00000000000..2be2a975621 --- /dev/null +++ b/build-aux/pkg-version @@ -0,0 +1,52 @@ +#!/bin/sh + +# 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]*"` + +function get_version () +{ + # tags and output versions: + # - v3.4.0 => 3.4.0 (upstream clean) + # - v3.4.0-1 => 3.4.0 (downstream clean) + # - v3.4.0-2-g34e62f => 3.4.0 (upstream dirty) + # - v3.4.0-1-2-g34e62f => 3.4.0 (downstream dirty) + AWK_VERSION=' + BEGIN { FS="-" } + /^v[0-9]/ { + sub(/^v/,"") ; print $1 + }' + + echo $PKG_VERSION | awk "$AWK_VERSION" | tr -cd '[:alnum:].' +} + +function get_release () +{ + # tags and output releases: + # - v3.4.0 => 0 (upstream clean) + # - v3.4.0-1 => 1 (downstream clean) + # - v3.4.0-2-g34e62f1 => 2.git34e62f1 (upstream dirty) + # - v3.4.0-1-2-g34e62f1 => 1.2.git34e62f1 (downstream dirty) + AWK_RELEASE=' + BEGIN { FS="-"; OFS="." } + /^v[0-9]/ { + if (NF == 1) print 0 + else if (NF == 2) print $2 + else if (NF == 3) print $2, "git" substr($3, 2) + else if (NF == 4) print $2, $3, "git" substr($4, 2) + }' + + echo $PKG_VERSION | awk "$AWK_RELEASE" | tr -cd '[:alnum:].' +} + +if test "x$1" = "x--full"; then + echo -n "v$(get_version)-$(get_release)" +elif test "x$1" = "x--version"; then + get_version +elif test "x$1" = "x--release"; then + get_release +else + echo "usage: $0 [--full|--version|--release]" + exit 1 +fi diff --git a/configure.ac b/configure.ac index f1bb2a184ed..d146b38c661 100644 --- a/configure.ac +++ b/configure.ac @@ -6,7 +6,12 @@ dnl General Public License, version 3 or any later version (LGPLv3 or dnl later), or the GNU General Public License, version 2 (GPLv2), in all dnl cases as published by the Free Software Foundation. -AC_INIT([glusterfs],[3git],[gluster-users@gluster.org],,[https://github.com/gluster/glusterfs.git]) +AC_INIT([glusterfs], + [m4_esyscmd([build-aux/pkg-version --version])], + [gluster-users@gluster.org],,[https://github.com/gluster/glusterfs.git]) + +AC_SUBST([PACKAGE_RELEASE], + [m4_esyscmd([build-aux/pkg-version --release])]) AM_INIT_AUTOMAKE diff --git a/glusterfs.spec.in b/glusterfs.spec.in index 5e0c7c0dc52..24581240589 100644 --- a/glusterfs.spec.in +++ b/glusterfs.spec.in @@ -83,7 +83,7 @@ Vendor: Fedora Project %else Name: @PACKAGE_NAME@ Version: @PACKAGE_VERSION@ -Release: 1%{?dist} +Release: 0.@PACKAGE_RELEASE@%{?dist} Vendor: glusterfs.org %endif License: GPLv2 or LGPLv3+ @@ -950,6 +950,9 @@ if [ $1 -ge 1 ]; then fi %changelog +* Wed Apr 02 2014 Arumugam Balamurugan <barumuga@redhat.com> +- add version/release dynamically (#1074919) + * Wed Mar 26 2014 Poornima G <pgurusid@redhat.com> - Include the hook scripts of add-brick, volume start, stop and set |