[Libguestfs] [PATCH v8 1/7] ocaml osinfo database iterator

Pino Toscano ptoscano at redhat.com
Thu Sep 14 15:00:57 UTC 2017


On Tuesday, 12 September 2017 09:03:08 CEST Cédric Bosdonnat wrote:
> From: Pino Toscano <ptoscano at redhat.com>
> 
> The C osinfo database parser has been deprecated, reimplement the base
> of it in ocaml for virt-builder-repository to use. This provides an
> Osinfo.iterate_db() function traversing the files of the osinfo database
> and calling a function on each of them.
> ---

Since I contributed this bit, I guess I can provide also a commit
message:

  builder: add simple OCaml osinfo-db reader

  Add a simple OCaml-based implementation of reader of the osinfo-db:
  the only interface is an iterator that invokes an user-supplied
  function with each XML file found.

  This implementation behaves like the current C implementation, and
  still suppors the old libosinfo db.

> --- /dev/null
> +++ b/builder/osinfo.ml
> @@ -0,0 +1,80 @@
> +(* virt-builder
> + * Copyright (C) 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.
> + *)
> +
> +open Std_utils
> +open Common_utils
> +open Osinfo_config

We can add some comment here:

  (*
   * This module deals with the osinfo-db, so we can get information on
   * e.g. the distributions provided by the database.
   *
   * Try to use the shared osinfo database layout (and location) first:
   * https://gitlab.com/libosinfo/libosinfo/blob/master/docs/database-layout.txt
   *)

> +
> +let rec iterate_db fn =
> +  let locations = ref [] in
> [...]

The rest LGTM.

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


More information about the Libguestfs mailing list