[openib-general] Re: [RFC] OpenSM: include svn version in build string

Michael S. Tsirkin mst at mellanox.co.il
Tue Nov 22 11:36:43 PST 2005


Quoting r. Troy Benjegerdes <hozer at hozed.org>:
> Subject: Re: [openib-general] Re: [RFC] OpenSM: include svn version in build string
> 
> On Tue, Nov 22, 2005 at 06:00:47PM +0200, Michael S. Tsirkin wrote:
> > Quoting r. Hal Rosenstock <halr at voltaire.com>:
> > > Subject: [RFC] OpenSM: include svn version in build string
> > > 
> > > Hi,
> > > 
> > > It has been requested (several times now :-) that the svn version be
> > > included in the OpenSM build string version info (as 1.1.0 isn't
> nearly
> > > descriptive enough). This needs to work both in and out of the
> OpenIB
> > > svn tree as builds will occur both ways.
> > > 
> > > So one way to accomplish this which has additional overhead on each
> > > checkin is to maintain something like an osm_svnversion file at the
> osm
> > > level of the tree and display that in opensm/main.c when OpenSM
> starts
> > > up.
> > > 
> > > Another way would be to modify include/opensm/osm_base.h OSM_VERSION
> > > with this info. Again. manual.
> > > 
> > > Anyone see how to get away from the manual overhead of this ?
> > > 
> > > Anyone have other ideas on how to solve this ? (Are there other
> examples
> > > of this out there ?)
> > > 
> > > Thanks.
> > > 
> > > -- Hal
> > 
> > You also want a url in there to make subversion revision a unique
> identifier.
> > 
> > For in-tree build, you can have Makefile generate a header from
> > .svn/entries
> > 
> > something like
> > 
> > version.h: .svn/entries
> > 	grep -e revision= -e url= $^ | head 2> $@
> > 
> > in the makefile should be sufficient.
> > 
> > For an out of tree build, you just stick something into version.h.
> > after you do svn export.
> > 
> > Its also important to have a default version identifier by
> > keeping a backup version.h under include directory, have that
> > picked up after the local version if that doesnt exist.
> 
> I'd suggest using the command 'svnversion' if it exists, since that will
> tell you if you have a locally modified version as well.
> 
> I tried to get this working for the kernel modules, and came up with
> this:
> 
> ibversion.sh:
> 
> #!/bin/sh
> 
> SVN=`svnversion $1`
> 
> echo \#define IBVERSION \"$SVN\" > $1.tmp
> 
> diff -q $1.tmp $1
> if [ $? != '0' ] ; then
>         mv $1.tmp $1
> else
>         rm $1.tmp
> fi
> 
> 
> 
> 
> Content-Description: svn-version-test.diff
> Index: linux-kernel/infiniband/ulp/ipoib/ipoib_main.c
> ===================================================================
> --- linux-kernel/infiniband/ulp/ipoib/ipoib_main.c	(revision 3968)
> +++ linux-kernel/infiniband/ulp/ipoib/ipoib_main.c	(working copy)
> @@ -51,6 +51,9 @@
>  MODULE_DESCRIPTION("IP-over-InfiniBand net driver");
>  MODULE_LICENSE("Dual BSD/GPL");
>  
> +#include <ibversion.h>
> +MODULE_VERSION(IBVERSION);
> +
>  #ifdef CONFIG_INFINIBAND_IPOIB_DEBUG
>  int ipoib_debug_level;
>  
> @@ -917,6 +920,8 @@
>  	struct ipoib_dev_priv *priv;
>  	int result = -ENOMEM;
>  
> +	printk(KERN_WARNING "hca->node_type = %d\n", hca->node_type);
> +			
>  	priv = ipoib_intf_alloc(format);
>  	if (!priv)
>  		goto alloc_mem_failed;
> Index: linux-kernel/infiniband/ulp/ipoib/Makefile
> ===================================================================
> --- linux-kernel/infiniband/ulp/ipoib/Makefile	(revision 3968)
> +++ linux-kernel/infiniband/ulp/ipoib/Makefile	(working copy)
> @@ -9,3 +9,6 @@
>  						   ipoib_vlan.o
>  ib_ipoib-$(CONFIG_INFINIBAND_IPOIB_DEBUG)	+= ipoib_fs.o
>  
> +drivers/infiniband/include/ibversion.h: FORCE
> +	sh drivers/infiniband/ibversion.sh $@
> +
> Index: linux-kernel/infiniband/hw/mthca/Makefile
> ===================================================================
> --- linux-kernel/infiniband/hw/mthca/Makefile	(revision 3968)
> +++ linux-kernel/infiniband/hw/mthca/Makefile	(working copy)
> @@ -1,5 +1,8 @@
>  EXTRA_CFLAGS += -Idrivers/infiniband/include
>  
> +drivers/infiniband/include/ibversion.h: FORCE
> +	sh drivers/infiniband/ibversion.sh $@
> +
>  ifdef CONFIG_INFINIBAND_MTHCA_DEBUG
>  EXTRA_CFLAGS += -DDEBUG
>  endif
> @@ -11,3 +14,4 @@
>  		mthca_mr.o mthca_qp.o mthca_av.o mthca_mcg.o mthca_mad.o \
>  		mthca_provider.o mthca_memfree.o mthca_uar.o mthca_srq.o \
>  		mthca_catas.o
> +
> Index: linux-kernel/infiniband/hw/mthca/mthca_dev.h
> ===================================================================
> --- linux-kernel/infiniband/hw/mthca/mthca_dev.h	(revision 3968)
> +++ linux-kernel/infiniband/hw/mthca/mthca_dev.h	(working copy)
> @@ -44,13 +44,15 @@
>  #include <linux/pci.h>
>  #include <linux/dma-mapping.h>
>  #include <asm/semaphore.h>
> +#include <ibversion.h>
>  
>  #include "mthca_provider.h"
>  #include "mthca_doorbell.h"
>  
>  #define DRV_NAME	"ib_mthca"
>  #define PFX		DRV_NAME ": "
> -#define DRV_VERSION	"0.06"
> +//#define DRV_VERSION	"0.06"
> +#define DRV_VERSION	IBVERSION
>  #define DRV_RELDATE	"June 23, 2005"
>  
>  enum {
> 
> 

I dont think its a good idea to add dependency on svnversion to
the makefile.

Lets just add --with-version= option to configure.
Then the user can run it --with-version=`svnversion`

-- 
MST



More information about the general mailing list