[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[virt-tools-list] [PATCH 2/2] Bump version 1.0 to simplify Windows MSI versioning

The Windows MSI product version is restricted to a 3 component
version number, whose fields are a max value of 255.255.65536

Since the main virt-viewer version takes up 3 components already,
we have the munge the micro version together with the first
component of the release version. eg we have

   $VERSION[0].$VERSION[1].($VERSION[2] << 8 + $RELEASE[0])

This causes problems for RHEL which needs to have 2-component
release versions to deal with z-stream builds.  eg a RHEL
version might be virt-viewer-0.5.6-2.el6_4.3 and we've
no easy way of adding the final '.3' to the Windows product

If we reduce the primary virt-viewer version to just 2 components,
then we can leave the 3rd component for exclusive use by the RPM
release number. eg so we'd make product version up using

   $VERSION[0].$VERSION[1].($RELEASE[0] << 8 + $RELEASE[1])

In course of normal development, we'd increase the $VERSION[0]
for each release. ie next release is 1.0, then 2.0, then 3.0.
This means we retain the ability to put out "stable" branch
releases for any historical version by doing 1.1, 1.2 instead
of having to re-add a 3rd component.

Signed-off-by: Daniel P. Berrange <berrange redhat com>
 configure.ac              | 15 +++++----------
 mingw-virt-viewer.spec.in | 17 ++++++++++++++---
 2 files changed, 19 insertions(+), 13 deletions(-)

diff --git a/configure.ac b/configure.ac
index f4b97d1..b5a504d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,5 +1,5 @@
@@ -214,19 +214,14 @@ AC_ARG_WITH([buildid],
     AS_HELP_STRING([--with-buildid=id], [Set additional build version details]),
     [buildid="-$with_buildid"], [buildid=""])
 AC_DEFINE_UNQUOTED([BUILDID], "$buildid", [Build version details])
-if test "x$buildid" != x; then
-    AC_SUBST([BUILDID], "$buildid")
+if test "x$buildid" = x; then
+    buildid="0"
+AC_SUBST([BUILDID], "$buildid")
 major=`echo $PACKAGE_VERSION | cut -d. -f1`
 minor=`echo $PACKAGE_VERSION | cut -d. -f2`
-micro=`echo $PACKAGE_VERSION | cut -d. -f3`
-buildid=`echo $with_buildid | cut -d. -f1`
-if test "x$buildid" = x; then
-   buildid=0
-build=`expr $micro \* 256 + $buildid`
diff --git a/mingw-virt-viewer.spec.in b/mingw-virt-viewer.spec.in
index fb1c9fd..bf83d08 100644
--- a/mingw-virt-viewer.spec.in
+++ b/mingw-virt-viewer.spec.in
@@ -1,8 +1,20 @@
+%define relver 1%{?dist}
+# We want the 1st part of the release number, and
+# the 3rd part (or 0 if not present). We want to
+# avoid the autobuild magic %{extra_release} too
+# which is not purely numeric and larger than 255.
+# This scheme lets us cope with RHEL-style z-stream
+# versioning when creating Win product versions
+%define rel0 %(echo %{relver} | cut -d. -f1)
+%define rel1 %(test -z "`echo %{relver} | cut -d. -f3`" && echo 0 || (echo %{relver} | cut -d. -f3))
+%define buildid %(expr %{rel0} \\* 256 + %{rel1})
 Name:           mingw-virt-viewer
 Version:        @VERSION@
-Release:        1%{?dist}%{?extra_release}
+Release:        %{relver}%{?extra_release}
 Summary:        MinGW Windows virt-viewer console application
 License:        GPLv2+
@@ -83,9 +95,8 @@ MinGW Windows virt-viewer MSI
 %setup -q -n virt-viewer-%{version}
-%mingw_configure --with-gtk=2.0 --with-buildid=%{release}
+%mingw_configure --with-gtk=2.0 --with-buildid=%{buildid}
 %mingw_make %{?_smp_mflags} V=1
 %mingw_make %{?_smp_mflags} V=1 -C data msi

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]