From 561f7b449686451daed3e7b4b5423b625e5ea570 Mon Sep 17 00:00:00 2001 From: Dave West Date: Thu, 20 Mar 2008 18:32:07 +0000 Subject: [PATCH] Now the server records the SVN revision in the log at startup. --- citadel/Makefile.in | 7 +++- citadel/mk_svn_revision.sh | 66 ++++++++++++++++++++++++++++++++++++++ citadel/server_main.c | 6 ++++ 3 files changed, 78 insertions(+), 1 deletion(-) create mode 100755 citadel/mk_svn_revision.sh diff --git a/citadel/Makefile.in b/citadel/Makefile.in index 98b88ce4c..8639ae6e3 100644 --- a/citadel/Makefile.in +++ b/citadel/Makefile.in @@ -84,8 +84,12 @@ SOURCES=aidepost.c auth.c base64.c chkpwd.c chkpw.c citadel.c citadel_ipc.c \ whobbs.c \ crc16.c journaling.c citadel_dirs.c threads.c + include Make_sources +svn_revision.c: ${SOURCES} + ./mk_svn_revision.sh + DEP_FILES=$(SOURCES:.c=.d) modules_init.d modules_upgrade.d client: $(CLIENT_TARGETS) @@ -125,7 +129,8 @@ SERV_OBJS = server_main.o \ locate_host.o housekeeping.o \ internet_addressing.o journaling.o \ parsedate.o genstamp.o ecrash.o threads.o\ - clientsocket.o modules_init.o modules_upgrade.o $(AUTH) $(SERV_MODULES) + clientsocket.o modules_init.o modules_upgrade.o $(AUTH) $(SERV_MODULES) \ + svn_revision.o citserver: $(SERV_OBJS) $(CC) $(SERV_OBJS) $(LDFLAGS) $(SERVER_LDFLAGS) $(LIBS) $(SERVER_LIBS) $(RESOLV) -o citserver diff --git a/citadel/mk_svn_revision.sh b/citadel/mk_svn_revision.sh new file mode 100755 index 000000000..ad067b89a --- /dev/null +++ b/citadel/mk_svn_revision.sh @@ -0,0 +1,66 @@ +#!/bin/sh +# +# Script to generate svn_revision.c +# + +ECHO=/usr/bin/printf + + +CUR_DIR=`pwd` +C_FILE="$CUR_DIR/svn_revision.c" +H_FILE="$CUR_DIR/svn_revision.h" + + +# determine if this code base came from subversion. +if [ -d .svn ] ; then + echo "have subversion repository" + SVNVERSION=`which svnversion` + if [ -x $SVNVERSION ] ; then + echo "have svnversion at $SVNVERSION" + BUILD=`svnversion -n .` + echo "This code base revision $BUILD" + CAN_BUILD_SVN_REVISION="yes" + fi +fi + +if [ $CAN_BUILD_SVN_REVISION == "yes" ] ; then + +cat < $C_FILE +/* + * Subversion revision functions + * + * Autogenerated at make/release time + * + * Do not modify this file + * + */ + +const char *svn_revision (void) +{ + const char *SVN_Version = "$BUILD"; + return SVN_Version; +} +EOF + +elif [ ! -f $C_FILE ] ; then + +cat < $C_FILE +/* + * Subversion revision functions + * + * Autogenerated at make time + * + * There should have been one with your source distribution + * + * Do not modify this file + * + */ + +const char *svn_revision (void) +{ + const char *SVN_Version = "**UNKNOWN** Built from source without svn and no $C_FILE accompanying"; + return SVN_Version; +} +EOF + +fi diff --git a/citadel/server_main.c b/citadel/server_main.c index 61eec859a..7c453cc1b 100644 --- a/citadel/server_main.c +++ b/citadel/server_main.c @@ -72,6 +72,10 @@ const char *CitadelServiceTCP="citadel-TCP"; void go_threading(void); +/* + * For the subversion revision number + */ +const char *svn_revision(void); /* * Here's where it all begins. @@ -200,6 +204,8 @@ int main(int argc, char **argv) CtdlLogPrintf(CTDL_NOTICE, "*** Citadel server engine v%d.%02d ***\n", (REV_LEVEL/100), (REV_LEVEL%100)); + CtdlLogPrintf(CTDL_NOTICE, + "*** Build number %s ***\n", svn_revision()); CtdlLogPrintf(CTDL_NOTICE, "Copyright (C) 1987-2008 by the Citadel development team.\n"); CtdlLogPrintf(CTDL_NOTICE, -- 2.30.2