[NEW PATCH] Introduce new version system for VDSM (via gerrit-bot)

Federico Simoncelli fsimonce at redhat.com
Wed Aug 3 12:28:23 UTC 2011


New patch submitted by Federico Simoncelli (fsimonce at redhat.com)

You can review this change at: http://gerrit.usersys.redhat.com/752

commit 1a73a1bf2db8c9f841016f0c4141c29cf16ae316
Author: Federico Simoncelli <fsimonce at redhat.com>
Date:   Wed Jul 20 09:46:27 2011 +0000

    Introduce new version system for VDSM
    
    Change-Id: I9b9efb781a59bc1179bdb1b10b9ec17b7d08fbc1

diff --git a/build-aux/release.sh b/build-aux/release.sh
index 40d76bc..6ba1512 100755
--- a/build-aux/release.sh
+++ b/build-aux/release.sh
@@ -1,4 +1,16 @@
 #!/bin/sh
-GIT_RELEASE=`git describe | awk -F- '{print $3 "." $5}' | tr -d '\n'`
-GIT_BRANCH=`git branch | awk '/^*/{print $2}' | sed 's/[^a-zA-Z0-9_.]//g'`
-echo -n $GIT_RELEASE.$GIT_BRANCH
+# tags and output releases:
+#   - v4.9.0   => 0 (upstream clean)
+#   - v4.9.0-1 => 1 (downstream clean)
+#   - v4.9.0-2-g34e62f   => 0.2.g34e62f (upstream dirty)
+#   - v4.9.0-1-2-g34e62f => 1.2.g34e62f (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, $3
+      else if (NF == 4) print $2, $3, $4
+    }'
+git describe 2> /dev/null \
+    | awk "$AWK_RELEASE" | tr -cd '[:alnum:].'
diff --git a/build-aux/version.sh b/build-aux/version.sh
new file mode 100755
index 0000000..0f529e1
--- /dev/null
+++ b/build-aux/version.sh
@@ -0,0 +1,13 @@
+#!/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
+    }'
+git describe 2> /dev/null \
+    | awk "$AWK_VERSION" | tr -cd '[0-9].'
diff --git a/configure.ac b/configure.ac
index 0533cd0..bb4c3e4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,8 +1,19 @@
 # Autoconf initialization
-AC_INIT([vdsm], [4.9], [vdsm-devel at lists.fedorahosted.org])
-AC_SUBST([PACKAGE_RELEASE], m4_esyscmd([./build-aux/release.sh]))
+AC_INIT([vdsm],
+        [m4_esyscmd([build-aux/version.sh])],
+        [vdsm-devel at lists.fedorahosted.org])
 AC_CONFIG_AUX_DIR([build-aux])
 
+# Package release
+AC_SUBST([PACKAGE_RELEASE],
+         [m4_esyscmd([build-aux/release.sh])])
+
+# 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]))
+
 # Automake initialization
 AM_INIT_AUTOMAKE([-Wno-portability])
 
diff --git a/vdsm.spec.in b/vdsm.spec.in
index b4a4e8c..79a5c97 100644
--- a/vdsm.spec.in
+++ b/vdsm.spec.in
@@ -1,7 +1,6 @@
 %define vdsm_reg vdsm-reg
 %define vdsm_name vdsm
 %define vdsm_bootstrap vdsm-bootstrap
-%define vdsm_release @PACKAGE_RELEASE@
 %include %{_rpmconfigdir}/macros.python
 
 Summary: Virtual Desktop Server Manager
@@ -11,7 +10,7 @@ Source: %{vdsm_name}-%{version}.tar.gz
 # tarball built from internal git repo with
 #       make tarball rpmversion=<version> rpmrelease=<release>
 Version: @PACKAGE_VERSION@
-Release: %{vdsm_release}%{?dist}
+Release: @PACKAGE_RELEASE@%{?dist}
 License: GPLv2+
 Group: Applications/System
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}




More information about the vdsm-patches mailing list