Martin Sivák has uploaded a new change for review.

Change subject: Update the build process to determine versioning using git tags
......................................................................

Update the build process to determine versioning using git tags

The autogen.sh script uses git tags to determine the version
of the project. If the distribution tarball is used and no git
repository is available then the VERSION file is used.

This also changes the versioning schema to simple X.Y for the
master branch releases and X.Y.0.C.GITID for master nightlies.

Using dash/minus in the upstream version was bad, because when
the downstream RPM is created, it's version should be based on
the full upstream version of used tarball. But RPM does not allow
minus sign in the Version field and the Release field is supposed
to track updates to spec file and sidecar patches only..

Change-Id: Iacfec13ee13abf05c781d820e865b2d4d54398ac
Signed-off-by: Martin Sivak <msi...@redhat.com>
---
M .gitignore
M Makefile.am
A README.maintainer
M autogen.sh
M configure.ac
M ovirt-hosted-engine-ha.spec.in
6 files changed, 96 insertions(+), 18 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-hosted-engine-ha 
refs/changes/04/25404/1

diff --git a/.gitignore b/.gitignore
index bbef11d..97935f1 100644
--- a/.gitignore
+++ b/.gitignore
@@ -13,6 +13,7 @@
 /tmp.repos/
 
 # Autotools
+/VERSION
 /Makefile
 /Makefile.in
 /aclocal.m4
@@ -22,6 +23,7 @@
 /build/Makefile
 /build/Makefile.in
 /build/build-aux/
+/build/m4/version.m4
 /config.log
 /config.status
 /configure
diff --git a/Makefile.am b/Makefile.am
index 72c2aed..b79d696 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -25,6 +25,7 @@
 MAINTAINERCLEANFILES = \
        config.log \
        config.status \
+       $(srcdir)/build/m4/version.m4 \
        $(srcdir)/ABOUT-NLS \
        $(srcdir)/aclocal.m4 \
        $(srcdir)/autom4te.cache \
@@ -43,6 +44,7 @@
        $(NULL)
 
 EXTRA_DIST = \
+       VERSION \
        ovirt-hosted-engine-ha.spec.in \
        $(NULL)
 
@@ -81,6 +83,9 @@
 test:
        nosetests .
 
+VERSION:
+       @echo -n "$(PACKAGE_VERSION)" >VERSION
+
 clean-local:
        rm -fr "$(TMPREPOS)"
        rm -fr target
@@ -93,4 +98,3 @@
 fsm:
        PYTHONPATH=. python build/build-aux/gen_gv.py > doc/agent-fsm.gv
        dot doc/agent-fsm.gv -Tpng -o doc/agent-fsm.png
-
diff --git a/README.maintainer b/README.maintainer
new file mode 100644
index 0000000..1ea01b6
--- /dev/null
+++ b/README.maintainer
@@ -0,0 +1,71 @@
+This README documents the release process of ovirt-hosted-engine-ha
+from the upstream maintainer's perspective.
+
+Building steps
+==============
+
+1) configure the build
+
+./autogen.sh           (for local testing)
+ or
+./autogen.sh --system  (for system-wide deployment)
+
+This will prepare all needed files including the version
+information. If a version is changed (git tag is added),
+the script has to be called again to update the build scripts.
+
+2) build using standard make
+
+make
+
+3) create the distribution tarball and rpms
+
+make dist
+make rpm
+
+Versioning
+==========
+
+Version is automatically inferred from the most
+recent git tag with the X.Y* form.
+
+If git is not available the version will be read from
+the VERSION file. However this file is only present
+in the distribution tarballs.
+
+X is the major version, should be increased when a
+very disruptive change happens or the API or architecture
+is changed too much.
+
+Y is the minor version that should be increased any
+time a change is made.
+
+There are two version formats:
+
+- If the tag is at the last commit: X.Y.Z*
+  Examples: 1.1, 1.5.65, 0.1, 0.1.3.5
+
+- If the tag is on some previous commit: X.Y.0.<count>.<githash>
+  - count specifies the number of commits since last tag
+  - git hash is the abbreviated commit id of the HEAD
+  Example: 1.1.0.1.g9e1bafc
+
+If a branch is created and diverges from the master,
+additional number has to be added to the version and
+a tag has to be created on that branch for the above
+automatic to work properly:
+
+X.Y will becomes X.Y.0
+X.Y.Z becomes X.Y.Z.0
+
+The meaning of this is that the beginning represents
+the version the branch was based on and the last digit
+represents the updates to this specific branch.
+
+Changelog
+=========
+
+Before you tag a commit in git, make sure the changelog
+entry for the proper version is updated in
+ovirt-hosted-engine-ha.spec.in
+
diff --git a/autogen.sh b/autogen.sh
index 91f9427..d215c6f 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -23,6 +23,14 @@
 # - automake
 # - gettext-devel
 
