From 72baa97369618698ec649fece8629d12afae46de Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Fri, 21 Sep 2012 18:04:41 +0000 Subject: [PATCH] Condense the humanized FS version string Old: FreeSWITCH Version 1.3.0+git~20120916T192130Z~3b5aa066c7 (1.3.0; git at commit 3b5aa066c7 on Sun, 16 Sep 2012 19:21:30 Z) New: FreeSWITCH Version 1.3.0+git~20120916T192130Z~3b5aa066c7 (git 3b5aa06 2012-09-16 19:21:30Z) --- build/print_git_revision.c | 10 +++++----- src/include/switch_version.h.cmake | 2 +- src/include/switch_version.h.template | 2 +- src/mod/applications/mod_commands/mod_commands.c | 2 +- src/switch.c | 2 +- src/switch_core.c | 2 +- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/build/print_git_revision.c b/build/print_git_revision.c index 0f8e680b37..974ba6ca3a 100644 --- a/build/print_git_revision.c +++ b/build/print_git_revision.c @@ -69,15 +69,15 @@ static int print_human_version(void) { if ((sys1(xdate,sizeof(xdate),"git log -n1 --format='%ct' HEAD"))) return 1; xdate_t=(time_t)atoi(xdate); if (!(xdate_tm=gmtime(&xdate_t))) return 1; - strftime(xfdate,sizeof(xfdate),"%a, %d %b %Y %H:%M:%S Z",xdate_tm); - if ((sys1(xcommit,sizeof(xcommit),"git rev-list -n1 --abbrev=10 --abbrev-commit HEAD"))) + strftime(xfdate,sizeof(xfdate),"%Y-%m-%d %H:%M:%SZ",xdate_tm); + if ((sys1(xcommit,sizeof(xcommit),"git rev-list -n1 --abbrev=7 --abbrev-commit HEAD"))) return 1; - snprintf(xver,sizeof(xver),"; git at commit %s on %s",xcommit,xfdate); + snprintf(xver,sizeof(xver),"git %s %s",xcommit,xfdate); if (show_unclean && (sys(NULL,0,"git diff-index --quiet HEAD"))) { char buf[256], now[256]; time_t now_t=time(NULL); struct tm *now_tm; if (!(now_tm=gmtime(&now_t))) return 1; - strftime(now,sizeof(now),"%a, %d %b %Y %H:%M:%S Z",now_tm); - snprintf(buf,sizeof(buf),"%s; unclean git build on %s",xver,now); + strftime(now,sizeof(now),"%Y-%m-%d %H:%M:%SZ",now_tm); + snprintf(buf,sizeof(buf),"%s unclean %s",xver,now); strncpy(xver,buf,sizeof(xver)); } printf("%s\n",xver); diff --git a/src/include/switch_version.h.cmake b/src/include/switch_version.h.cmake index c722c2221d..6e7f2036e6 100644 --- a/src/include/switch_version.h.cmake +++ b/src/include/switch_version.h.cmake @@ -43,7 +43,7 @@ extern "C" { #define SWITCH_VERSION_REVISION "@Project_WC_REVISION@" #define SWITCH_VERSION_REVISION_HUMAN "@Project_WC_REVISION@" #define SWITCH_VERSION_FULL SWITCH_VERSION_MAJOR "." SWITCH_VERSION_MINOR "." SWITCH_VERSION_MICRO SWITCH_VERSION_REVISION -#define SWITCH_VERSION_FULL_HUMAN SWITCH_VERSION_MAJOR "." SWITCH_VERSION_MINOR "." SWITCH_VERSION_MICRO SWITCH_VERSION_REVISION_HUMAN +#define SWITCH_VERSION_FULL_HUMAN SWITCH_VERSION_MAJOR "." SWITCH_VERSION_MINOR "." SWITCH_VERSION_MICRO " " SWITCH_VERSION_REVISION_HUMAN #ifdef __cplusplus } diff --git a/src/include/switch_version.h.template b/src/include/switch_version.h.template index dfec6e091e..2e253dc69f 100644 --- a/src/include/switch_version.h.template +++ b/src/include/switch_version.h.template @@ -43,7 +43,7 @@ extern "C" { #define SWITCH_VERSION_REVISION "@SWITCH_VERSION_REVISION@" #define SWITCH_VERSION_REVISION_HUMAN "@SWITCH_VERSION_REVISION_HUMAN@" #define SWITCH_VERSION_FULL SWITCH_VERSION_MAJOR "." SWITCH_VERSION_MINOR "." SWITCH_VERSION_MICRO SWITCH_VERSION_REVISION -#define SWITCH_VERSION_FULL_HUMAN SWITCH_VERSION_MAJOR "." SWITCH_VERSION_MINOR "." SWITCH_VERSION_MICRO SWITCH_VERSION_REVISION_HUMAN +#define SWITCH_VERSION_FULL_HUMAN SWITCH_VERSION_MAJOR "." SWITCH_VERSION_MINOR "." SWITCH_VERSION_MICRO " " SWITCH_VERSION_REVISION_HUMAN #ifdef __cplusplus } diff --git a/src/mod/applications/mod_commands/mod_commands.c b/src/mod/applications/mod_commands/mod_commands.c index 0a6c1d08ce..d823af7194 100644 --- a/src/mod/applications/mod_commands/mod_commands.c +++ b/src/mod/applications/mod_commands/mod_commands.c @@ -286,7 +286,7 @@ SWITCH_STANDARD_API(shutdown_function) SWITCH_STANDARD_API(version_function) { - stream->write_function(stream, "FreeSWITCH Version %s (%s)\n", SWITCH_VERSION_FULL, SWITCH_VERSION_FULL_HUMAN); + stream->write_function(stream, "FreeSWITCH Version %s (%s)\n", SWITCH_VERSION_FULL, SWITCH_VERSION_REVISION_HUMAN); return SWITCH_STATUS_SUCCESS; } diff --git a/src/switch.c b/src/switch.c index e1b602356e..4f8678a97f 100644 --- a/src/switch.c +++ b/src/switch.c @@ -577,7 +577,7 @@ int main(int argc, char *argv[]) } else if (!strcmp(local_argv[x], "-version")) { - fprintf(stdout, "FreeSWITCH version: %s (%s)\n", SWITCH_VERSION_FULL, SWITCH_VERSION_FULL_HUMAN); + fprintf(stdout, "FreeSWITCH version: %s (%s)\n", SWITCH_VERSION_FULL, SWITCH_VERSION_REVISION_HUMAN); exit(EXIT_SUCCESS); } #endif diff --git a/src/switch_core.c b/src/switch_core.c index 2a9bec7dee..ec313ea2fb 100644 --- a/src/switch_core.c +++ b/src/switch_core.c @@ -2013,7 +2013,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_init_and_modload(switch_core_flag_t switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "\nFreeSWITCH Version %s (%s) Started.\nMax Sessions[%u]\nSession Rate[%d]\nSQL [%s]\n", - SWITCH_VERSION_FULL, SWITCH_VERSION_FULL_HUMAN, + SWITCH_VERSION_FULL, SWITCH_VERSION_REVISION_HUMAN, switch_core_session_limit(0), switch_core_sessions_per_second(0), switch_test_flag((&runtime), SCF_USE_SQL) ? "Enabled" : "Disabled");