[openib-general] [PATCH] OpenSM: include OpenIB svn version when OpenIB build

Hal Rosenstock halr at voltaire.com
Tue Jan 3 09:43:33 PST 2006


OpenSM: include OpenIB svn version when OpenIB build

Signed-off-by: Hal Rosenstock <halr at voltaire.com>

Index: osm_opensm.c
===================================================================
--- osm_opensm.c	(revision 4716)
+++ 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: main.c
===================================================================
--- main.c	(revision 4716)
+++ 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: Makefile.am
===================================================================
--- Makefile.am	(revision 4716)
+++ Makefile.am	(working copy)
@@ -9,6 +9,22 @@ else
 DBGFLAGS = -g -O2
 endif
 
+if OSMV_OPENIB
+$(srcdir)/../include/opensm/osm_svn_revision.h:
+	if test -f $(srcdir)/../.svn/entries; then \
+		grep revision $(srcdir)/../.svn/entries | sed 's/revision=/#define OSM_SVN_REVISION /' | sed 's/\/>//' >$(srcdir)/../include/opensm/osm_svn_revision.h; \
+	else \
+		echo "#define OSM_SVN_REVISION \"\"" >$(srcdir)/../include/opensm/osm_svn_revision.h; \
+	fi
+
+main.c: $(srcdir)/../include/opensm/osm_svn_revision.h
+	if test -f $(srcdir)/../include/opensm/osm_svn_revision.h; then \
+		if test -f  $(srcdir)/../.svn/entries; then \
+			grep revision $(srcdir)/../.svn/entries | sed 's/revision=/#define OSM_SVN_REVISION /' | sed 's/\/>//' >$(srcdir)/../include/opensm/osm_svn_revision.h; \
+		fi \
+	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