On Mon, 8 Oct 2007, Uwe Hermann wrote:
On Sun, Oct 07, 2007 at 11:09:24AM +0200, Ulf Jordan wrote:
Attached is a patch that:

* derives the superiotool version number from the latest committed change
to superiotool files (NOT the latest svn up of the superiotool directory)

Hm, isn't that wrong? We want to know the extact version from which the
binary was built, _not_ the most current version in the repository at the
time it was built...

My formulation was inexact. svnversion shows the local revisions of the working copy, not the repository. What I meant to say was:

* derives the superiotool version number from the highest revision number of the checked out superiotool files (NOT the revision number from latest svn up of the superiotool directory)

* strips away extra information from svnversion, to arrive at a single
version number like 2828 instead of 2814:2828M ("this build is made up of
files with latest modification in rev 2814 to 2828 plus local
modifications").

Hm, maybe that would even be a good thing? We could tell from that
output that a user used a modified version and ask for a diff...

Yes maybe. More information at the expense of a more odd looking version number.

The stripping is implemented by the sed invocation, without which we would get the more detailed information. I'll leave it as is, awaiting further discussion on what we actually want to show in the version number.

This approach could easily be combined with a traditional version number
from a #define in superiotool.h, as Robinson pointed out.

Not needed and not useful. We don't want to confuse people with _two_
versioning systems.

OK.

Index: Makefile
===================================================================
--- Makefile    (revision 2828)
+++ Makefile    (working copy)
@@ -24,14 +24,19 @@
 INSTALL = /usr/bin/install
 PREFIX  = /usr/local

+SVNDEF := -D'SUPERIOTOOL_VERSION="$(shell svnversion -cn . \
+          | sed -e "s/.*://" -e "s/\([0-9]*\).*/\1/")"'

Please add a comment here which explains what the contents of the
variable will be (svn rev of latest commit etc...), how it works, etc.

OK, added.

Attached is an updated patch.

/ulf
Set the superiotool version number from svn at build time.

Signed-off-by: Ulf Jordan <[EMAIL PROTECTED]>

Index: superiotool.c
===================================================================
--- superiotool.c       (revision 2842)
+++ superiotool.c       (working copy)
@@ -170,12 +170,7 @@
 
 static void print_version(void)
 {
-       char tmp[80];
-
-       strncpy((char *)&tmp,
-               (const char *)&SUPERIOTOOL_VERSION[6],
-               strlen(SUPERIOTOOL_VERSION) - 8);
-       printf("superiotool r%s\n", (char *)&tmp);
+       printf("superiotool r%s\n", SUPERIOTOOL_VERSION);
 }
 
 int main(int argc, char *argv[])
Index: superiotool.h
===================================================================
--- superiotool.h       (revision 2842)
+++ superiotool.h       (working copy)
@@ -29,8 +29,6 @@
 #include <getopt.h>
 #include <sys/io.h>
 
-#define SUPERIOTOOL_VERSION "$Rev$"
-
 #define USAGE "Usage: superiotool [-d] [-D] [-V] [-v] [-h]\n\n\
   -d | --dump            Dump Super I/O registers\n\
   -D | --dump-readable   Dump Super I/O registers in human-readable format\n\
Index: Makefile
===================================================================
--- Makefile    (revision 2842)
+++ Makefile    (working copy)
@@ -24,14 +24,21 @@
 INSTALL = /usr/bin/install
 PREFIX  = /usr/local
 
+# Set the superiotool version string from the highest revision number
+# of the checked out superiotool files.
+SVNDEF := -D'SUPERIOTOOL_VERSION="$(shell svnversion -cn . \
+          | sed -e "s/.*://" -e "s/\([0-9]*\).*/\1/")"'
+
 # TODO: -pedantic
 CFLAGS = -O2 -Wall -Werror -Wstrict-prototypes -Wundef -Wstrict-aliasing \
-         -Werror-implicit-function-declaration -ansi
+         -Werror-implicit-function-declaration -ansi $(SVNDEF)
 
 OBJS = superiotool.o ali.o fintek.o ite.o nsc.o smsc.o winbond.o
 
 all: $(PROGRAM)
 
+superiotool.o: *.c superiotool.h
+
 $(PROGRAM): $(OBJS) superiotool.h
        $(CC) $(CFLAGS) -o $(PROGRAM) $(OBJS)
 
-- 
linuxbios mailing list
linuxbios@linuxbios.org
http://www.linuxbios.org/mailman/listinfo/linuxbios

Reply via email to