From 456b8d40f14be07cca75a9e22ec77976c895d4d5 Mon Sep 17 00:00:00 2001 From: Jonathan Rajotte Julien Date: Mon, 28 Jul 2014 15:43:29 -0400 Subject: [PATCH] Always print GIT_VERSION even if empty Adjustment from last proposed patch. Less crowded and more standard. This should not break any packaging. feedback? Signed-off-by: Jonathan Rajotte Julien --- include/Makefile.am | 14 +------------- include/version.h.tmpl | 9 +-------- src/bin/lttng/commands/version.c | 2 +- src/bin/lttng/lttng.c | 4 ++-- 4 files changed, 5 insertions(+), 24 deletions(-) diff --git a/include/Makefile.am b/include/Makefile.am index d40cb4a4f..89b084d01 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -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) diff --git a/include/version.h.tmpl b/include/version.h.tmpl index 2cab733a8..861a477bc 100644 --- a/include/version.h.tmpl +++ b/include/version.h.tmpl @@ -20,13 +20,6 @@ #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 */ diff --git a/src/bin/lttng/commands/version.c b/src/bin/lttng/commands/version.c index 13e5c994f..768ebb5e1 100644 --- a/src/bin/lttng/commands/version.c +++ b/src/bin/lttng/commands/version.c @@ -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); diff --git a/src/bin/lttng/lttng.c b/src/bin/lttng/lttng.c index bad57fd9a..41232bef9 100644 --- a/src/bin/lttng/lttng.c +++ b/src/bin/lttng/lttng.c @@ -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] []\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); } -- 2.34.1