[Pkg-libvirt-commits] [libguestfs] 14/59: build: create and use a full version string

Hilko Bengen bengen at moszumanska.debian.org
Sun May 3 21:26:26 UTC 2015


This is an automated email from the git hooks/post-receive script.

bengen pushed a commit to branch experimental
in repository libguestfs.

commit a1646fa65c6cd544e287f25051a88c4a572ebb3e
Author: Pino Toscano <ptoscano at redhat.com>
Date:   Mon Apr 20 14:15:51 2015 +0200

    build: create and use a full version string
    
    Create a version string that includes the "extra" string as well, and
    make use of it in print_version_and_exit (which can avoid creating a new
    Guestfs handle).
    
    Folloup of commit 478a552ab431762dd2a724ade0c3fd84a21b7cab.
---
 configure.ac          | 3 +++
 fish/options.h        | 7 ++++---
 mllib/common_utils.ml | 6 +-----
 mllib/config.ml.in    | 1 +
 4 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/configure.ac b/configure.ac
index eeb61ea..11c9c67 100644
--- a/configure.ac
+++ b/configure.ac
@@ -90,6 +90,9 @@ AC_DEFINE([PACKAGE_VERSION_MAJOR],[libguestfs_major],[Major version number.])
 AC_DEFINE([PACKAGE_VERSION_MINOR],[libguestfs_minor],[Minor version number.])
 AC_DEFINE([PACKAGE_VERSION_RELEASE],[libguestfs_release],[Release number.])
 AC_DEFINE_UNQUOTED([PACKAGE_VERSION_EXTRA],["$libguestfs_extra"],[Extra version string.])
+PACKAGE_VERSION_FULL="libguestfs_major.libguestfs_minor.libguestfs_release${libguestfs_extra}"
+AC_DEFINE_UNQUOTED([PACKAGE_VERSION_FULL],["$PACKAGE_VERSION_FULL"],[Full version string.])
+AC_SUBST([PACKAGE_VERSION_FULL])
 
 # Define $(SED).
 m4_ifdef([AC_PROG_SED],[
diff --git a/fish/options.h b/fish/options.h
index d60d9e1..0348676 100644
--- a/fish/options.h
+++ b/fish/options.h
@@ -19,6 +19,8 @@
 #ifndef OPTIONS_H
 #define OPTIONS_H
 
+#include <config.h>
+
 #include <stdbool.h>
 #include <getopt.h>
 
@@ -217,10 +219,9 @@ extern void display_long_options (const struct option *) __attribute__((noreturn
 
 #define OPTION_V                                                        \
   {                                                                     \
-    struct guestfs_version *v = guestfs_version (g);                    \
-    printf ("%s %"PRIi64".%"PRIi64".%"PRIi64"%s\n",                     \
+    printf ("%s %s\n",                                                  \
             guestfs_int_program_name,                                   \
-            v->major, v->minor, v->release, v->extra);                  \
+            PACKAGE_VERSION_FULL);                                      \
     exit (EXIT_SUCCESS);                                                \
   }
 
diff --git a/mllib/common_utils.ml b/mllib/common_utils.ml
index 0d6a4a6..652a412 100644
--- a/mllib/common_utils.ml
+++ b/mllib/common_utils.ml
@@ -344,11 +344,7 @@ let run_main_and_handle_errors ~prog main =
  * the OCaml tools.
  *)
 let print_version_and_exit ~prog () =
-  let g = G.create () in
-  let { G.major = major; minor = minor;
-        release = release; extra = extra } = G.version g in
-  G.close g;
-  printf "%s %Ld.%Ld.%Ld%s\n%!" prog major minor release extra;
+  printf "%s %s\n%!" prog Config.package_version_full;
   exit 0
 
 let read_whole_file path =
diff --git a/mllib/config.ml.in b/mllib/config.ml.in
index 793a35a..fe7850b 100644
--- a/mllib/config.ml.in
+++ b/mllib/config.ml.in
@@ -19,6 +19,7 @@
 
 let package_name = "@PACKAGE_NAME@"
 let package_version = "@PACKAGE_VERSION@"
+let package_version_full = "@PACKAGE_VERSION_FULL@"
 let prefix = "@prefix@"
 let datadir = prefix ^ "/share"
 let host_cpu = "@host_cpu@"

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-libvirt/libguestfs.git



More information about the Pkg-libvirt-commits mailing list