This patch removes hard coded version numbers from multiple places and
moves it into a single file: .version
Signed-off-by: Russell Bryant <rbryant(a)redhat.com>
---
CMakeLists.txt | 8 ++++----
GNUmakefile | 4 +++-
autobuild.sh | 2 +-
matahari.spec.in | 2 +-
mingw32-matahari.spec.in | 2 +-
mkrelease.sh | 19 ++++---------------
6 files changed, 14 insertions(+), 23 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d2efc7b..2127259 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -3,10 +3,10 @@ cmake_minimum_required(VERSION 2.6)
project (MATAHARI)
set(CMAKE_VERBOSE_MAKEFILE OFF)
-set(CPACK_PACKAGE_VERSION_MAJOR "0")
-set(CPACK_PACKAGE_VERSION_MINOR "4")
-set(CPACK_PACKAGE_VERSION_PATCH "4")
-set(PROJECT_VERSION
"${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
+file(STRINGS ".version" PROJECT_VERSION)
+string(REGEX REPLACE "^([^.]+)[.]([^.]+)[.]([^.]+)$" "\\1"
CPACK_PACKAGE_VERSION_MAJOR "${PROJECT_VERSION}")
+string(REGEX REPLACE "^([^.]+)[.]([^.]+)[.]([^.]+)$" "\\2"
CPACK_PACKAGE_VERSION_MINOR "${PROJECT_VERSION}")
+string(REGEX REPLACE "^([^.]+)[.]([^.]+)[.]([^.]+)$" "\\3"
CPACK_PACKAGE_VERSION_PATCH "${PROJECT_VERSION}")
MACRO (inherit_value theSymbol theValue)
if (NOT DEFINED ${theSymbol})
diff --git a/GNUmakefile b/GNUmakefile
index a7831b4..244b17d 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -19,7 +19,7 @@
-include Makefile
PACKAGE ?= matahari
-VERSION ?= 0.4.4
+VERSION ?= $(shell cat .version)
TARPREFIX = $(PACKAGE)-$(PACKAGE)-$(TAG)
TARFILE = $(TARPREFIX).tgz
HTML_ROOT = coverity@www.clusterlabs.org:/var/www/html
@@ -92,6 +92,7 @@ srpm: export $(VARIANT)$(PACKAGE).spec
sed -i.sed 's/global\ specversion.*/global\ specversion\ 1/'
$(VARIANT)$(PACKAGE).spec; \
fi
sed -i.sed 's/global\ upstream_version.*/global\ upstream_version\ $(TAG)/'
$(VARIANT)$(PACKAGE).spec
+ sed -i.sed 's/#MATAHARI_VERSION#/$(VERSION)/' $(VARIANT)$(PACKAGE).spec
rpmbuild -bs $(RPM_OPTS) $(VARIANT)$(PACKAGE).spec
# eg. WITH="--with cman" make rpm
@@ -101,6 +102,7 @@ rpm: srpm
overlay: export
sed -i.sed 's/global\ upstream_version.*/global\ upstream_version\ $(TAG)/'
$(VARIANT)$(PACKAGE).spec
+ sed -i.sed 's/#MATAHARI_VERSION#/$(VERSION)/' $(VARIANT)$(PACKAGE).spec
cp $(TARFILE) ~/rpmbuild/SOURCES
cp $(VARIANT)$(PACKAGE).spec ~/rpmbuild/SPECS
make -C ~/rpmbuild/SOURCES $(VARIANT)$(PACKAGE)
diff --git a/autobuild.sh b/autobuild.sh
index 8bcb1b1..e4de307 100755
--- a/autobuild.sh
+++ b/autobuild.sh
@@ -18,7 +18,7 @@
#
set -x
PACKAGE=matahari
-VERSION=0.4.4
+VERSION=`cat .version`
: ${AUTO_BUILD_COUNTER:="custom"}
: ${AUTOBUILD_SOURCE_ROOT:=`pwd`}
diff --git a/matahari.spec.in b/matahari.spec.in
index 869d624..83b18de 100644
--- a/matahari.spec.in
+++ b/matahari.spec.in
@@ -15,7 +15,7 @@
%endif
Name: matahari
-Version: 0.4.4
+Version: #MATAHARI_VERSION#
Release: %{mh_release}%{?dist}
Summary: Matahari QMF Agents for Linux guests
diff --git a/mingw32-matahari.spec.in b/mingw32-matahari.spec.in
index e508a0e..10b0d81 100644
--- a/mingw32-matahari.spec.in
+++ b/mingw32-matahari.spec.in
@@ -11,7 +11,7 @@
%global mh_release %{?alphatag:0.}%{specversion}%{?alphatag:.%{alphatag}}%{?dist}
Name: mingw32-matahari
-Version: 0.4.4
+Version: #MATAHARI_VERSION#
Release: %{mh_release}
Summary: Matahari QMF Agents for Windows guests
diff --git a/mkrelease.sh b/mkrelease.sh
index 5607c2e..b452d7f 100755
--- a/mkrelease.sh
+++ b/mkrelease.sh
@@ -11,21 +11,10 @@ fi
BRANCH=$1
TAG=$2
-cat << EOF
-
-For now, the version string is hard coded in a number of places.
-Be sure to change them all.
- - GNUmakefile
- - autobuild.sh
- - matahari.spec.in
- - mingw32-matahari.spec.in
- - CMakeLists.txt
-If you have already done this, hit enter to continue. If you haven't,
-hit control-c and go do it.
-
-EOF
-read
-
+git checkout v0.4
+echo "${TAG:1}" > .version
+git add .version
+git commit -s -m "build: update .version to ${TAG:1}"
git tag -a -m "Tagged release $TAG" $TAG $BRANCH
git archive --prefix=matahari-${TAG:1}/ $TAG | tar x
tar czvf matahari-${TAG:1}.tar.gz matahari-${TAG:1}/
--
1.7.6
Show replies by date