[Libguestfs] [PATCH] common/mlstdutils: Implement StringSet.

Pino Toscano ptoscano at redhat.com
Mon Jul 24 11:31:13 UTC 2017


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.

-- 
Pino Toscano
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part.
URL: <http://listman.redhat.com/archives/libguestfs/attachments/20170724/9b9ba596/attachment.sig>


More information about the Libguestfs mailing list