[lttng-dev] [PATCH lttng-tool] Fix: print version number even if on a development git branch

Jonathan Rajotte Julien jonathan.r.julien at gmail.com
Wed Jul 23 14:38:20 EDT 2014


The use of GIT_VERSION as a full replacement for FULL_NAME and
discarding the VERSION macro does not indicate which version
is lttng at.

This able lttng to be more verbose about the overall version
even if we are on a different git branch than master.

Signed-off-by: Jonathan Rajotte Julien <jonathan.r.julien at gmail.com>
---
 include/Makefile.am    | 13 +------------
 include/version.h.tmpl |  7 ++-----
 2 files changed, 3 insertions(+), 17 deletions(-)

diff --git a/include/Makefile.am b/include/Makefile.am
index d40cb4a..ab13d86 100644
--- a/include/Makefile.am
+++ b/include/Makefile.am
@@ -47,19 +47,8 @@ version.h:
 			## 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 -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
-					##
+					## Replace it by the new version
 					sed -i "s'^#define GIT_VERSION.*$$'#define GIT_VERSION \"$${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}"; \
-				fi; \
 			fi; \
 		fi; \
 	fi)
diff --git a/include/version.h.tmpl b/include/version.h.tmpl
index 2cab733..2d69456 100644
--- a/include/version.h.tmpl
+++ b/include/version.h.tmpl
@@ -20,13 +20,10 @@
 #ifndef VERSION_H
 #define VERSION_H
 
+#define GIT_VERSION ""
 /*
  * Define the macro containing the FULL version
  */
-#ifdef GIT_VERSION
-#define FULL_VERSION "" GIT_VERSION
-#else /* GIT_VERSION */
-#define FULL_VERSION "" VERSION
-#endif /* GIT_VERSION */
+#define FULL_VERSION ""VERSION " " GIT_VERSION
 
 #endif /* VERSION_H */
-- 
2.0.0




More information about the lttng-dev mailing list