From f4d9539c4b82f00a1e9e1a1d0741bb99d3eba04c Mon Sep 17 00:00:00 2001 From: Michael Iedema Date: Fri, 20 Jun 2014 20:13:52 +0200 Subject: [PATCH] auto-extract repo revs from svn or git as needed - closes issue #5 --- Globals/Globals.cpp | 2 +- Globals/GrabRepoInfo.sh | 11 +++++++++++ Makefile.common | 4 ++-- 3 files changed, 14 insertions(+), 3 deletions(-) create mode 100755 Globals/GrabRepoInfo.sh diff --git a/Globals/Globals.cpp b/Globals/Globals.cpp index 38bf2fc..fa72b72 100644 --- a/Globals/Globals.cpp +++ b/Globals/Globals.cpp @@ -22,4 +22,4 @@ #include "config.h" #include -const char *gVersionString = "release " VERSION " built " TIMESTAMP_ISO " rev" SVN_REV " "; +const char *gVersionString = "release " VERSION " built " TIMESTAMP_ISO " " REPO_REV " "; diff --git a/Globals/GrabRepoInfo.sh b/Globals/GrabRepoInfo.sh new file mode 100755 index 0000000..c04a31d --- /dev/null +++ b/Globals/GrabRepoInfo.sh @@ -0,0 +1,11 @@ +#!/bin/sh +cd $1 + +INFO="" +if [ -d ./.svn ]; then + INFO="r$(svn info . | grep "Last Changed Rev:" | cut -d " " -f 4) CommonLibs:r$(svn info ./CommonLibs | grep "Last Changed Rev:" | cut -d " " -f 4)" +elif [ -d ./.git ]; then + INFO="$(git rev-parse --short=10 HEAD) CommonLibs:$(cd CommonLibs; git rev-parse --short=10 HEAD)" +fi + +echo $INFO diff --git a/Makefile.common b/Makefile.common index 57b7a38..476ba28 100644 --- a/Makefile.common +++ b/Makefile.common @@ -31,10 +31,10 @@ NODEMANAGER_INCLUDEDIR = $(top_srcdir)/NodeManager JSONBOX_INCLUDEDIR = $(top_srcdir)/NodeManager/JsonBox-0.4.3/include JSONDB_INCLUDEDIR = $(top_srcdir)/NodeManager/JSONDB -SVNDEV = -D'SVN_REV="$(shell svn info $(top_builddir) | grep "Last Changed Rev:" | cut -d " " -f 4) CommonLibs:rev$(shell svn info $(top_builddir)/CommonLibs | grep "Last Changed Rev:" | cut -d " " -f 4)"' +REPOREV = -D'REPO_REV="$(shell ./$(top_builddir)/Globals/GrabRepoInfo.sh $(top_builddir))"' STD_DEFINES_AND_INCLUDES = \ - $(SVNDEV) \ + $(REPOREV) \ -I$(COMMON_INCLUDEDIR) \ -I$(GLOBALS_INCLUDEDIR) \ -I$(NODEMANAGER_INCLUDEDIR) \