[Libguestfs] [PATCH] Add version numbers to Perl modules (RHBZ#521674).
Richard W.M. Jones
rjones at redhat.com
Wed May 12 14:04:58 UTC 2010
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
New in Fedora 11: Fedora Windows cross-compiler. Compile Windows
programs, test, and build Windows installers. Over 70 libraries supprt'd
http://fedoraproject.org/wiki/MinGW http://www.annexia.org/fedora_mingw
-------------- next part --------------
>From 28dd97c07f5fad1c374b71a96ec63ff836792b01 Mon Sep 17 00:00:00 2001
From: Richard Jones <rjones at redhat.com>
Date: Wed, 12 May 2010 15:01:45 +0100
Subject: [PATCH] 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.
---
perl/Makefile.PL.in | 4 ++--
perl/lib/Sys/Guestfs/Lib.pm | 9 ++++++++-
src/generator.ml | 28 +++++++++++++++++-----------
3 files changed, 27 insertions(+), 14 deletions(-)
diff --git a/perl/Makefile.PL.in b/perl/Makefile.PL.in
index d18aba6..410e076 100644
--- a/perl/Makefile.PL.in
+++ b/perl/Makefile.PL.in
@@ -1,5 +1,5 @@
# 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
@@ -21,7 +21,7 @@ WriteMakefile (
FIRST_MAKEFILE => 'Makefile-pl',
NAME => 'Sys::Guestfs',
- VERSION => '@PACKAGE_VERSION@',
+ VERSION => '0. at MAX_PROC_NR@',
LIBS => '-L at top_builddir@/src/.libs -lguestfs',
INC => '-I at top_builddir@/src -I at top_srcdir@/src',
diff --git a/perl/lib/Sys/Guestfs/Lib.pm b/perl/lib/Sys/Guestfs/Lib.pm
index d3d652e..fc3163f 100644
--- a/perl/lib/Sys/Guestfs/Lib.pm
+++ b/perl/lib/Sys/Guestfs/Lib.pm
@@ -1,5 +1,5 @@
# 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
@@ -20,6 +20,13 @@ package Sys::Guestfs::Lib;
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;
diff --git a/src/generator.ml b/src/generator.ml
index d2abafc..88d5be4 100755
--- a/src/generator.ml
+++ b/src/generator.ml
@@ -4623,6 +4623,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). *)
@@ -8793,6 +8803,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');
@@ -8811,7 +8827,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.
@@ -11625,17 +11641,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 =
--
1.6.6.1
More information about the Libguestfs
mailing list