[collectd] [PATCH] configure.in: Generate version dynamically using version-gen.sh.

Sebastian Harl sh at tokkee.org
Thu Jul 26 18:13:18 CEST 2007

This dynamically creates the version string when the configure script is
created. If run from within a repository the output of "git describe" is
used to create the version string. Else it defaults to a hardcoded value
which should be something like "$latest_version.git".

The idea is to update the default version to the new version (without
".git" appended) as the last commit of a release cycle. This commit is
tagged as the new version. The next commit after the release will set the
default version to "$new_version.git".

The benefit is that a pre-release with a quite well defined and unique
version can be easily created at any time.

Signed-off-by: Sebastian Harl <sh at tokkee.org>
 configure.in   |    2 +-
 version-gen.sh |   14 ++++++++++++++
 2 files changed, 15 insertions(+), 1 deletions(-)
 create mode 100755 version-gen.sh

diff --git a/configure.in b/configure.in
index 5b3a54a..735ea74 100644
--- a/configure.in
+++ b/configure.in
@@ -1,5 +1,5 @@
 dnl Process this file with autoconf to produce a configure script.
-AC_INIT(collectd, 4.0.5)
+AC_INIT(collectd, m4_esyscmd(./version-gen.sh))
diff --git a/version-gen.sh b/version-gen.sh
new file mode 100755
index 0000000..510a3a0
--- /dev/null
+++ b/version-gen.sh
@@ -0,0 +1,14 @@
+VERSION="$( git describe 2> /dev/null | sed -e 's/^collectd-//' )"
+if test -z "$VERSION"; then
+VERSION=$( echo "$VERSION" | sed -e 's/-/./g' )
+echo -n $VERSION

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://mailman.verplant.org/pipermail/collectd/attachments/20070726/04a49fcd/attachment.pgp 

More information about the collectd mailing list