The following commit has been merged in the master branch: commit 96f375d18dd825de0ac351bb2f8194dffebbc082 Author: Sven Eckelmann sven@narfation.org Date: Tue Jul 5 10:54:59 2011 +0200
batmand: Replace version info instead of appending them
The version number of batmand can get revision numbers added. This is useful to give hints about the revision of a distribution package and the used patchset or the commit which was used to build it. The prepended source number or branch name doesn't add any additional information which would help to identify problems and can therefore be omitted.
Signed-off-by: Sven Eckelmann sven@narfation.org
diff --git a/Makefile b/Makefile index 4f6fe64..346b14a 100755 --- a/Makefile +++ b/Makefile @@ -55,7 +55,7 @@ MANPAGE = man/batmand.8
# batmand flags and options CFLAGS += -pedantic -Wall -W -std=gnu99 -MD -CPPFLAGS = -DDEBUG_MALLOC -DMEMORY_USAGE -DPROFILE_DATA $(NO_POLICY_ROUTING) -DREVISION_VERSION=$(REVISION_VERSION) +CPPFLAGS = -DDEBUG_MALLOC -DMEMORY_USAGE -DPROFILE_DATA $(NO_POLICY_ROUTING) LDLIBS += -lpthread
# disable verbose output @@ -82,8 +82,12 @@ SBINDIR = $(PREFIX)/sbin MANDIR = $(PREFIX)/share/man
# try to generate revision -REVISION = $(shell if [ -d .git ]; then echo $$(git describe --always --dirty 2> /dev/null || echo "[unknown]"); fi) -REVISION_VERSION ="\ $(REVISION)" +REVISION= $(shell if [ -d .git ]; then \ + echo $$(git describe --always --dirty --match "v*" |sed 's/^v//' 2> /dev/null || echo "[unknown]"); \ + fi) +ifneq ($(REVISION),) +CPPFLAGS += -DSOURCE_VERSION="$(REVISION)" +endif
# default target all: $(BINARY_NAME) diff --git a/batman.h b/batman.h index b1a3076..ae51c22 100644 --- a/batman.h +++ b/batman.h @@ -40,7 +40,9 @@ #include "profile.h" #include "ring_buffer.h"
-#define SOURCE_VERSION "0.4-alpha" /* put exactly one distinct word inside the string like "0.3-pre-alpha" or "0.3-rc1" or "0.3" */ +#ifndef SOURCE_VERSION +#define SOURCE_VERSION "0.4" +#endif #define ADDR_STR_LEN 16 #define TQ_MAX_VALUE 255
@@ -59,11 +61,6 @@ ***/
-#ifndef REVISION_VERSION -#define REVISION_VERSION "0" -#endif - -
/* * No configuration files or fancy command line switches yet diff --git a/linux/modules/Makefile.kbuild b/linux/modules/Makefile.kbuild index 1be319b..ae538ad 100644 --- a/linux/modules/Makefile.kbuild +++ b/linux/modules/Makefile.kbuild @@ -3,7 +3,11 @@ ifeq ($(MAKING_MODULES),1) endif
LINUX24:=2.4 -EXTRA_CFLAGS +=-DREVISION_VERSION="\ $(REVISION)" +ifneq ($(REVISION),) +ccflags-y += -DSOURCE_VERSION="$(REVISION)" +else +ccflags-y += -DSOURCE_VERSION="" +endif
ifneq ($(strip $(findstring $(LINUX24),$(LINUX_VERSION))),$(LINUX24))
diff --git a/linux/modules/gateway.c b/linux/modules/gateway.c index 63456aa..49b958f 100644 --- a/linux/modules/gateway.c +++ b/linux/modules/gateway.c @@ -95,7 +95,7 @@ int init_module(void) device_create(batman_class, NULL, MKDEV(Major, 0), NULL, "batgat");
- DBG( "batgat loaded %s", strlen(REVISION_VERSION) > 3 ? REVISION_VERSION : "" ); + DBG( "batgat loaded %s", SOURCE_VERSION ); DBG( "I was assigned major number %d. To talk to", Major ); DBG( "the driver, create a dev file with 'mknod /dev/batgat c %d 0'.", Major ); DBG( "Remove the device file and module when done." ); diff --git a/linux/modules/gateway.h b/linux/modules/gateway.h index 238b518..fc98174 100644 --- a/linux/modules/gateway.h +++ b/linux/modules/gateway.h @@ -69,10 +69,6 @@ #define PROC_ROOT_DIR "batgat" #define PROC_FILE_CLIENTS "clients"
-#ifndef REVISION_VERSION -#define REVISION_VERSION "1" -#endif - struct gw_client { uint32_t wip_addr; uint32_t vip_addr; diff --git a/linux/modules/gateway24.c b/linux/modules/gateway24.c index 858aa27..a6b91d2 100644 --- a/linux/modules/gateway24.c +++ b/linux/modules/gateway24.c @@ -80,7 +80,7 @@ int init_module(void)
}
- DBG( "batgat loaded %s", strlen(REVISION_VERSION) > 3 ? REVISION_VERSION : "" ); + DBG( "batgat loaded %s", SOURCE_VERSION ); DBG( "I was assigned major number %d. To talk to", Major ); DBG( "the driver, create a dev file with 'mknod /dev/batgat c %d 0'.", Major ); printk(KERN_DEBUG "Remove the device file and module when done." ); diff --git a/linux/modules/gateway24.h b/linux/modules/gateway24.h index a9a27b6..b1958a7 100644 --- a/linux/modules/gateway24.h +++ b/linux/modules/gateway24.h @@ -74,10 +74,6 @@ #define PROC_ROOT_DIR "batgat" #define PROC_FILE_CLIENTS "clients"
-#ifndef REVISION_VERSION -#define REVISION_VERSION "1" -#endif - struct gw_client { uint32_t wip_addr; uint32_t vip_addr; diff --git a/originator.c b/originator.c index 99d7734..a96c3d4 100644 --- a/originator.c +++ b/originator.c @@ -423,7 +423,7 @@ void debug_orig(void) { uptime_sec = (uint64_t)(get_time_msec64() / 1000);
debug_output(2, "BOD\n"); - debug_output(2, "%''12s (%s/%i) %''15s [%10s], gw_class ... [B.A.T.M.A.N. %s%s, MainIF/IP: %s/%s, UT: %id%2ih%2im] \n", "Gateway", "#", TQ_MAX_VALUE, "Nexthop", "outgoingIF", SOURCE_VERSION, (strlen(REVISION_VERSION) > 3 ? REVISION_VERSION : ""), ((struct batman_if *)if_list.next)->dev, orig_str, (uint32_t)(uptime_sec/86400), (uint32_t)((uptime_sec%86400)/3600), (uint32_t)((uptime_sec%3600)/60)); + debug_output(2, "%''12s (%s/%i) %''15s [%10s], gw_class ... [B.A.T.M.A.N. %s, MainIF/IP: %s/%s, UT: %id%2ih%2im] \n", "Gateway", "#", TQ_MAX_VALUE, "Nexthop", "outgoingIF", SOURCE_VERSION, ((struct batman_if *)if_list.next)->dev, orig_str, (uint32_t)(uptime_sec/86400), (uint32_t)((uptime_sec%86400)/3600), (uint32_t)((uptime_sec%3600)/60));
if ( list_empty( &gw_list ) ) {
@@ -467,7 +467,7 @@ void debug_orig(void) { uptime_sec = (uint64_t)(get_time_msec64() / 1000);
debug_output(1, "BOD \n"); - debug_output(1, " %-11s (%s/%i) %''15s [%10s]: %''20s ... [B.A.T.M.A.N. %s%s, MainIF/IP: %s/%s, UT: %id%2ih%2im] \n", "Originator", "#", TQ_MAX_VALUE, "Nexthop", "outgoingIF", "Potential nexthops", SOURCE_VERSION, (strlen(REVISION_VERSION) > 3 ? REVISION_VERSION : ""), ((struct batman_if *)if_list.next)->dev, orig_str, (uint32_t)(uptime_sec/86400), (uint32_t)((uptime_sec%86400)/3600), (uint32_t)((uptime_sec%3600)/60)); + debug_output(1, " %-11s (%s/%i) %''15s [%10s]: %''20s ... [B.A.T.M.A.N. %s, MainIF/IP: %s/%s, UT: %id%2ih%2im] \n", "Originator", "#", TQ_MAX_VALUE, "Nexthop", "outgoingIF", "Potential nexthops", SOURCE_VERSION, ((struct batman_if *)if_list.next)->dev, orig_str, (uint32_t)(uptime_sec/86400), (uint32_t)((uptime_sec%86400)/3600), (uint32_t)((uptime_sec%3600)/60));
if ( debug_clients.clients_num[3] > 0 ) {
diff --git a/posix/init.c b/posix/init.c index 4fe2324..afd409f 100644 --- a/posix/init.c +++ b/posix/init.c @@ -166,9 +166,6 @@ void apply_init_args( int argc, char *argv[] ) { stop = 0; prog_name = argv[0];
- if ( strstr( SOURCE_VERSION, "-" ) != NULL ) - printf( "WARNING: You are using the unstable batman branch. If you are interested in *using* batman get the latest stable release !\n" ); - while ( ( optchar = getopt_long( argc, argv, "a:A:bcd:hHio:g:p:r:s:vV", long_options, &option_index ) ) != -1 ) {
switch ( optchar ) { @@ -359,14 +356,14 @@ void apply_init_args( int argc, char *argv[] ) {
case 'v':
- printf("B.A.T.M.A.N. %s%s (compatibility version %i)\n", SOURCE_VERSION, (strlen(REVISION_VERSION) > 3 ? REVISION_VERSION : ""), COMPAT_VERSION); + printf("B.A.T.M.A.N. %s (compatibility version %i)\n", SOURCE_VERSION, COMPAT_VERSION); exit(EXIT_SUCCESS);
case 'V':
print_animation();
- printf("\x1B[0;0HB.A.T.M.A.N. %s%s (compatibility version %i)\n", SOURCE_VERSION, (strlen(REVISION_VERSION) > 3 ? REVISION_VERSION : ""), COMPAT_VERSION); + printf("\x1B[0;0HB.A.T.M.A.N. %s (compatibility version %i)\n", SOURCE_VERSION, COMPAT_VERSION); printf("\x1B[9;0H \t May the bat guide your path ...\n\n\n");
exit(EXIT_SUCCESS); @@ -551,7 +548,7 @@ void apply_init_args( int argc, char *argv[] ) {
} else {
- printf("B.A.T.M.A.N. %s%s (compatibility version %i)\n", SOURCE_VERSION, (strlen(REVISION_VERSION) > 3 ? REVISION_VERSION : ""), COMPAT_VERSION); + printf("B.A.T.M.A.N. %s (compatibility version %i)\n", SOURCE_VERSION, COMPAT_VERSION);
debug_clients.clients_num[ debug_level - 1 ]++; debug_level_info = debugMalloc( sizeof(struct debug_level_info), 205 );