Federico Simoncelli has uploaded a new change for review.
Change subject: Ship the version file with the tarballs
......................................................................
Ship the version file with the tarballs
Shipping the VERSION file allows running the autoreconf tool also from a
tarball package (no need of the entire git repository).
In this patch:
* generate and ship the VERSION file
* move, unify (and ship) version.sh and release.sh in pkg-version
* use the VERSION file when the git repository is not available
(eg: tarball)
Signed-off-by: Federico Simoncelli <fsimonce(a)redhat.com>
Change-Id: I8b72a1740803a9401e4b5a4504a4faa07c29f2b9
---
M Makefile.am
A build-aux/pkg-version
D build-aux/release.sh
D build-aux/version.sh
M configure.ac
5 files changed, 46 insertions(+), 34 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/95/7295/1
diff --git a/Makefile.am b/Makefile.am
index 5f17f63..c898105 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -25,6 +25,7 @@
# 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
@@ -122,11 +123,11 @@
rpmbuild -ta $(if $(BUILDID),--define="extra_release .$(BUILDID)") \
$(WITH_HOOKS) $(DIST_ARCHIVES)
-dist-hook: gen-ChangeLog
+dist-hook: gen-VERSION gen-ChangeLog
+.PHONY: gen-VERSION gen-ChangeLog
# Generate the ChangeLog file and insert it into the directory
# we're about to use to create a tarball.
-.PHONY: gen-ChangeLog
gen-ChangeLog:
if test -d .git; then \
$(top_srcdir)/build-aux/gitlog-to-changelog \
@@ -134,3 +135,10 @@
rm -f $(distdir)/ChangeLog; \
mv $(distdir)/cl-t $(distdir)/ChangeLog; \
fi
+
+gen-VERSION:
+ if test -d .git; then \
+ git describe > $(distdir)/ve-t; \
+ rm -f $(distdir)/VERSION; \
+ mv $(distdir)/ve-t $(distdir)/VERSION; \
+ fi
diff --git a/build-aux/pkg-version b/build-aux/pkg-version
new file mode 100755
index 0000000..64c814c
--- /dev/null
+++ b/build-aux/pkg-version
@@ -0,0 +1,34 @@
+#!/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
+ }'
+
+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)
+ }'
+
+
+if test "x$1" == "x--version"; then
+ AWK_COMMAND="$AWK_VERSION"
+elif test "x$1" == "x--release"; then
+ AWK_COMMAND="$AWK_RELEASE"
+else
+ echo "usage: $0 [--version|--release]"
+ exit 1
+fi
+
+(cat VERSION 2> /dev/null || git describe) \
+ | awk "$AWK_COMMAND" | tr -cd '[:alnum:].'
diff --git a/build-aux/release.sh b/build-aux/release.sh
deleted file mode 100755
index 2c8a6b1..0000000
--- a/build-aux/release.sh
+++ /dev/null
@@ -1,16 +0,0 @@
-#!/bin/sh
-# 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)
- }'
-git describe --match="v[0-9]*" 2> /dev/null \
- | awk "$AWK_RELEASE" | tr -cd '[:alnum:].'
diff --git a/build-aux/version.sh b/build-aux/version.sh
deleted file mode 100755
index 556fe55..0000000
--- a/build-aux/version.sh
+++ /dev/null
@@ -1,14 +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
- }'
-
-git describe --match "v[0-9]*" 2> /dev/null \
- | awk "$AWK_VERSION" | tr -cd '[0-9].'
diff --git a/configure.ac b/configure.ac
index a963d18..d4b6815 100644
--- a/configure.ac
+++ b/configure.ac
@@ -20,7 +20,7 @@
# Autoconf initialization
AC_INIT([vdsm],
- [m4_esyscmd([build-aux/version.sh])],
+ [m4_esyscmd([build-aux/pkg-version --version])],
[vdsm-devel(a)lists.fedorahosted.org])
AC_CONFIG_AUX_DIR([build-aux])
@@ -28,7 +28,7 @@
# Package release
AC_SUBST([PACKAGE_RELEASE],
- [m4_esyscmd([build-aux/release.sh])])
+ [m4_esyscmd([build-aux/pkg-version --release])])
# Testing for version and release
AS_IF([test "x$PACKAGE_VERSION" = x],
--
To view, visit
http://gerrit.ovirt.org/7295
To unsubscribe, visit
http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I8b72a1740803a9401e4b5a4504a4faa07c29f2b9
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Federico Simoncelli <fsimonce(a)redhat.com>