+if git status; then
+    GITVER=$(git describe  --match='[[:digit:]].[[:digit:]]*' --tags | tr -d 
'\n' | sed 's/-/.0./' | tr - .)
+    echo "define([VERSION_NUMBER], [$GITVER])" >build/m4/version.m4
+else
+    GITVER=$(cat VERSION | tr -d '\n')
+    echo "define([VERSION_NUMBER], [$GITVER])" >build/m4/version.m4
+fi
+
 autoreconf -ivf
 
 if test "x$1" = "x--system"; then
diff --git a/configure.ac b/configure.ac
index 54b3575..2ac28e0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -18,18 +18,10 @@
 dnl
 AC_PREREQ(2.60)
 
-define([VERSION_MAJOR], [1])
-define([VERSION_MINOR], [1])
-define([VERSION_FIX], [0])
-define([VERSION_NUMBER], VERSION_MAJOR[.]VERSION_MINOR[.]VERSION_FIX)
-define([VERSION_RELEASE], [0.0])
-define([VERSION_SUFFIX], [master.][m4_esyscmd([date -u +%Y%m%d%H%M%S | tr -d 
'\n'])])
+m4_include([build/m4/version.m4])
 
-AC_INIT([ovirt-hosted-engine-ha], 
VERSION_NUMBER[-]VERSION_RELEASE[.]VERSION_SUFFIX)
-PACKAGE_RPM_VERSION="VERSION_NUMBER"
-PACKAGE_RPM_RELEASE="VERSION_RELEASE.VERSION_SUFFIX"
-AC_SUBST([PACKAGE_RPM_VERSION])
-AC_SUBST([PACKAGE_RPM_RELEASE])
+AC_INIT([ovirt-hosted-engine-ha], VERSION_NUMBER)
+AC_SUBST([VERSION_NUMBER])
 
 AC_CONFIG_AUX_DIR([build/build-aux])
 AC_CONFIG_MACRO_DIR([build/m4])
diff --git a/ovirt-hosted-engine-ha.spec.in b/ovirt-hosted-engine-ha.spec.in
index 0b129b4..65201e2 100644
--- a/ovirt-hosted-engine-ha.spec.in
+++ b/ovirt-hosted-engine-ha.spec.in
@@ -17,8 +17,6 @@
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 #
 
-%global         package_version @PACKAGE_VERSION@
-%global         package_name @PACKAGE_NAME@
 %global         engine_ha_bindir  @ENGINE_HA_BINDIR@
 %global         engine_ha_confdir @ENGINE_HA_CONFDIR@
 %global         engine_ha_libdir  %{python_sitelib}/ovirt_hosted_engine_ha
@@ -35,11 +33,14 @@
 
 Summary:        oVirt Hosted Engine High Availability Manager
 Name:           @PACKAGE_NAME@
-Version:        @PACKAGE_RPM_VERSION@
-Release:        @PACKAGE_RPM_RELEASE@%{?release_suffix}%{?dist}
+Version:        @PACKAGE_VERSION@
+
+# Upstream release must bump the version. Release tag is used
+# by downstream package maintainers only!
+Release:        1%{?dist}
 License:        LGPLv2+
 URL:            http://www.ovirt.org
-Source:         
http://resources.ovirt.org/releases/nightly/src/%{name}-%{package_version}.tar.gz
+Source:         
http://resources.ovirt.org/releases/nightly/src/%{name}-%{version}.tar.gz
 Group:          Applications/System
 
 BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
@@ -68,7 +69,7 @@
 
 
 %prep
-%setup -q -n %{name}-%{package_version}
+%setup -q -n %{name}-%{version}
 
 
 %build


-- 
To view, visit http://gerrit.ovirt.org/25404
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iacfec13ee13abf05c781d820e865b2d4d54398ac
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-hosted-engine-ha
Gerrit-Branch: master
Gerrit-Owner: Martin Sivák <msi...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to