On Mon, Jul 24, 2017 at 01:31:13PM +0200, Pino Toscano wrote:
On Friday, 21 July 2017 18:11:58 CEST Richard W.M. Jones wrote:
> ---
> builder/sources.ml | 2 --
> common/mlstdutils/Makefile.am | 4 ++-
> common/mlstdutils/stringSet.ml | 19 ++++++++++++
> common/mlstdutils/stringSet.mli | 46 ++++++++++++++++++++++++++++
> dib/elements.ml | 2 --
> sysprep/sysprep_operation_ca_certificates.ml | 1 -
> sysprep/sysprep_operation_kerberos_data.ml | 1 -
> sysprep/sysprep_operation_rpm_db.ml | 1 -
> sysprep/sysprep_operation_user_account.ml | 2 --
> v2v/create_libvirt_xml.ml | 2 --
> 10 files changed, 68 insertions(+), 12 deletions(-)
> [...]
> diff --git a/common/mlstdutils/stringSet.mli b/common/mlstdutils/stringSet.mli
> new file mode 100644
> index 000000000..e2889d86e
> --- /dev/null
> +++ b/common/mlstdutils/stringSet.mli
> @@ -0,0 +1,46 @@
> +(* virt-v2v
> + * Copyright (C) 2009-2017 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
> + * the Free Software Foundation; either version 2 of the License, or
> + * (at your option) any later version.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License along
> + * with this program; if not, write to the Free Software Foundation, Inc.,
> + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
> + *)
> +
> +type elt = String.t
> +type t = Set.Make(String).t
> +
> +val empty : t
> +val is_empty : t -> bool
> +val mem : elt -> t -> bool
> +val add : elt -> t -> t
> +val singleton: elt -> t
> +val remove: elt -> t -> t
> +val union: t -> t -> t
> +val inter: t -> t -> t
> +val diff: t -> t -> t
> +val compare: t -> t -> int
> +val equal: t -> t -> bool
> +val subset: t -> t -> bool
> +val iter: (elt -> unit) -> t -> unit
> +val map: (elt -> elt) -> t -> t
> +val fold: (elt -> 'a -> 'a) -> t -> 'a -> 'a
> +val for_all: (elt -> bool) -> t -> bool
> +val exists: (elt -> bool) -> t -> bool
> +val filter: (elt -> bool) -> t -> t
> +val partition: (elt -> bool) -> t -> t * t
> +val cardinal: t -> int
> +val elements: t -> elt list
> +val min_elt: t -> elt
> +val max_elt: t -> elt
> +val choose: t -> elt
> +val split: elt -> t -> t * bool * t
This interface fails to compile for me (Fedora 25, OCaml 4.02.3):
OCAMLCMI stringSet.cmi
OCAMLOPT stringSet.cmx
File "stringSet.ml", line 1:
Error: The implementation stringSet.ml
does not match the interface stringSet.cmi:
The value `map' is required but not provided
Makefile:2479: recipe for target 'stringSet.cmx' failed
Indeed removing 'map' from there works, but I doubt that's the correct
fix... It looks like Set.S.map was added in OCaml 4.03/04, so removing
it will fail to build for newer OCaml's.
There are two solutions:
(1) Removing 'map' (or better: comment it out) from the interface.
You're allowed to refine the interface by removing exports, so
that'll work fine with new OCaml.
(2) Implement 'map' in the implementation file. On newer OCaml it
will replace the built-in implementation.
Do you want to push a patch doing one of these?
Rich.
--
Richard Jones, Virtualization Group, Red Hat
http://people.redhat.com/~rjones
Read my programming and virtualization blog:
http://rwmj.wordpress.com
virt-p2v converts physical machines to virtual machines. Boot with a
live CD or over the network (PXE) and turn machines into KVM guests.
http://libguestfs.org/virt-v2v