Add version numbers to Perl modules (RHBZ#521674).
authorRichard Jones <rjones@redhat.com>
Wed, 12 May 2010 14:01:45 +0000 (15:01 +0100)
committerRichard Jones <rjones@redhat.com>
Wed, 12 May 2010 17:13:01 +0000 (18:13 +0100)
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.

perl/Makefile.PL.in
perl/lib/Sys/Guestfs/Lib.pm
src/generator.ml

index d18aba6..410e076 100644 (file)
@@ -1,5 +1,5 @@
 # libguestfs Perl bindings
 # libguestfs Perl bindings
-# Copyright (C) 2009 Red Hat Inc.
+# Copyright (C) 2009-2010 Red Hat Inc.
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -21,7 +21,7 @@ WriteMakefile (
     FIRST_MAKEFILE => 'Makefile-pl',
 
     NAME => 'Sys::Guestfs',
     FIRST_MAKEFILE => 'Makefile-pl',
 
     NAME => 'Sys::Guestfs',
-    VERSION => '@PACKAGE_VERSION@',
+    VERSION => '0.@MAX_PROC_NR@',
 
     LIBS => '-L@top_builddir@/src/.libs -lguestfs',
     INC => '-I@top_builddir@/src -I@top_srcdir@/src',
 
     LIBS => '-L@top_builddir@/src/.libs -lguestfs',
     INC => '-I@top_builddir@/src -I@top_srcdir@/src',
index d3d652e..fc3163f 100644 (file)
@@ -1,5 +1,5 @@
 # Sys::Guestfs::Lib
 # Sys::Guestfs::Lib
-# Copyright (C) 2009 Red Hat Inc.
+# Copyright (C) 2009-2010 Red Hat Inc.
 #
 # This library is free software; you can redistribute it and/or
 # modify it under the terms of the GNU Lesser General Public
 #
 # This library is free software; you can redistribute it and/or
 # modify it under the terms of the GNU Lesser General Public
@@ -20,6 +20,13 @@ package Sys::Guestfs::Lib;
 use strict;
 use warnings;
 
 use strict;
 use warnings;
 
+# The minor part of this version number is incremented when some
+# change is made to this module.  The major part is incremented if we
+# make a change which is not backwards compatible.  It is not related
+# to the libguestfs version number.
+use vars qw($VERSION);
+$VERSION = '0.1';
+
 use Carp qw(croak);
 
 use Sys::Guestfs;
 use Carp qw(croak);
 
 use Sys::Guestfs;
index 31f0e02..37ff0d4 100755 (executable)
@@ -4636,6 +4636,16 @@ let all_functions_sorted =
   List.sort (fun (n1,_,_,_,_,_,_) (n2,_,_,_,_,_,_) ->
                compare n1 n2) all_functions
 
   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). *)
 (* 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;
 
 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');
 
 require XSLoader;
 XSLoader::load ('Sys::Guestfs');
 
@@ -8824,7 +8840,7 @@ sub new {
   return $self;
 }
 
   return $self;
 }
 
-";
+" max_proc_nr;
 
   (* Actions.  We only need to print documentation for these as
    * they are pulled in from the XS code automatically.
 
   (* 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
 "
 
   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 () =
 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 =
   pr "%d\n" max_proc_nr
 
 let output_to filename k =