Alon Bar-Lev has uploaded a new change for review. Change subject: build: closer to open source versioning and release cycle ......................................................................
build: closer to open source versioning and release cycle Upstream project version is constructed from three components: major, minor and fix. Major version is incremented when there is a significant change in project. Minor version is incremented when features are being added. Fix version is incremented when a stable fix is published. A project release is made at fix release 0, for example: 4.11.0 Pre-releases are marked as version suffix, for example the following is a valid release cycle: - 4.11.0_alpha - 4.11.0_beta - 4.11.0_beta2 - 4.11.0_rc - 4.11.0_rc2 - 4.11.0 Please remember, upstream releases sources, only sources. Downstream is allowed to add its own revision, for example rpm based distribution use the following format: @UPSTREAM_VERSION@-@DOWNSTREAM_VERSION@ Downstream versioning scheme should not effect upstream, as the flow has its nature. However, upstream may provide a reference for downstream packager. Due to limitation of rpm technology, the pre-release milestone component cannot be used as part of upstream version component, so a sequence should be added, for example, the following is a valid downstream release cycle: - 4.11.0-0.0.alpha - 4.11.0-0.1.beta - 4.11.0-0.2.rc - 4.11.0-1 Branch should contain the 'next' version with milestone of 'master'. Hence over time the master will go over the following transitions: - 4.11.0-0.0.master - 4.11.0-0.1.alpha - 4.11.0-0.2.master - 4.11.0-0.3.beta - 4.11.0-0.4.master - 4.11.0-0.5.rc - 4.11.0-0.6.master - 4.11.0-1 - 4.12.0-0.0.master This change enables this approach by adding the following variables to the configure.ac: - PRODUCT_VERSION - minor.major.fix - PRODUCT_VERSION_SUFFIX - optional suffix, such as _alpha - PACKAGE_RPM_RELEASE - rpm release Unlike current versioning implementation we disconnect the versioning from the git branch information, as the git branch information is aware of /past/ versions, while a branch is work toward the /next/ version. A valid sequence for release cycle: PRODUCT_VERSION=4.11.0 PRODUCT_VERSION_SUFFIX=_master PACKAGE_RPM_RELEASE=0.0.$(echo PRODUCT_VERSION_SUFFIX | sed 's/^_//') PRODUCT_VERSION=4.11.0 PRODUCT_VERSION_SUFFIX=_beta PACKAGE_RPM_RELEASE=0.1.$(echo PRODUCT_VERSION_SUFFIX | sed 's/^_//') PRODUCT_VERSION=4.11.0 PRODUCT_VERSION_SUFFIX=_master PACKAGE_RPM_RELEASE=0.2.$(echo PRODUCT_VERSION_SUFFIX | sed 's/^_//') PRODUCT_VERSION=4.11.0 PRODUCT_VERSION_SUFFIX=_rc PACKAGE_RPM_RELEASE=0.3.$(echo PRODUCT_VERSION_SUFFIX | sed 's/^_//') PRODUCT_VERSION=4.11.0 PRODUCT_VERSION_SUFFIX=_master PACKAGE_RPM_RELEASE=0.4.$(echo PRODUCT_VERSION_SUFFIX | sed 's/^_//') PRODUCT_VERSION=4.11.0 PRODUCT_VERSION_SUFFIX= PACKAGE_RPM_RELEASE=1 PRODUCT_VERSION=4.12.0 PRODUCT_VERSION_SUFFIX=_master PACKAGE_RPM_RELEASE=0.0.$(echo PRODUCT_VERSION_SUFFIX | sed 's/^_//') Build automation may inject release suffix to the binary package name, an example exist in the 'make rpm' target. Change-Id: I1a73089d47804ca31e3a4d80aaf811fa011ba1f3 Signed-off-by: Alon Bar-Lev <[email protected]> --- M Makefile.am D build-aux/pkg-version M configure.ac M vdsm.spec.in 4 files changed, 41 insertions(+), 64 deletions(-) git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/48/12448/1 diff --git a/Makefile.am b/Makefile.am index 75f360f..304128a 100644 --- a/Makefile.am +++ b/Makefile.am @@ -34,7 +34,6 @@ # This is an *exception*, we ship also vdsm.spec so it's possible to build the # rpm from the tarball. EXTRA_DIST = \ - build-aux/pkg-version \ vdsm.spec \ vdsm.spec.in @@ -79,14 +78,32 @@ all-local: \ vdsm.spec +vdsm.spec: configure.ac + .PHONY: srpm rpm srpm: dist - rpmbuild -ts $(if $(BUILDID),--define="extra_release .$(BUILDID)") $(DIST_ARCHIVES) + SUFFIX=".`date -u +%Y%m%d%H%M%S`"; \ + if [ -d "$(top_srcdir)/.git" ]; then \ + SUFFIX="$$SUFFIX.git`GIT_DIR="$(top_srcdir)/.git" $(GIT) rev-parse --short=16 HEAD`"; \ + fi; \ + rpmbuild \ + -ts \ + --define="release_suffix $$SUFFIX" \ + $(if $(BUILDID),--define="extra_release .$(BUILDID)") \ + $(DIST_ARCHIVES) rpm: dist - rpmbuild -ta $(if $(BUILDID),--define="extra_release .$(BUILDID)") \ - $(WITH_HOOKS) $(DIST_ARCHIVES) + SUFFIX=".`date -u +%Y%m%d%H%M%S`"; \ + if [ -d "$(top_srcdir)/.git" ]; then \ + SUFFIX="$$SUFFIX.git`GIT_DIR="$(top_srcdir)/.git" $(GIT) rev-parse --short=16 HEAD`"; \ + fi; \ + rpmbuild \ + -ta \ + --define="release_suffix $$SUFFIX" \ + $(if $(BUILDID),--define="extra_release .$(BUILDID)") \ + $(WITH_HOOKS) \ + $(DIST_ARCHIVES) dist-hook: gen-VERSION gen-ChangeLog .PHONY: gen-VERSION gen-ChangeLog @@ -102,9 +119,10 @@ fi gen-VERSION: - if test -d .git; then \ - $(top_srcdir)/build-aux/pkg-version --full \ - > $(distdir)/ve-t; \ - rm -f $(distdir)/VERSION; \ - mv $(distdir)/ve-t $(distdir)/VERSION; \ + if test -d "$(top_srcdir)/.git"; then \ + BRANCH=`GIT_DIR="$(top_srcdir)/.git" $(GIT) rev-parse --symbolic-full-name HEAD`; \ + BRANCH=`basename $$BRANCH`; \ + REVISION=`GIT_DIR="$(top_srcdir)/.git" $(GIT) rev-parse --short=16 HEAD`; \ + echo -n $(PACKAGE_NAME)-$(PACKAGE_VERSION).$$BRANCH.$$REVISION > $(distdir)/VERSION.tmp; \ + mv $(distdir)/VERSION.tmp $(distdir)/VERSION; \ fi diff --git a/build-aux/pkg-version b/build-aux/pkg-version deleted file mode 100755 index 346ad23..0000000 --- a/build-aux/pkg-version +++ /dev/null @@ -1,39 +0,0 @@ -#!/bin/sh - -# tags and output versions: -# - v4.9.0 => 4.9.0 (upstream clean) -# - v4.9.0-1 => 4.9.0 (downstream clean) -# - v4.9.0-2-g34e62f => 4.9.0 (upstream dirty) -# - v4.9.0-1-2-g34e62f => 4.9.0 (downstream dirty) -AWK_VERSION=' - BEGIN { FS="-" } - /^v[0-9]/ { - sub(/^v/,"") ; print $1 - }' - -# tags and output releases: -# - v4.9.0 => 0 (upstream clean) -# - v4.9.0-1 => 1 (downstream clean) -# - v4.9.0-2-g34e62f1 => 0.2.git34e62f1 (upstream dirty) -# - v4.9.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 0, $2, "git" substr($3, 2) - else if (NF == 4) print $2, $3, "git" substr($4, 2) - }' - -PKG_VERSION=`cat VERSION 2> /dev/null || git describe --match "v[0-9]*"` - -if test "x$1" = "x--full"; then - echo $PKG_VERSION | tr -d '[:space:]' -elif test "x$1" = "x--version"; then - echo $PKG_VERSION | awk "$AWK_VERSION" | tr -cd '[:alnum:].' -elif test "x$1" = "x--release"; then - echo $PKG_VERSION | awk "$AWK_RELEASE" | tr -cd '[:alnum:].' -else - echo "usage: $0 [--full|--version|--release]" - exit 1 -fi diff --git a/configure.ac b/configure.ac index 434d209..6197a76 100644 --- a/configure.ac +++ b/configure.ac @@ -19,22 +19,18 @@ # # Autoconf initialization -AC_INIT([vdsm], - [m4_esyscmd([build-aux/pkg-version --version])], - [[email protected]]) +define([PRODUCT_VERSION], [4.11.0]) +define([PRODUCT_VERSION_SUFFIX], [_master]) +AC_INIT([vdsm], PRODUCT_VERSION[]PRODUCT_VERSION_SUFFIX, [[email protected]]) AC_CONFIG_AUX_DIR([build-aux]) m4_include([m4/ax_python_module.m4]) -# Package release -AC_SUBST([PACKAGE_RELEASE], - [m4_esyscmd([build-aux/pkg-version --release])]) - -# Testing for version and release -AS_IF([test "x$PACKAGE_VERSION" = x], - AC_MSG_ERROR([package version not defined])) -AS_IF([test "x$PACKAGE_RELEASE" = x], - AC_MSG_ERROR([package release not defined])) +# RPM version +PACKAGE_RPM_VERSION="PRODUCT_VERSION" +PACKAGE_RPM_RELEASE="0.0.$(echo PRODUCT_VERSION_SUFFIX | sed 's/^_//')" +AC_SUBST([PACKAGE_RPM_VERSION]) +AC_SUBST([PACKAGE_RPM_RELEASE]) # Automake initialization AM_INIT_AUTOMAKE([-Wno-portability]) @@ -99,6 +95,8 @@ AC_SUBST([SMBIOS_MANUFACTURER], ['oVirt']) AC_SUBST([SMBIOS_OSNAME], ['oVirt Node']) +AC_PATH_PROG([GIT], [git]) + # Checking for pyflakes AC_PATH_PROG([PYFLAKES], [pyflakes]) if test "x$PYFLAKES" = "x"; then diff --git a/vdsm.spec.in b/vdsm.spec.in index 38838ea..8278014 100644 --- a/vdsm.spec.in +++ b/vdsm.spec.in @@ -23,14 +23,14 @@ %{!?enable_autotools:%define enable_autotools 0} Name: %{vdsm_name} -Version: @PACKAGE_VERSION@ -Release: @PACKAGE_RELEASE@%{?dist}%{?extra_release} +Version: @PACKAGE_RPM_VERSION@ +Release: @PACKAGE_RPM_RELEASE@%{?release_suffix}%{?dist}%{?extra_release} Summary: Virtual Desktop Server Manager Group: Applications/System License: GPLv2+ Url: http://www.ovirt.org/wiki/Vdsm -Source0: %{vdsm_name}-%{version}.tar.gz +Source0: @PACKAGE_NAME@-@[email protected] BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRequires: python @@ -427,7 +427,7 @@ Gluster plugin enables VDSM to serve Gluster functionalities. %prep -%setup -q +%setup -q -n @PACKAGE_NAME@-@PACKAGE_VERSION@ %if 0%{?rhel} == 6 sed -i '/ su /d' vdsm/vdsm-logrotate.conf.in %endif -- To view, visit http://gerrit.ovirt.org/12448 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I1a73089d47804ca31e3a4d80aaf811fa011ba1f3 Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Alon Bar-Lev <[email protected]> _______________________________________________ vdsm-patches mailing list [email protected] https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
