[openib-general] [PATCHv2] OpenSM: include svn version in build string
Hal Rosenstock
halr at voltaire.com
Sat Jan 28 09:23:00 PST 2006
OpenSM: include OpenIB svn version when OpenIB build
[Note: this is implemented using svnversion as seemed to be the
consensus rather than using .svn/entries. There are some downsides to
this approach. ]
Signed-off-by: Hal Rosenstock <halr at voltaire.com>
Index: include/opensm/osm_svn_revision.h
===================================================================
--- include/opensm/osm_svn_revision.h (revision 0)
+++ include/opensm/osm_svn_revision.h (revision 0)
@@ -0,0 +1 @@
+#define OSM_SVN_REVISION ""
Index: opensm/osm_opensm.c
===================================================================
--- opensm/osm_opensm.c (revision 5193)
+++ opensm/osm_opensm.c (working copy)
@@ -59,6 +59,9 @@
#include <complib/cl_passivelock.h>
#include <vendor/osm_vendor_api.h>
#include <opensm/osm_version.h>
+#ifdef OSM_VENDOR_INTF_OPENIB
+#include <opensm/osm_svn_revision.h>
+#endif
#include <opensm/osm_base.h>
#include <opensm/osm_opensm.h>
#include <opensm/osm_log.h>
@@ -206,12 +209,33 @@ osm_opensm_init(
if( status != IB_SUCCESS )
return ( status );
+#ifndef OSM_VENDOR_INTF_OPENIB
/* If there is a log level defined - add the OSM_VERSION to it. */
osm_log( &p_osm->log,
osm_log_get_level( &p_osm->log ) & ( OSM_LOG_SYS ^ 0xFF ), "%s\n",
OSM_VERSION );
/* Write the OSM_VERSION to the SYS_LOG */
osm_log( &p_osm->log, OSM_LOG_SYS, "%s\n", OSM_VERSION ); /* Format Waived */
+#else
+ if (strlen(OSM_SVN_REVISION))
+ {
+ /* If there is a log level defined - add OSM_VERSION and OSM_SVN_REVISION to it. */
+ osm_log( &p_osm->log,
+ osm_log_get_level( &p_osm->log ) & ( OSM_LOG_SYS ^ 0xFF ), "%s OpenIB svn %s\n",
+ OSM_VERSION, OSM_SVN_REVISION );
+ /* Write the OSM_VERSION and OSM_SVN_REVISION to the SYS_LOG */
+ osm_log( &p_osm->log, OSM_LOG_SYS, "%s OpenIB svn %s\n", OSM_VERSION, OSM_SVN_REVISION ); /* Format Waived */
+ }
+ else
+ {
+ /* If there is a log level defined - add the OSM_VERSION to it. */
+ osm_log( &p_osm->log,
+ osm_log_get_level( &p_osm->log ) & ( OSM_LOG_SYS ^ 0xFF ), "%s\n",
+ OSM_VERSION );
+ /* Write the OSM_VERSION to the SYS_LOG */
+ osm_log( &p_osm->log, OSM_LOG_SYS, "%s\n", OSM_VERSION ); /* Format Waived */
+ }
+#endif
osm_log( &p_osm->log, OSM_LOG_FUNCS, "osm_opensm_init: [\n" ); /* Format Waived */
Index: opensm/main.c
===================================================================
--- opensm/main.c (revision 5193)
+++ opensm/main.c (working copy)
@@ -57,6 +57,9 @@
#include <getopt.h>
#include <unistd.h>
#include <opensm/osm_version.h>
+#ifdef OSM_VENDOR_INTF_OPENIB
+#include <opensm/osm_svn_revision.h>
+#endif
#include <opensm/osm_opensm.h>
#include <complib/cl_types.h>
#include <complib/cl_debug.h>
@@ -522,6 +525,10 @@ main(
printf("-------------------------------------------------\n");
printf("%s\n", OSM_VERSION);
+#if defined ( OSM_VENDOR_INTF_OPENIB )
+ if (strlen(OSM_SVN_REVISION))
+ printf("Based on OpenIB svn %s\n", OSM_SVN_REVISION);
+#endif
osm_subn_set_default_opt(&opt);
osm_subn_parse_conf_file(&opt);
Index: opensm/Makefile.am
===================================================================
--- opensm/Makefile.am (revision 5193)
+++ opensm/Makefile.am (working copy)
@@ -9,6 +9,23 @@ else
DBGFLAGS = -g
endif
+if OSMV_OPENIB
+$(srcdir)/../include/opensm/osm_svn_revision_new.h:
+ echo -n "#define OSM_SVN_REVISION \"" >$(srcdir)/../include/opensm/osm_svn_revision_new.h ; \
+ svnversion $(srcdir)/.. | tr -d '\n' >> $(srcdir)/../include/opensm/osm_svn_revision_new.h ; \
+ echo "\"" >> $(srcdir)/../include/opensm/osm_svn_revision_new.h
+
+$(srcdir)/../include/opensm/osm_svn_revision.h: $(srcdir)/../include/opensm/osm_svn_revision_new.h
+ if cmp -s $(srcdir)/../include/opensm/osm_svn_revision_new.h \
+ $(srcdir)/../include/opensm/osm_svn_revision.h ; \
+ then \
+ rm $(srcdir)/../include/opensm/osm_svn_revision_new.h ; \
+ else \
+ mv $(srcdir)/../include/opensm/osm_svn_revision_new.h \
+ $(srcdir)/../include/opensm/osm_svn_revision.h ; \
+ fi
+endif
+
libopensm_la_CFLAGS = -Wall $(OSMV_CFLAGS) -DVENDOR_RMPP_SUPPORT $(DBGFLAGS) -D_XOPEN_SOURCE=600 -D_BSD_SOURCE=1
if HAVE_LD_VERSION_SCRIPT
More information about the general
mailing list