summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRichard Jones <rjones@redhat.com>2010-05-12 15:01:45 +0100
committerRichard Jones <rjones@redhat.com>2010-05-12 18:13:01 +0100
commit72324580801f2c0e2b702b430b90eb141618c7f4 (patch)
treecfa6dc5bc1b64baa4ae2fd0f56853e4d03e646d9 /src
parentb7046fecee400396a35d9cd33d1726d27373c5a2 (diff)
downloadlibguestfs-72324580801f2c0e2b702b430b90eb141618c7f4.tar.gz
libguestfs-72324580801f2c0e2b702b430b90eb141618c7f4.tar.xz
libguestfs-72324580801f2c0e2b702b430b90eb141618c7f4.zip
Add version numbers to Perl modules (RHBZ#521674).
Sys::Guestfs now contains a version number which reflects the ABI that we are compiled against, ie. '0.<MAX_PROC_NR>'. This has the beneficial side effect of causing an error if the user tries to mix versions of the Perl module and the XS code. Sys::Guestfs::Lib now contains a synthetic version number which will reflect future changes in that module.
Diffstat (limited to 'src')
-rwxr-xr-xsrc/generator.ml28
1 files changed, 17 insertions, 11 deletions
diff --git a/src/generator.ml b/src/generator.ml
index 31f0e027..37ff0d41 100755
--- a/src/generator.ml
+++ b/src/generator.ml
@@ -4636,6 +4636,16 @@ let all_functions_sorted =
List.sort (fun (n1,_,_,_,_,_,_) (n2,_,_,_,_,_,_) ->
compare n1 n2) all_functions
+(* This is used to generate the src/MAX_PROC_NR file which
+ * contains the maximum procedure number, a surrogate for the
+ * ABI version number. See src/Makefile.am for the details.
+ *)
+let max_proc_nr =
+ let proc_nrs = List.map (
+ fun (_, _, proc_nr, _, _, _, _) -> proc_nr
+ ) daemon_functions in
+ List.fold_left max 0 proc_nrs
+
(* Field types for structures. *)
type field =
| FChar (* C 'char' (really, a 7 bit byte). *)
@@ -8806,6 +8816,12 @@ package Sys::Guestfs;
use strict;
use warnings;
+# This version number changes whenever a new function
+# is added to the libguestfs API. It is not directly
+# related to the libguestfs version number.
+use vars qw($VERSION);
+$VERSION = '0.%d';
+
require XSLoader;
XSLoader::load ('Sys::Guestfs');
@@ -8824,7 +8840,7 @@ sub new {
return $self;
}
-";
+" max_proc_nr;
(* Actions. We only need to print documentation for these as
* they are pulled in from the XS code automatically.
@@ -11638,17 +11654,7 @@ let inspect ?connect ?xml names =
parse_operatingsystems xml
"
-(* This is used to generate the src/MAX_PROC_NR file which
- * contains the maximum procedure number, a surrogate for the
- * ABI version number. See src/Makefile.am for the details.
- *)
and generate_max_proc_nr () =
- let proc_nrs = List.map (
- fun (_, _, proc_nr, _, _, _, _) -> proc_nr
- ) daemon_functions in
-
- let max_proc_nr = List.fold_left max 0 proc_nrs in
-
pr "%d\n" max_proc_nr
let output_to filename k =