build: Don't add version extra string to the version number.
authorRichard Jones <rjones@redhat.com>
Fri, 27 Aug 2010 12:38:49 +0000 (13:38 +0100)
committerRichard Jones <rjones@redhat.com>
Fri, 27 Aug 2010 12:38:49 +0000 (13:38 +0100)
If this string was non-empty, then it broke a lot of things because
autoconf and other parts of the build system were expecting this
string to contain a simple MAJOR.MINOR.RELEASE version number.

This requires changes to guestfish and guestmount so they use the
guestfs_version API to fetch the version from the library.  (The
Perl tools were already doing it this way).  In a way this is more
accurate, because it's no longer hard-coded in the binary, but
fetched from the dynamically linked libguestfs.so.

configure.ac
fish/fish.c
fuse/guestmount.c

index 9f81ee1..a9e4496 100644 (file)
@@ -22,7 +22,7 @@ m4_define([libguestfs_release], [5])
 # extra can be any string
 m4_define([libguestfs_extra],   [])
 
 # extra can be any string
 m4_define([libguestfs_extra],   [])
 
-AC_INIT([libguestfs],libguestfs_major.libguestfs_minor.libguestfs_release[]libguestfs_extra)
+AC_INIT([libguestfs],libguestfs_major.libguestfs_minor.libguestfs_release)
 AC_CONFIG_AUX_DIR([build-aux])
 AM_INIT_AUTOMAKE([foreign])
 
 AC_CONFIG_AUX_DIR([build-aux])
 AM_INIT_AUTOMAKE([foreign])
 
index a896a92..c535e06 100644 (file)
@@ -20,6 +20,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <inttypes.h>
 #include <string.h>
 #include <unistd.h>
 #include <fcntl.h>
 #include <string.h>
 #include <unistd.h>
 #include <fcntl.h>
@@ -381,9 +382,12 @@ main (int argc, char *argv[])
       guestfs_set_verbose (g, verbose);
       break;
 
       guestfs_set_verbose (g, verbose);
       break;
 
-    case 'V':
-      printf ("%s %s\n", program_name, PACKAGE_VERSION);
+    case 'V': {
+      struct guestfs_version *v = guestfs_version (g);
+      printf ("%s %"PRIi64".%"PRIi64".%"PRIi64"%s\n", program_name,
+              v->major, v->minor, v->release, v->extra);
       exit (EXIT_SUCCESS);
       exit (EXIT_SUCCESS);
+    }
 
     case 'x':
       guestfs_set_trace (g, 1);
 
     case 'x':
       guestfs_set_trace (g, 1);
index e1cb2d8..9b7e520 100644 (file)
@@ -29,6 +29,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <stdint.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <stdint.h>
+#include <inttypes.h>
 #include <string.h>
 #include <unistd.h>
 #include <getopt.h>
 #include <string.h>
 #include <unistd.h>
 #include <getopt.h>
@@ -1074,9 +1075,12 @@ main (int argc, char *argv[])
       guestfs_set_verbose (g, verbose);
       break;
 
       guestfs_set_verbose (g, verbose);
       break;
 
-    case 'V':
-      printf ("%s %s\n", program_name, PACKAGE_VERSION);
+    case 'V': {
+      struct guestfs_version *v = guestfs_version (g);
+      printf ("%s %"PRIi64".%"PRIi64".%"PRIi64"%s\n", program_name,
+              v->major, v->minor, v->release, v->extra);
       exit (EXIT_SUCCESS);
       exit (EXIT_SUCCESS);
+    }
 
     case HELP_OPTION:
       usage (EXIT_SUCCESS);
 
     case HELP_OPTION:
       usage (EXIT_SUCCESS);