From 8c2c78f0b62b3325659cd8296db6dbfd728943c1 Mon Sep 17 00:00:00 2001 From: Shivani Bhardwaj Date: Wed, 17 Jul 2019 19:04:36 +0530 Subject: [PATCH] configure: Add date with rev information Date makes it even clearer that when was the last commit for the build that one is running. Add this info alongwith rev. Change inspired by rustc. Before ``` $ suricata -V This is Suricata version 5.0.0-dev (rev 2d217e666) ``` After ``` This is Suricata version 5.0.0-dev (2d217e666 2019-07-12) ``` Closes redmine ticket #3092 --- configure.ac | 2 ++ src/suricata.c | 8 ++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/configure.ac b/configure.ac index 7c37c15938..8200be342f 100644 --- a/configure.ac +++ b/configure.ac @@ -2468,6 +2468,8 @@ fi if test "$HAVE_GIT_CMD" != "no"; then if [ test -d .git ]; then REVISION=`git rev-parse --short HEAD` + DATE=`git log -1 --date=short --pretty=format:%cd` + REVISION="$REVISION $DATE" AC_DEFINE_UNQUOTED([REVISION],[${REVISION}],[Git revision]) fi fi diff --git a/src/suricata.c b/src/suricata.c index dc4843b1fa..0195254ae6 100644 --- a/src/suricata.c +++ b/src/suricata.c @@ -581,7 +581,7 @@ static void SetBpfStringFromFile(char *filename) static void PrintUsage(const char *progname) { #ifdef REVISION - printf("%s %s (rev %s)\n", PROG_NAME, PROG_VER, xstr(REVISION)); + printf("%s %s (%s)\n", PROG_NAME, PROG_VER, xstr(REVISION)); #else printf("%s %s\n", PROG_NAME, PROG_VER); #endif @@ -684,7 +684,7 @@ static void PrintBuildInfo(void) const char *tls = "pthread key"; #ifdef REVISION - printf("This is %s version %s (rev %s)\n", PROG_NAME, PROG_VER, xstr(REVISION)); + printf("This is %s version %s (%s)\n", PROG_NAME, PROG_VER, xstr(REVISION)); #elif defined RELEASE printf("This is %s version %s RELEASE\n", PROG_NAME, PROG_VER); #else @@ -1054,7 +1054,7 @@ static void SCInstanceInit(SCInstance *suri, const char *progname) static TmEcode PrintVersion(void) { #ifdef REVISION - printf("This is %s version %s (rev %s)\n", PROG_NAME, PROG_VER, xstr(REVISION)); + printf("This is %s version %s (%s)\n", PROG_NAME, PROG_VER, xstr(REVISION)); #elif defined RELEASE printf("This is %s version %s RELEASE\n", PROG_NAME, PROG_VER); #else @@ -1067,7 +1067,7 @@ static TmEcode LogVersion(SCInstance *suri) { const char *mode = suri->system ? "SYSTEM" : "USER"; #ifdef REVISION - SCLogNotice("This is %s version %s (rev %s) running in %s mode", + SCLogNotice("This is %s version %s (%s) running in %s mode", PROG_NAME, PROG_VER, xstr(REVISION), mode); #elif defined RELEASE SCLogNotice("This is %s version %s RELEASE running in %s mode",