[lttng-dev] [PATCH lttng-tools] Add the formal version before the git version for a commit outside the master branch

Raphaël Beamonte raphael.beamonte at gmail.com
Mon Jul 28 16:00:04 EDT 2014


Signed-off-by: Raphaël Beamonte <raphael.beamonte at gmail.com>
---
 include/Makefile.am | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/include/Makefile.am b/include/Makefile.am
index d40cb4a..67a7063 100644
--- a/include/Makefile.am
+++ b/include/Makefile.am
@@ -24,8 +24,10 @@ version.h:
 			if [ "$${git_branch}" == "$${git_describe}" ] || \
 				[ "$${git_branch}" == "heads/master" ]; then \
 				git_version="$${git_describe}"; \
+				addversion=""; \
 			else \
 				git_version="$$(git describe --long --all)"; \
+				addversion="\" VERSION \"-"; \
 			fi; \
 		fi; \
 		##
@@ -46,19 +48,19 @@ version.h:
 			## as the one currently in the file (if there is one), as we
 			## don't want to update the file if it is already up to date
 			##
-			if [ $$(grep -cE "^#define GIT_VERSION \"?$${git_version}\"?$$" "$${version_h}") -eq 0 ]; then \
+			if [ $$(grep -cE "^#define GIT_VERSION \"?$${addversion}$${git_version}\"?$$" "$${version_h}") -eq 0 ]; then \
 				if [ $$(grep -c "^#define GIT_VERSION" "$${version_h}") -gt 0 ]; then \
 					##
 					## If there is already a GIT_VERSION defined,
 					## we just replace it by the new version
 					##
-					sed -i "s'^#define GIT_VERSION.*$$'#define GIT_VERSION \"$${git_version}\"'" "$${version_h}"; \
+					sed -i "s'^#define GIT_VERSION.*$$'#define GIT_VERSION \"$${addversion}$${git_version}\"'" "$${version_h}"; \
 				else \
 					##
 					## Else, we add a GIT_VERSION define
 					## containing our new version.
 					##
-					sed -i "s'^\(#define VERSION_H.*\)$$'\1\n\n#define GIT_VERSION \"$${git_version}\"'" "$${version_h}"; \
+					sed -i "s'^\(#define VERSION_H.*\)$$'\1\n\n#define GIT_VERSION \"$${addversion}$${git_version}\"'" "$${version_h}"; \
 				fi; \
 			fi; \
 		fi; \
-- 
2.0.0.rc0




More information about the lttng-dev mailing list