[Openais] [corosync] [RFE] - Support for -v (version) option

Steven Dake sdake at redhat.com
Thu Jul 30 09:16:37 PDT 2009


looks good

regards
-steve

On Thu, 2009-07-30 at 16:34 +0200, Jan Friesse wrote:
> Patch version 3. Uses approach of
> - delete exec/version.h from svn control
> - generate it from configure.ac AND svnversion in autogen.sh
> 
> Regards,
>   Honza
> 
> Jan Friesse wrote:
> > Steve,
> > I'm looking on tagging script (I hope it's Makefile in root).
> > 
> > First thing:
> > - Do we really need patch to show revision? Becase line 101 (and 40 for
> > flatron):
> > 
> >         # set version
> >         echo "#define RELEASE_RELVERSION \"subrev $(REV) corosync
> > version $(RELVERSION)\"" \
> >                 > tags/corosync-$(RELVERSION)/version.h
> > 
> > should generate correct informations to version.h file. But this
> > version.h is never published to SVN so we can't use it.
> > 
> > What this file is good for?
> > 
> > I really don't understand, what tag version you want to set. RELVERSION?
> > In this case, can? we:
> > - change line 102-103 (41-42) to generate exec/version.h
> > - use RELVERSION in all VERSION outputs
> > 
> > or
> > 
> > - remove line 101-103 (40-43) from tagging script
> > - remove exec/version.h from svn (I totally agree with Fabio, that
> > rewriting something what is in version system control is ugly)
> > - use only autogen.sh to generate exec/version.h
> > 
> > Regards,
> >   Honza
> > 
> > Steven Dake napsal(a):
> >> autogen.sh should detect the tag version or honor that which is done in
> >> the tagging script.  Have you looked at how the tagging script sets the
> >> version variable?
> >>
> >> Regards
> >> -steve
> >> On Tue, 2009-07-28 at 12:17 +0200, Jan Friesse wrote:
> >>> See SUBJ and Patch.
> >>>
> >>> Regards,
> >>>   Honza
> >>> _______________________________________________
> >>> Openais mailing list
> >>> Openais at lists.linux-foundation.org
> >>> https://lists.linux-foundation.org/mailman/listinfo/openais
> >>
> > 
> > 
> 
> plain text document attachment (corosync-version-take3.patch)
> commit 061d6bedcc36623f606bc9eb4ccb7327e60498cb
> Author: Jan Friesse <jfriesse at redhat.com>
> Date:   Tue Jul 28 11:56:15 2009 +0200
> 
>     Added support for -v (version) feature
>     
>     This can be usefull for easier way to get informations
>     of the corosync version from users. Version and SVN
>     revision (get by svninfo -c) are displayed.
> 
> diff --git a/trunk/autogen.sh b/trunk/autogen.sh
> index 83770a1..920f36d 100755
> --- a/trunk/autogen.sh
> +++ b/trunk/autogen.sh
> @@ -3,3 +3,9 @@
>  
>  echo Building configuration system...
>  autoreconf -i && echo Now run ./configure and make
> +
> +# Generate version and SVN revision
> +version=`sed -n 's/AC_INIT[^,]*, \[\([[:alnum:].]*\)\].*/\1/p' configure.ac`
> +revision=`svnversion -c`
> +echo '#define RELEASE_VERSION "'$version'"' > exec/version.h
> +echo '#define SVN_REVISION "'$revision'"' >> exec/version.h
> diff --git a/trunk/exec/main.c b/trunk/exec/main.c
> index 96919b6..42e974c 100644
> --- a/trunk/exec/main.c
> +++ b/trunk/exec/main.c
> @@ -757,7 +757,7 @@ int main (int argc, char **argv)
>  	background = 1;
>  	setprio = 1;
>  
> - 	while ((ch = getopt (argc, argv, "fp")) != EOF) {
> +	while ((ch = getopt (argc, argv, "fpv")) != EOF) {
>  
>  		switch (ch) {
>  			case 'f':
> @@ -767,11 +767,18 @@ int main (int argc, char **argv)
>  			case 'p':
>  				setprio = 0;
>  				break;
> +			case 'v':
> +				printf ("Corosync Cluster Engine, version '%s' SVN revision '%s'\n", VERSION, SVN_REVISION);
> +				printf ("Copyright (c) 2006-2009 Red Hat, Inc.\n");
> +				return EXIT_SUCCESS;
> +
> +				break;
>  			default:
>  				fprintf(stderr, \
>  					"usage:\n"\
>  					"        -f     : Start application in foreground.\n"\
> -					"        -p     : Do not set process priority.    \n");
> +					"        -p     : Do not set process priority.    \n"\
> +					"        -v     : Display version and SVN revision of Corosync and exit.\n");
>  				return EXIT_FAILURE;
>  		}
>  	}
> diff --git a/trunk/exec/version.h b/trunk/exec/version.h
> deleted file mode 100644
> index 6c21615..0000000
> --- a/trunk/exec/version.h
> +++ /dev/null
> @@ -1 +0,0 @@
> -#define RELEASE_VERSION "trunk"



More information about the Openais mailing list