Little fix for patch. In case, user rebuild configure.ac and doesn't have svnversion command, display exported.

Regards,
  Honza


Jan Friesse napsal(a):
I hope last version of patch.

I was finally able to found, how to force m4 to expand shell command.

Regards,
  Honza

Fabio M. Di Nitto napsal(a):
On Thu, 2009-07-30 at 09:48 -0700, Steven Dake wrote:
On Thu, 2009-07-30 at 18:28 +0200, Fabio M. Di Nitto wrote:
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
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/openais

plain text document attachment (corosync-version-take3.patch)
commit 061d6bedcc36623f606bc9eb4ccb7327e60498cb
Author: Jan Friesse <[email protected]>
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
You don't need the RELEASE_VERSION. The one stored in configure.ac is
the same that shows up as VERSION from config.h.

Fabio,

The change here is to create version.h from autogen.sh vs the tagging
script which creates it now.  We will remove the creation of version.h
from the tagging script entirely.

Yes but that's not the point of what I mentioned.

Jan's patch does parse configure.ac to determine RELEASE_VERSION.
The exact same value is already available in include/corosync/config.h
as VERSION and already included in all .c files.

There is no point to duplicate that information.

Fabio



commit 9be6eee647d73f4adabe0ab5d5f6de82466d1e38
Author: Jan Friesse <[email protected]>
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/configure.ac b/trunk/configure.ac
index 3fb4623..6d82a4a 100644
--- a/trunk/configure.ac
+++ b/trunk/configure.ac
@@ -14,6 +14,11 @@ AC_CANONICAL_HOST
 
 AC_LANG([C])
 
+# Define SVN revision
+AC_DEFINE([SVN_REVISION],["m4_esyscmd([svnversion >/dev/null 2>&1 && \
+				       svnversion -n || \
+				       echo -n exported])"], [SVN revision])
+
 dnl Fix default variables - "prefix" variable if not specified
 if test "$prefix" = "NONE"; then
 	prefix="/usr"
diff --git a/trunk/exec/Makefile.am b/trunk/exec/Makefile.am
index 5f83c64..8361a64 100644
--- a/trunk/exec/Makefile.am
+++ b/trunk/exec/Makefile.am
@@ -70,7 +70,7 @@ SHARED_LIBS_SO_TWO	= $(SHARED_LIBS:%.so.$(SONAME)=%.so.$(SOMAJOR))
 noinst_HEADERS		= apidef.h crypto.h mainconfig.h main.h \
 			  quorum.h service.h sync.h timer.h tlist.h totemconfig.h \
 			  totemmrp.h totemnet.h totemudp.h totemiba.h totemrrp.h \
-			  totemsrp.h util.h version.h vsf.h wthread.h schedwrk.h \
+			  totemsrp.h util.h vsf.h wthread.h schedwrk.h \
 			  evil.h syncv2.h
 
 EXTRA_DIST		= $(LCRSO_SRC)
diff --git a/trunk/exec/main.c b/trunk/exec/main.c
index 96919b6..f85f773 100644
--- a/trunk/exec/main.c
+++ b/trunk/exec/main.c
@@ -83,7 +83,6 @@
 #include "apidef.h"
 #include "service.h"
 #include "schedwrk.h"
-#include "version.h"
 #include "evil.h"
 
 LOGSYS_DECLARE_SYSTEM ("corosync",
@@ -757,7 +756,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 +766,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;
 		}
 	}
@@ -790,7 +796,7 @@ int main (int argc, char **argv)
 
 	corosync_mlockall ();
 
-	log_printf (LOGSYS_LEVEL_NOTICE, "Corosync Cluster Engine ('%s'): started and ready to provide service.\n", RELEASE_VERSION);
+	log_printf (LOGSYS_LEVEL_NOTICE, "Corosync Cluster Engine ('%s'): started and ready to provide service.\n", VERSION);
 
 	(void)signal (SIGINT, sigintr_handler);
 	(void)signal (SIGUSR2, sigusr2_handler);
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"
_______________________________________________
Openais mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/openais

Reply via email to