tool/ctdb: Always support ctdb version command, don't make it optional
authorAmitay Isaacs <amitay@gmail.com>
Tue, 30 Oct 2012 00:49:28 +0000 (11:49 +1100)
committerAmitay Isaacs <amitay@gmail.com>
Tue, 30 Oct 2012 00:56:00 +0000 (11:56 +1100)
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
packaging/RPM/ctdb.spec.in
tools/ctdb.c

index b0555c798eb47ac3500e4eea8e5360b5e6e5457a..50287ab0912a0d0f3154ddeefdc65d79de6759f3 100644 (file)
@@ -71,7 +71,7 @@ export CC
 ## always run autogen.sh
 ./autogen.sh
 
-CFLAGS="$RPM_OPT_FLAGS $EXTRA -O0 -D_GNU_SOURCE -DCTDB_VERS=\"%{version}-%{release}\"" ./configure \
+CFLAGS="$RPM_OPT_FLAGS $EXTRA -O0 -D_GNU_SOURCE" ./configure \
 %if %with_included_talloc
        --with-included-talloc \
 %endif
index 7c8afd800aedd2d15a985094cc338a3ce1244740..d132cae9d6d467351841b0b604c108f3dbcc4331 100644 (file)
@@ -25,6 +25,7 @@
 #include "system/locale.h"
 #include "popt.h"
 #include "cmdline.h"
+#include "../include/version.h"
 #include "../include/ctdb.h"
 #include "../include/ctdb_client.h"
 #include "../include/ctdb_private.h"
@@ -56,15 +57,11 @@ static struct {
 #define TIMELIMIT() timeval_current_ofs(options.timelimit, 0)
 #define LONGTIMELIMIT() timeval_current_ofs(options.timelimit*10, 0)
 
-#ifdef CTDB_VERS
 static int control_version(struct ctdb_context *ctdb, int argc, const char **argv)
 {
-#define STR(x) #x
-#define XSTR(x) STR(x)
-       printf("CTDB version: %s\n", XSTR(CTDB_VERS));
+       printf("CTDB version: %s\n", CTDB_VERSION_STRING);
        return 0;
 }
-#endif
 
 #define CTDB_NOMEM_ABORT(p) do { if (!(p)) {                           \
                DEBUG(DEBUG_ALERT,("ctdb fatal error: %s\n",            \
@@ -5786,9 +5783,7 @@ static const struct {
        const char *msg;
        const char *args;
 } ctdb_commands[] = {
-#ifdef CTDB_VERS
-       { "version",         control_version,           true,   false,  "show version of ctdb" },
-#endif
+       { "version",         control_version,           true,   true,   "show version of ctdb" },
        { "status",          control_status,            true,   false,  "show node status" },
        { "uptime",          control_uptime,            true,   false,  "show node uptime" },
        { "ping",            control_ping,              true,   false,  "ping all nodes" },