Skip to content

Commit

Permalink
ceph_ver: show the git sha1 version in the logs
Browse files Browse the repository at this point in the history
  • Loading branch information
Yehuda Sadeh committed Mar 3, 2009
1 parent 06edba7 commit c88c4da
Show file tree
Hide file tree
Showing 5 changed files with 67 additions and 1 deletion.
3 changes: 3 additions & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
AUTOMAKE_OPTIONS = gnu
EXTRA_DIST = debian autogen.sh ceph.spec.in
SUBDIRS = src

dist-hook:
src/make_version
20 changes: 19 additions & 1 deletion src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ AM_LDFLAGS =
noinst_LIBRARIES = \
libcommon.a libcrush.a \
libmon.a libmds.a libosdc.a libosd.a libclient.a \
libos.a libebofs.a
libos.a libebofs.a

noinst_LIBRARIES += libcrush_so.a #libcephclient_so.a

Expand All @@ -177,6 +177,11 @@ install-data-local:
$(install_sh_SCRIPT) -m 0600 sample.ceph.conf $(DESTDIR)$(sysconfdir)/ceph/sample.ceph.conf
$(install_sh_SCRIPT) -m 0600 sample.cluster.conf $(DESTDIR)$(sysconfdir)/ceph/sample.cluster.conf

ceph_ver.h : $(all_sources)
# ./make_version

ceph_ver.c : ceph_ver.h

# cleaning
clean-local:
-rm *.so
Expand All @@ -185,6 +190,11 @@ clean-local:

# libs
libcommon_a_SOURCES = \
ceph_ver.c \
$(libcommon_files)

# this list ommits the ceph_ver.c file
libcommon_files = \
common/LogClient.cc \
msg/Message.cc \
common/Logger.cc \
Expand Down Expand Up @@ -568,3 +578,11 @@ noinst_HEADERS = \
osdc/Objecter.h\
sample.ceph.conf\
sample.cluster.conf

all_sources = $(cmon_SOURCES) $(ceph_SOURCES) $(mkmonfs_SOURCES) $(monmaptool_SOURCES) \
$(crushtool_SOURCES) $(osdmaptool_SOURCES) $(cconf_SOURCES) $(mount_ceph_SOURCES) $(cmds_SOURCES) \
$(dumpjournal_SOURCES) $(cosd_SOURCES) $(dupstore_SOURCES) $(streamtest_SOURCES) $(csyn_SOURCES) \
$(testmsgr_SOURCES) $(cfuse_SOURCES) $(fakefuse_SOURCES) $(psim_SOURCES) \
$(libcrush_so_a_SOURCES) $(libcommon_files) $(libcrush_a_SOURCES) \
$(libmon_a_SOURCES) $(libmds_a_SOURCES) $(libebofs_a_SOURCES) $(libos_a_SOURCES) $(libosd_a_SOURCES) \
$(libosdc_a_SOURCES) $(libclient_a_SOURCES)
12 changes: 12 additions & 0 deletions src/ceph_ver.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@

#include "acconfig.h"
#include "ceph_ver.h"

#define CONCAT_VER_SYMBOL(x) ceph_ver__##x

#define DEFINE_VER_SYMBOL(x) int CONCAT_VER_SYMBOL(x)

DEFINE_VER_SYMBOL(CEPH_GIT_VER);

#define CEPH_VER VERSION "-" #CEPH_GIT_VER

7 changes: 7 additions & 0 deletions src/common/common_init.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
#include "config.h"
#include "tls.h"

#include "ceph_ver.h"

#define _STR(x) #x
#define STRINGIFY(x) _STR(x)

void common_init(std::vector<const char*>& args, bool open)
{
tls_init();
Expand All @@ -12,5 +17,7 @@ void common_init(std::vector<const char*>& args, bool open)
// open log file?
if (open)
_dout_open_log();

generic_dout(0) << "ceph version " << VERSION << " (" << STRINGIFY(CEPH_GIT_VER) << ")" << dendl;
}

26 changes: 26 additions & 0 deletions src/make_version
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/bash


dname=`dirname $0`

git_ver=`git-rev-parse HEAD 2>/dev/null`

[ -e $dname/.make_last_ver ] && \
[ -e $dname/ceph_ver.h ] && \
[ "$git_ver" == "`cat $dname/.make_last_ver`" ] && exit


print_all() {
echo "#ifndef __CEPH_VERSION_H"
echo "#define __CEPH_VERSION_H"
echo
echo "#define CEPH_GIT_VER `git-rev-parse HEAD 2>/dev/null`"
echo
echo "#endif"

}

print_all > $dname/ceph_ver.h

echo $git_ver > $dname/.make_last_ver

0 comments on commit c88c4da

Please sign in to comment.