Always print GIT_VERSION even if empty
authorJonathan Rajotte Julien <jonathan.r.julien@gmail.com>
Mon, 28 Jul 2014 19:43:29 +0000 (15:43 -0400)
committerDavid Goulet <dgoulet@efficios.com>
Tue, 29 Jul 2014 14:58:16 +0000 (10:58 -0400)
Adjustment from last proposed patch. Less crowded and more standard.
This should not break any packaging.

feedback?

Signed-off-by: Jonathan Rajotte Julien <jonathan.r.julien@gmail.com>
include/Makefile.am
include/version.h.tmpl
src/bin/lttng/commands/version.c
src/bin/lttng/lttng.c

index d40cb4a4fea2fbb7327dd95bcb56cdbeb2145be1..89b084d01b45a62bcbd59ce62e04292dfcae5cbd 100644 (file)
@@ -47,19 +47,7 @@ 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
-                                       ##
-                                       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; \
+                               sed -i "s'^#define GIT_VERSION.*$$'#define GIT_VERSION \"$${git_version}\"'" "$${version_h}"; \
                        fi; \
                fi; \
        fi)
index 2cab733a847946f62c575fb13255061ba928d9bc..861a477bca44b14154ab25ab31cc0199f233ecba 100644 (file)
 #ifndef VERSION_H
 #define VERSION_H
 
-/*
- * 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 GIT_VERSION ""
 
 #endif /* VERSION_H */
index 13e5c994f16ce8b496a5919c61a833544c1d629d..768ebb5e14c030825de7a1d5226bc883b8716658 100644 (file)
@@ -164,7 +164,7 @@ int cmd_version(int argc, const char **argv)
        if (lttng_opt_mi) {
                ret = print_mi();
        } else {
-               MSG("lttng version " FULL_VERSION " - " VERSION_NAME);
+               MSG("lttng version " VERSION " - " VERSION_NAME " - " GIT_VERSION);
                MSG("\n" VERSION_DESCRIPTION "\n");
                MSG("Web site: http://lttng.org");
                MSG("\n%s", lttng_license);
index bad57fd9a8a41487e33482ba5ad5e49187c4abd3..41232bef9e6e4a2efdc40f90ec9b70dff69ea76c 100644 (file)
@@ -90,7 +90,7 @@ static struct cmd_struct commands[] =  {
 
 static void usage(FILE *ofp)
 {
-       fprintf(ofp, "LTTng Trace Control " FULL_VERSION" - " VERSION_NAME"\n\n");
+       fprintf(ofp, "LTTng Trace Control " VERSION " - " VERSION_NAME" - " GIT_VERSION "\n\n");
        fprintf(ofp, "usage: lttng [OPTIONS] <COMMAND> [<ARGS>]\n");
        fprintf(ofp, "\n");
        fprintf(ofp, "Options:\n");
@@ -134,7 +134,7 @@ static void usage(FILE *ofp)
 
 static void version(FILE *ofp)
 {
-       fprintf(ofp, "%s (LTTng Trace Control) " FULL_VERSION" - " VERSION_NAME"\n",
+       fprintf(ofp, "%s (LTTng Trace Control) " VERSION" - " VERSION_NAME" - " GIT_VERSION "\n",
                        progname);
 }
 
This page took 0.037622 seconds and 4 git commands to generate.